On Tue, 11 May 2021 01:17:32 GMT, John Neffenger <jgn...@openjdk.org> wrote:
>> The Windows build calls a series of batch files to get the Visual Studio >> paths and environment variables. The batch files are a black box: any >> messages they print are discarded. If anything goes wrong, the only signs >> are a vague Gradle exception and a corrupted properties file. >> >> This has been causing problems for years. There are at least 49 messages on >> the mailing since 2017 that discuss the exception and ways to work around it. >> >> This pull request lets you enable the batch file messages, shedding light on >> their internal workings and allowing you to catch any errors at their >> source. Specifically, it adds the variable `VSCMD_DEBUG` to the environment >> of `genVSproperties.bat` and documents its use. >> >> ### Before >> >> For example, if your `PATH` environment variable is missing >> `C:/Windows/System32`, like mine was, you'll see the following errors: >> >> >> $ gradle sdk >> Dependency verification is an incubating feature. >> >> FAILURE: Build failed with an exception. >> >> * Where: >> Script 'C:\cygwin64\home\john\src\jfx\buildSrc\win.gradle' line: 108 >> >> * What went wrong: >> A problem occurred evaluating script. >>> FAIL: WINSDK_DIR not defined >> >> ︙ >> >> BUILD FAILED in 4s >> >> >> *Me:* What's a `WINSDK_DIR`? The Wiki says, "This means that you will have >> to define these paths manually." I guess this is normal. 😕️ >> >> ### After >> >> With this change, you can set the debug level to "3" in the `win.gradle` >> file and get a better picture of the problem: >> >> >> $ gradle sdk >> Dependency verification is an incubating feature. >> >>> Configure project : >> 'reg' is not recognized as an internal or external command, >> operable program or batch file. >> 'reg' is not recognized as an internal or external command, >> operable program or batch file. >> 'reg' is not recognized as an internal or external command, >> operable program or batch file. >> >> ︙ >> >> 'powershell.exe' is not recognized as an internal or external command, >> operable program or batch file. >> >> FAILURE: Build failed with an exception. >> >> * Where: >> Script 'C:\cygwin64\home\john\src\jfx\buildSrc\win.gradle' line: 108 >> >> * What went wrong: >> A problem occurred evaluating script. >>> FAIL: WINSDK_DIR not defined >> >> ︙ >> >> BUILD FAILED in 3s >> >> >> *Me:* Oh, it's just a "command not found" error. I'll check my `PATH`. 🤓 > > John Neffenger has updated the pull request incrementally with one additional > commit since the last revision: > > Skip sending telemetry to fix "file in use" error Finally had time to test this. I think this is a welcome feature, although we should document it's usage in the [wiki](https://wiki.openjdk.java.net/display/OpenJFX/Building+OpenJFX#BuildingOpenJFX-Windows) and where the log file is and what to search for. Regarding my test, I did the following: 1. Changed the following `PATH` variable: `C:\WINDOWS\system32` -> `C:\WINDOWS\system321` 2. run `gradle` 3. Then I got, as expected: > FAIL: WINSDK_DIR not defined Now I struggled a bit. I set `export VSCMD_DEBUG=3` and tried to run `gradle` again. But same error and no logfile. But turns out the whole build folder should be deleted first as otherwise you will get the error again immediately. That's something we should document then as well. After deleting the build folder and rerun `gradle`, I finally had a huge log and after a deep look I found the following: (Note: the `command not found` error is written in german here 😄) [DEBUG:winsdk.bat] specified /winsdk= was not found or was incomplete C:\dev\Projects\IdeaProjects\OpenJFX>for /F "tokens=1,2*" %i in ('reg query "HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\VSPerf" /v "CollectionToolsDir"') DO (if "%i" == "CollectionToolsDir" (SET "__collection_tools=%k" ) ) Der Befehl "reg" ist entweder falsch geschrieben oder konnte nicht gefunden werden. C:\dev\Projects\IdeaProjects\OpenJFX>if "" == "" for /F "tokens=1,2*" %i in ('reg query "HKCU\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v8.1" /v "InstallationFolder"') DO (if "%i" == "InstallationFolder" (SET WindowsSdkDir=%k ) ) Der Befehl "reg" ist entweder falsch geschrieben oder konnte nicht gefunden werden. This looks good to me and is helpful. And after documenting it, I think it will be more clear for everyone including new developers. :) ------------- PR: https://git.openjdk.java.net/jfx/pull/488