Skip to content

Commit

Permalink
close #60, lazily evaluate args for runShadow task
Browse files Browse the repository at this point in the history
  • Loading branch information
johnrengelman committed Jun 28, 2014
1 parent 6513045 commit 28695cf
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ v1.0.1

+ Fix issue where non-class files are dropped when using relocation ([Issue #58](https://github.com/johnrengelman/shadow/issues/58))
+ Do not create a / directory inside the output jar.
+ Fix `runShadow` task to evaluate the `shadowJar.archiveFile` property at execution time. ([Issue #60](https://github.com/johnrengelman/shadow/issues/60))

v1.0.0
======
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ class ShadowApplicationPlugin implements Plugin<Project> {
run.description = 'Runs this project as a JVM application using the shadow jar'
run.group = ApplicationPlugin.APPLICATION_GROUP
run.main = '-jar'
run.args = [jar.archivePath]
run.conventionMapping.jvmArgs = { pluginConvention.applicationDefaultJvmArgs }
run.doFirst {
args = [jar.archivePath.path] + args
}
}

private void addCreateScriptsTask(Project project) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ class PublishingSpec extends PluginSpecification {
file('src/main/java/myapp/Main.java') << """
|package myapp;
|public class Main {
| static void main(String[] args) {
| System.out.println("Hello World!");
| public static void main(String[] args) {
| System.out.println("TestApp: Hello World! (" + args[0] + ")");
| }
|}
""".stripMargin()
Expand All @@ -171,12 +171,17 @@ class PublishingSpec extends PluginSpecification {
|dependencies {
| compile 'shadow:a:1.0'
|}
|
|runShadow {
| args 'foo'
|}
""".stripMargin()

settingsFile << "rootProject.name = 'myapp'"

when:
runner.arguments << 'installShadow'
runner.arguments << 'runShadow'
ExecutionResult result = runner.run()

then:
Expand All @@ -200,5 +205,8 @@ class PublishingSpec extends PluginSpecification {

and:
assert startScript.text.contains("-jar \$APP_HOME/lib/myapp-1.0-all.jar")

and:
assert result.standardOutput.contains('TestApp: Hello World! (foo)')
}
}

0 comments on commit 28695cf

Please sign in to comment.