JDK-8094389 : Gradle build scripts don't work with Gradle 1.12
  • Type: Bug
  • Component: javafx
  • Sub-Component: build
  • Affected Version: 8u5
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • Submitted: 2014-05-27
  • Updated: 2015-06-12
  • Resolved: 2015-04-03
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8
8u60Resolved
Related Reports
Duplicate :  
Description
Gradle 1.12 fails to compile the build scripts.
The main issue I encountered was the use of a defineProperty method from build.gradle in the platform-specific build scripts, e.g. buildSrc/windows.gradle, buildSrc/mac.gradle.  
According to the Gradle documentation at http://www.gradle.org/docs/current/userguide/writing_build_scripts.html

the scope of a method is the script it is defined in. 
To add a method to the Project you would need to use a Convention object.

Consider using a closure instead:

ext.defineProperty = { name, defaultValue ->
    if (!project.hasProperty(name)) {
        project.ext.set(name, defaultValue);
    }
}

Or factor out the utility methods into a common.gradle script and use something like:
apply from: rootProject.file('common.gradle')

Comments
Fixed by RT-40254
03-04-2015

I recently looked into what was necessary for this. Here is the diff to get Gradle 2.1 support (however, I'll note that the output of these changes has not been tested): diff --git a/build.gradle b/build.gradle --- a/build.gradle +++ b/build.gradle @@ -751,22 +751,22 @@ NUM_COMPILE_THREADS = 1 } -// Check that Gradle 1.8 is in use. -if (gradle.gradleVersion != "1.8") { +// Check that Gradle 2.1 is in use. +if (gradle.gradleVersion != "2.1") { def ver = gradle.gradleVersion.split("[\\.]"); def gradleMajor = Integer.parseInt(ver[0]); def gradleMinor = Integer.parseInt(ver[1]); def err = ""; - if (gradleMajor != 1) { - err = "Gradle major version is incompatible: ${gradle.gradleVersion}; supported version is 1.8"; + if (gradleMajor != 2) { + err = "Gradle major version is incompatible: ${gradle.gradleVersion}; supported version is 2.1"; } else { - if (gradleMinor < 8) { - err = "Gradle version too old: ${gradle.gradleVersion}; must be at least 1.8" + if (gradleMinor < 1) { + err = "Gradle version too old: ${gradle.gradleVersion}; must be at least 2.1" } // Blacklisted versions of gradle if (gradleMinor == 11) { - err = "JavaFX fails to build with Gradle ${gradle.gradleVersion}; supported version is 1.8" + err = "JavaFX fails to build with Gradle ${gradle.gradleVersion}; supported version is 2.1" } } @@ -776,7 +776,7 @@ logger.warn("*****************************************************************"); logger.warn("Unsupported gradle version $gradle.gradleVersion in use."); - logger.warn("Only version 1.8 is supported. Use this version at your own risk"); + logger.warn("Only version 2.1 is supported. Use this version at your own risk"); if ( err != "") logger.warn(err); logger.warn("*****************************************************************"); } @@ -2542,16 +2542,12 @@ allprojects { // The following block is a workaround for the fact that presently Gradle // can't set the -XDignore.symbol.file flag, because it appears that the - // javac API is lacking support for it. So what we'll do is find any Compile + // javac API is lacking support for it. So what we'll do is find any JavaCompile // task and manually provide the options necessary to fire up the // compiler with the right settings. // // Also, we need to remove jfxrt.jar from the ext classpath (if it is there) - tasks.withType(Compile) { compile -> - // It looks like we have to use ant to compile instead of the built-in gradle - // compiler stuff because otherwise it won't compile on CYGWIN - // TODO need to file issue with Gradle - compile.options.useAnt = true + tasks.withType(JavaCompile) { compile -> compile.options.debug = true // we always generate debugging info in the class files compile.options.debugOptions.debugLevel = IS_DEBUG_JAVA ? "source,lines,vars" : "source,lines" compile.options.fork = true
17-09-2014

We are unlikely to get to this for 8u40, so retargeting for 9 (if there is a simple, safe patch we could consider it). I note that for 9 we are more likely to go to gradle 2.0.
17-09-2014

I think Gradle have acknowledged that this is a regression in 1.12. Gradle 2.0rc-2 is available now. Gradle 2.0 may offer ways to simplify much of the native building as well. That would be great because it supports Visual Studio builds on Windows and might reduce the need for Cygwin. (Given that Gradle offers a cross platform build tool for both Java and native code, I would hope the idea of requiring extra hacks on Windows like Cygwin could some day be eliminated by simply using Java/Gradle/Groovy code in a much more cross-platform way.)
25-06-2014

Felipe just ran into this again. I'll look at doing this early in 8u40.
24-06-2014