Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8185011

build.gradle cannot always parse gradle minor version

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 10
    • 10
    • javafx

    Description

      A gradle 4.1 snapshot build reports this version :
      Gradle 4.1-20170718061434+0000

      RC1 reports this
      Gradle 4.1-rc-1

      In both cases the FX build fails on a java exception with these because it
      expects everything except for "." to be just decimals .. so it tries this
      Integer.parseInt("1-rc-1")

      I propose the somewhat more robust option of taking that string
      and looking just for the leading digits.

      def gradleMinor = Integer.parseInt(ver[1].split("[^0-9]")[0]);

      This would fail only if there were none .. which doesn't seem to be a problem
      in practice.

      Whilst we don't actually use that minor version right now .. but it'll be important
      when 4.1 is the minimum since 4.0.1 does NOT work.

      However I do not intend to bump the required version yet.
      Not until at least 4.1 is final but it is definite that to be able to use JDK 10
      as the JDK to compile or test FX we will need 4.1 sometime.

      It also is intended to officially support JDK 9 so we might bump this in a
      JDK9 "updtes" forest too once both (4.1 GA and 9 updates) exist.

      patch looks like this :
      diff --git a/build.gradle b/build.gradle
      --- a/build.gradle
      +++ b/build.gradle
      @@ -1073,7 +1073,7 @@
       if (gradle.gradleVersion != "3.1") {
           def ver = gradle.gradleVersion.split("[\\.]");
           def gradleMajor = Integer.parseInt(ver[0]);
      - def gradleMinor = Integer.parseInt(ver[1]);
      + def gradleMinor = Integer.parseInt(ver[1].split("[^0-9]")[0]);
           def err = "";
           if (gradleMajor < 3) {
               err = "Gradle version too old: ${gradle.gradleVersion}; must be at least 3.0"

      Attachments

        Activity

          People

            prr Philip Race
            prr Philip Race
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: