gradle - Why is this finalizer running even when the finalized task is up-to-date? -


i want run transformations on code quality reports can have them in both human- , machine-readable formats. thought finalizedby ideal tool use because, according the documentation:

finalizer tasks executed if finalized task fails.

… …

finalizer tasks not executed if finalized task didn't work, example if considered date

however, i'm seeing transform tasks running when tasks finalize up-to-date. here's build.gradle:

apply plugin: "findbugs" apply plugin: "java"  repositories { mavencentral() }  def findbugsjar = project.configurations.findbugs.find { it.name.startswith("findbugs") }  tasks.withtype(findbugs) {     reports {         xml.destination "$builddir/reports/${task.name}.xml"         xml.setwithmessages(true)     }      def taskname = it.name     def transformer = tasks.create(name: "transform" + gutil.tocamelcase(taskname))      it.finalizedby transformer     transformer.description "transform report $taskname html."      transformer << {         ant.xslt(in: "$builddir/reports/${taskname}.xml", out: "$builddir/reports/${taskname}.html") {             style {                 zipentry(zipfile: findbugsjar, name: "fancy-hist.xsl")             }         }     } } 

and output of ./gradlew check without source changes:

$ ./gradlew check :compilejava up-to-date :processresources up-to-date :classes up-to-date :findbugsmain up-to-date :transformfindbugsmain :compiletestjava up-to-date :processtestresources up-to-date :testclasses up-to-date :findbugstest up-to-date :transformfindbugstest failed  failure: build failed exception. 

as can see, transformfindbugsmain being run though findbugsmain up-to-date. worse, simplified test case happens contain no test classes, findbugstest produces no output @ (gradle appears consider "up-to-date", seems reasonable enough, suppose). result, transformfindbugstest bombs out entirely (the stack trace — omitted here brevity — indicates indeed result of ant.xslt not being able find source file).

am misunderstanding intended behavior of finalizedby? there wrong build file?

i'm running gradle 2.3 , java (64-bit) 1.8.0_40 on windows 8.

as @opal mentioned, indeed looks bug. next minimal gradle code repro problem:

task tasky << {     println 'tasky' }  task taskx {     outputs.uptodatewhen { true }     finalizedby tasky     dolast { println 'taskx' } } 

output:

$ ./gradlew taskx :taskx up-to-date :tasky tasky 

per specific case, possible workaround can condition action on existence of relevant file ($builddir/reports/${taskname}.xml).


Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -