Skip to content

Commit

Permalink
Closes #297 - uses compileClasspath configuration to apply shadow res…
Browse files Browse the repository at this point in the history
…ources to compile tasks.
  • Loading branch information
John Engelman authored and John Engelman committed Jun 23, 2017
1 parent 9696c4a commit 7ef6fc2
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/docs/asciidoc/11-filtering-contents.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ of the dependencies to be merged.
include::{tests}/FilteringSpec.groovy[tags=excludeFile]
----

Excludes and includes can be combined just like a noraml `Jar` task, with `excludes` taking precendence over `includes`.
Excludes and includes can be combined just like a normal `Jar` task, with `excludes` taking precendence over `includes`.
Additionally, ANT style patterns can be used to match multiple files.

.Configuring output using ANT patterns
Expand Down
2 changes: 1 addition & 1 deletion src/docs/asciidoc/12-controlling-dependencies.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Shadow configures the default `shadowJar` task to merge all dependencies from the project's `runtime` configuration
into the final JAR.
The configurations to source dependencies from for the merging can be configured using the `configurations` property
The configurations to from which to source dependencies for the merging can be configured using the `configurations` property
of the link:{api}/tasks/ShadowJar.html[`ShadowJar`] task type.

[source,groovy,indent=0]
Expand Down
7 changes: 6 additions & 1 deletion src/docs/asciidoc/90-changes.adoc
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
== Change Log

[discrete]
=== v2.0.0 (Unreleased)
=== v2.0.1

* Fix `null+configuration` error (https://github.com/johnrengelman/shadow/issues/297[Issue #297])

[discrete]
=== v2.0.0

* **Breaking Change!** Restrict Plugin to Gradle 3.0+
* **Breaking Change!** Build with Java 7
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@ class PluginShadowPlugin implements Plugin<Project> {
void apply(Project project) {
project.plugins.apply(ShadowPlugin)

ConfigureShadowRelocation relocate = project.tasks.create(ConfigureShadowRelocation.taskName(project.tasks.shadowJar), ConfigureShadowRelocation)
relocate.target = (ShadowJar) project.tasks.shadowJar
project.tasks.withType(ShadowJar) { ShadowJar task ->
if (task.name == ShadowJavaPlugin.SHADOW_JAR_TASK_NAME) {
ConfigureShadowRelocation relocate = project.tasks.create(ConfigureShadowRelocation.taskName(project.tasks.shadowJar), ConfigureShadowRelocation)
relocate.target = (ShadowJar) project.tasks.shadowJar

project.tasks.shadowJar.dependsOn relocate
project.tasks.shadowJar.dependsOn relocate
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ class ShadowJavaPlugin implements Plugin<Project> {
void apply(Project project) {
configureShadowTask(project)

project.tasks.withType(AbstractCompile) {
it.classpath += project.configurations.shadow
}
project.configurations.compileClasspath.extendsFrom project.configurations.shadow

}

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/shadow-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.0.0
2.0.1
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class PluginShadowPluginSpec extends PluginSpecification {
""".stripIndent()

when:
runner.withArguments('shadowJar').build()
runner.withArguments('shadowJar', '-s').build()

then:
then:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ class PluginSpecification extends Specification {
'''
}

def cleanup() {
println buildFile.text
}

String getDefaultBuildScript() {
return """
buildscript {
Expand All @@ -45,8 +49,12 @@ class PluginSpecification extends Specification {
version = "1.0"
group = 'shadow'
apply plugin: 'java'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'java'
sourceSets {
integTest
}
repositories { maven { url "${repo.uri}" } }
""".stripIndent()
Expand Down

0 comments on commit 7ef6fc2

Please sign in to comment.