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

Gradle: command line override sometimes ignored for boolean properties

XMLWordPrintable

      We have several cases where the following, or similar, pattern is used:

      defineProperty("COMPILE_WEBKIT", "false")
      if (COMPILE_WEBKIT instanceof String) ext.COMPILE_WEBKIT = Boolean.parseBoolean(COMPILE_WEBKIT)

      Using the same variable name as first a String property and then a Boolean property (the fact that this is even allowed is one of my pet peeves about scripting languages) in this manner sometimes confuses gradle when you try to override the default setting on the command line. See RT-32260 for an example of a real failure that was caused by this problem.

      We need to fix this, by leaving the COMPILE_WEBKIT, etc, variables as String properties and defining new Boolean properties that we use in the script for testing. The following are examples of the pattern we should use:

      defineProperty("USE_DEPEND", "true")
      ext.IS_USE_DEPEND = Boolean.parseBoolean(USE_DEPEND)

      defineProperty("JCOV", "false")
      ext.DO_JCOV = Boolean.parseBoolean(JCOV)

            kcr Kevin Rushforth
            kcr Kevin Rushforth
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: