forked from pantsbuild/pants
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed publish integration tests to use testprojects/*
Copied the examples required by the test to testprojects so they can be changed independently of examples without making those more convoluted. Testing Done: ci.sh Reviewed at https://rbcommons.com/s/twitter/r/1026/
- Loading branch information
1 parent
657106c
commit a32d0a2
Showing
11 changed files
with
167 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import os | ||
|
||
repo(name = 'testing', | ||
url = 'http://maven.twttr.com', | ||
push_db = os.path.join(buildfile_path(), 'pushdb', 'publish.properties')) | ||
|
Empty file.
10 changes: 10 additions & 0 deletions
10
testprojects/src/java/com/pants/testproject/publish/hello/greet/BUILD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). | ||
# Licensed under the Apache License, Version 2.0 (see LICENSE). | ||
|
||
java_library(name = 'greet', | ||
dependencies = [], | ||
sources = globs('*.java'), | ||
provides = artifact(org='com.pants.testproject.publish', | ||
name='hello-greet', | ||
repo='testprojects/ivy:testing',), | ||
) |
41 changes: 41 additions & 0 deletions
41
testprojects/src/java/com/pants/testproject/publish/hello/greet/Greeting.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). | ||
// Licensed under the Apache License, Version 2.0 (see LICENSE). | ||
|
||
package com.pants.testproject.publish.hello.greet; | ||
|
||
import java.io.FileInputStream; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.util.Scanner; | ||
|
||
public final class Greeting { | ||
public static String greetFromFile(String filename) throws IOException { | ||
FileInputStream is = new FileInputStream(filename); | ||
try { | ||
return greetFromStream(is); | ||
} finally { | ||
is.close(); | ||
} | ||
} | ||
|
||
public static String greetFromResource(String resource) throws IOException { | ||
InputStream is = Greeting.class.getClassLoader().getResourceAsStream(resource); | ||
try { | ||
return greetFromStream(is); | ||
} finally { | ||
is.close(); | ||
} | ||
} | ||
|
||
public static String greetFromStream(InputStream is) throws IOException { | ||
return greet(new Scanner(is).useDelimiter("\\Z").next()); | ||
} | ||
|
||
public static String greet(String greetee) { | ||
return "Hello, " + greetee + "!"; | ||
} | ||
|
||
private Greeting() { | ||
// not called. placates checkstyle | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
testprojects/src/java/com/pants/testproject/publish/hello/main/BUILD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). | ||
# Licensed under the Apache License, Version 2.0 (see LICENSE). | ||
|
||
# Like Hello World, but built with Pants. | ||
|
||
jvm_app(name='main', | ||
basename = 'hello-example', | ||
dependencies = [ | ||
':main-bin' | ||
], | ||
) | ||
|
||
# The binary, the "runnable" part: | ||
|
||
jvm_binary(name = 'main-bin', | ||
dependencies = [ | ||
'testprojects/src/java/com/pants/testproject/publish/hello/greet', | ||
], | ||
source = 'HelloMain.java', | ||
main = 'com.pants.testproject.publish.hello.main.HelloMain', | ||
basename = 'hello-example', | ||
) | ||
|
||
# README page: | ||
|
||
page(name="readme", | ||
source="README.md") | ||
|
19 changes: 19 additions & 0 deletions
19
testprojects/src/java/com/pants/testproject/publish/hello/main/HelloMain.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). | ||
// Licensed under the Apache License, Version 2.0 (see LICENSE). | ||
|
||
package com.pants.testproject.publish.hello.main; | ||
|
||
import java.io.IOException; | ||
|
||
import com.pants.testproject.publish.hello.greet.Greeting; | ||
|
||
public class HelloMain { | ||
|
||
public static void main(String[] args) throws IOException { | ||
System.out.println("Hello"); | ||
} | ||
|
||
private HelloMain() { | ||
// not called. placates checkstyle | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
testprojects/src/scala/com/pants/testproject/publish/BUILD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). | ||
# Licensed under the Apache License, Version 2.0 (see LICENSE). | ||
|
||
scala_library(name = 'jvm-run-example-lib', | ||
dependencies = [ | ||
'testprojects/src/scala/com/pants/testproject/publish/hello/welcome', | ||
], | ||
sources = ['JvmRunExample.scala'], | ||
provides = artifact(org='com.pants.testproject.publish', | ||
name='jvm-example-lib', | ||
repo='testprojects/ivy:testing',) | ||
) |
15 changes: 15 additions & 0 deletions
15
testprojects/src/scala/com/pants/testproject/publish/JvmRunExample.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). | ||
// Licensed under the Apache License, Version 2.0 (see LICENSE). | ||
|
||
package com.pants.testproject.publish | ||
|
||
// A simple jvm binary to test the jvm_run task on. Try, e.g., | ||
// ./pants goal run src/scala/com/pants/example:jvm-run-example \\ | ||
// -ldebug --jvm-run-jvmargs=-Dfoo=bar --jvm-run-args="Foo Bar" | ||
|
||
object JvmRunExample { | ||
def main(args: Array[String]) { | ||
println("Hello, World") | ||
println("args: " + args.mkString(", ")) | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
testprojects/src/scala/com/pants/testproject/publish/hello/welcome/BUILD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). | ||
# Licensed under the Apache License, Version 2.0 (see LICENSE). | ||
|
||
# Seq-friendly wrapper for Java "greet" library: greet everything in a seq. | ||
|
||
scala_library(name='welcome', | ||
dependencies=[ | ||
'testprojects/src/java/com/pants/testproject/publish/hello/greet:greet', | ||
], | ||
sources=globs('*.scala'), | ||
provides = artifact(org='com.pants.testproject.publish.hello', | ||
name='welcome', | ||
repo='testprojects/ivy:testing',), | ||
) |
16 changes: 16 additions & 0 deletions
16
testprojects/src/scala/com/pants/testproject/publish/hello/welcome/Welcome.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). | ||
// Licensed under the Apache License, Version 2.0 (see LICENSE). | ||
|
||
package com.pants.testproject.publish.hello.welcome | ||
|
||
import com.pants.testproject.publish.hello.greet.Greeting | ||
|
||
// Welcome a collection of things. | ||
// Given a seq of strings, return a seq of greetings for each of them | ||
// Handy wrapper around the greet Java library. | ||
|
||
object WelcomeEverybody { | ||
def apply(everybody: Seq[String]): Seq[String] = { | ||
everybody.map(x => Greeting.greet(x)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters