For some reason, the default gradlew.bat file for Windows includes these lines:
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
The problem is that using %$ actually causes problems with command-line arguments in TCC/4NT, in particular when they include dashes. For example, trying to run the following:
gradlew :Dashboard:assembleRelease --daemon --parallel -Dorg.gradle.jvmargs=-Xmx2048m
produces the error
Problem configuring task :Dashboard:assembleRelease from command line.
> Unknown command-line option '-X'.
This happens because %$ is breaking the last argument into two separate ones. Indeed, printing the value of %CMD_LINE_ARGS%
yields
:Dashboard:assembleRelease --daemon --parallel -Dorg.gradle.jvmargs -Xmx2048m
whereas %* does not produce this problem.
According to the TCC documentation, the only difference between %$ and %* is in respect to the SHIFT command, which is not used anywhere in gradlew.bat that I can see. So maybe it’s not actually necessary to handle TCC/4NT in any special way? Indeed, removing these lines fixes the issue, with no apparent ill effects.
Is the “official” gradlew.bat file the one at https://github.com/gradle/gradle/blob/master/gradlew.bat? I was thinking of sending a pull request removing this, if you believe it would be correct.
Gradle Version: Any
Operating System: Windows 10 with TCC/LE 13.06.77
Is this a regression? Apparently no