Skip to content

Commit

Permalink
Merge pull request nebula-plugins#63 from chali/TaskDependencies
Browse files Browse the repository at this point in the history
Create explicit dependnecy between jar tasks and generate properties tasks to keep original contract
  • Loading branch information
chali committed Feb 26, 2020
2 parents bee7d31 + 91eab67 commit 1125db6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Expand Up @@ -39,6 +39,9 @@ class InfoJarPropertiesFilePlugin implements Plugin<Project>, InfoReporterPlugin
//TODO: this should probably be using lazy API but needs some refactoring
project.afterEvaluate {
project.tasks.withType(Jar) { Jar jarTask ->
//explicit dependency on original task to keep contract that `jar` task invocation will produce properties file
//even this file is actually not bundled into jar
jarTask.dependsOn(manifestTask)
//we cannot use the right module name because touching manifest task to early causes incorrect name computation
//temp.properties is renamed later when placed into jar
def taskName = jarTask.name.capitalize()
Expand Down
Expand Up @@ -27,6 +27,8 @@ class InfoPropertiesFilePluginLauncherSpec extends IntegrationSpec {
result = runTasks('jar')

then:
File originalProperties = new File(projectDir, "build/manifest/${moduleName}.properties")
originalProperties.exists()
File jarFile = new File(projectDir, "build/libs/${moduleName}.jar")
jarFile.exists()
Properties metadata = getPropertiesFromJar(jarFile)
Expand Down

0 comments on commit 1125db6

Please sign in to comment.