On Thu, 13 May 2021 19:11:26 GMT, John Neffenger <jgn...@openjdk.org> wrote:

>> 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
>
> I wrote a Bash shell script, included below, that can help in reviewing this 
> pull request. It isolates the call to `vcvarsall.bat`, making it easier to 
> experiment with different choices, such as:
> 
> - leaving `VSCMD_SKIP_SENDTELEMETRY` undefined,
> - adding the `/q` option to `cmd`,
> - removing `2>&1` to use the default standard error, or
> - discarding standard output with `> /dev/null`.
> 
> 
> #!/bin/bash
> # Tests the Visual Studio 'vcvarsall.bat' batch file
> trap exit INT TERM
> set -o errexit
> 
> # Path to 'vcvarsall.bat' batch file
> vsroot="C:\\Program Files (x86)\\Microsoft Visual Studio"
> vcfile="2019\\Community\\VC\\Auxiliary\\Build\\vcvarsall.bat"
> vcpath="$vsroot\$vcfile"
> 
> # Windows command interpreter and options
> #   /C  Carries out the command specified by string and then terminates
> #   /Q  Turns echo off
> command="cmd /c"
> 
> # Skips calling PowerShell script to send telemetry
> export VSCMD_SKIP_SENDTELEMETRY="1"
> printf "VSCMD_SKIP_SENDTELEMETRY="%s"\n" "$VSCMD_SKIP_SENDTELEMETRY"
> 
> # VSCMD_DEBUG undefined
> unset VSCMD_DEBUG
> printf "Testing VSCMD_DEBUG="%s"\n" "$VSCMD_DEBUG"
> $command "$vcpath" x86 > 0-debug.log 2>&1
> $command "$vcpath" x64 >> 0-debug.log 2>&1
> 
> # VSCMD_DEBUG = 1 (basic), 2 (detailed), and 3 (trace)
> for n in 1 2 3; do
>     export VSCMD_DEBUG="$n"
>     printf "Testing VSCMD_DEBUG="%s"\n" "$VSCMD_DEBUG"
>     $command "$vcpath" x86 > $n-debug.log 2>&1
>     $command "$vcpath" x64 >> $n-debug.log 2>&1
> done
> 
> 
> I run the script under Cygwin on Windows and evaluate its output as follows:
> 
> 
> $ ./vcvarstest.sh
> VSCMD_SKIP_SENDTELEMETRY="1"
> Testing VSCMD_DEBUG=""
> Testing VSCMD_DEBUG="1"
> Testing VSCMD_DEBUG="2"
> Testing VSCMD_DEBUG="3"
> $ wc -l *.log
>     10 0-debug.log
>     92 1-debug.log
>    508 2-debug.log
>   5690 3-debug.log
>   6300 total

> @jgneff, do you have an idea of what kind of errors would be better detected 
> with these changes?

Thanks for trying it, Joeri. The intent is to make all such errors better 
detected, but that can happen only when you run the build with `VSCMD_DEBUG=3` 
and when you're able to find the errors in the log file.

Without `VSCMD_DEBUG=3`, the batch files discard the output and errors of each 
`reg query` command, as shown below in the file `winsdk.bat`:


:GetWin10SdkDir

if "%VSCMD_DEBUG%" GEQ "3" goto :GetWin10SdkDirVerbose

call :GetWin10SdkDirHelper HKLM\SOFTWARE\Wow6432Node > nul 2>&1


In addition, it helps to have an idea what to look for in the log file because 
not all errors are prefixed with something helpful like `ERROR`. In the test 
that you ran, the following steps could lead you to the source of the problem:


$ export VSCMD_DEBUG=3
$ gradle sdk
   ︙
> FAIL: WINSDK_DIR not defined
   ︙
$ grep -A2 'reg query' build/vcvarsall.log
C:\cygwin64\home\john\src\jfx>for /F "tokens=1,2*" %i in
('reg query "HKLM\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0"

-------------

PR: https://git.openjdk.java.net/jfx/pull/488

Reply via email to