Full Incremental GWT Task

Hello everyone,

I have a little issue that I can’t wrap my head around. I have a multimodule project with three modules. One of the modules is using GWT which I’ve managed to build just fine with Gradle, it is even incremental in as if I run the task again it wont recompile unless anything has changed in the files.

But the incremental part is not to my full satisfaction since it will indicate that the task is out of date when I change any file in the project, not just the files that the GWT module requires. This will result in the GWT module rebuilding even when I change files in another project module in a package not related to the GWT module.

This is what I got so far:

task compileGWT(dependsOn: classes, type: JavaExec) {
 inputs.source sourceSets.main.java.srcDirs
 inputs.dir sourceSets.main.output.resourcesDir
 outputs.dir gwtBuildDir
   // Workaround for incremental build (GRADLE-1483)
 outputs.upToDateSpec = new org.gradle.api.specs.AndSpec()
   doFirst {
  file(gwtBuildDir).mkdirs()
//
classpath.each { println it.name}
 }
   main = 'com.google.gwt.dev.Compiler'
   classpath {
  [
    sourceSets.main.java.srcDirs,
         // Java source
    sourceSets.main.output.resourcesDir, // Generated resources
    sourceSets.main.output.classesDir,
// Genereated classes
    sourceSets.main.compileClasspath
// Deps
  ]
 }
   args =
  [
    '-war', gwtBuildDir,
    '-logLevel', 'INFO',
    '-localWorkers', '2',
    '-compileReport',
    '-extra', extraDir,
//
            '-draftCompile', // Speeds up compile with 25%
    'com.test.gradle.GradleTest' // GWT module
  ]
   maxHeapSize = '512M'
}

The gwtBuildDir and extraDir are specified as following:

ext {
 gwtBuildDir = "${project.buildDir}/war"
 extraDir = "${project.buildDir}/extra"
}

I have tried some stuff with sourceSets (trying to set the inputDir to the place the GWT module code resides) and I have also tried to apply the incrementalTask example in gradle sample folder to no avail.

Running with ‘–info’ will tell you why the task is considered out-of-date.