diff --git a/src/GitInfo/GitInfo.nuspec b/src/GitInfo/GitInfo.nuspec index ba93d54..22ea7d9 100644 --- a/src/GitInfo/GitInfo.nuspec +++ b/src/GitInfo/GitInfo.nuspec @@ -46,5 +46,7 @@ The generated code contains only constants, so it can be used to construct your + + diff --git a/src/GitInfo/build/GitInfo.targets b/src/GitInfo/build/GitInfo.targets index b90a3f3..61d8957 100644 --- a/src/GitInfo/build/GitInfo.targets +++ b/src/GitInfo/build/GitInfo.targets @@ -146,7 +146,7 @@ $(_GitOutput.Trim()) - + + <_GitVersionFile>$(GitVersionFile) $(GitVersionFile) File - + + + + + + "$([System.IO.Path]::GetDirectoryName("$(GitVersionFile)"))" + + + + + + "C:\Program Files\Git\bin\git.exe" "C:\Program Files (x86)\Git\bin\git.exe" C:\msysgit\bin\git.exe + $(MSBuildThisFileDirectory)wslrun.cmd git C:\cygwin\bin\git.exe + C:\cygwin64\bin\git.exe git.exe @@ -804,7 +829,9 @@ ============================================================ --> + $(MSBuildThisFileDirectory)wslpath.cmd C:\cygwin\bin\cygpath.exe + C:\cygwin64\bin\cygpath.exe diff --git a/src/GitInfo/build/wslpath.cmd b/src/GitInfo/build/wslpath.cmd new file mode 100644 index 0000000..505ac9a --- /dev/null +++ b/src/GitInfo/build/wslpath.cmd @@ -0,0 +1,26 @@ +@echo off +setlocal EnableExtensions EnableDelayedExpansion +REM Usage: wslpath.cmd -w +REM Converts a path from the Linux /mnt/c/... format into Windows format. + +REM Usage: wslpath.cmd -u +REM Converts a path from Windows to Linux format. + +REM Both usages require `wslrun.cmd` in the same directory as this file. + +if exist %0\..\wslrun.cmd set WSLRUN="%0\..\wslrun.cmd" +if exist %CD%\%0\..\wslrun.cmd set WSLRUN="%CD%\%0\..\wslrun.cmd" + +if "%1" == "-w" goto :towindows +if "%1" == "-u" shift /1 + +REM Convert path to Linux +if exist "%1\*" (pushd %1) else (pushd %~dp1) +if ERRORLEVEL 1 goto :eof +%WSLRUN% pwd +popd +goto :eof + +:towindows +REM Convert path to Windows +%WSLRUN% cd "'%2'" ^&^& cmd.exe /c cd diff --git a/src/GitInfo/build/wslrun.cmd b/src/GitInfo/build/wslrun.cmd new file mode 100644 index 0000000..0ea2ae5 --- /dev/null +++ b/src/GitInfo/build/wslrun.cmd @@ -0,0 +1,11 @@ +@echo off +REM Usage: wslrun.cmd +REM Runs the given command in the Windows Subsystem for Linux bash shell. + +REM Locate bash.exe +REM 32/64 bits causes issues here because it actually redirects the System32 dir +set BASH=bash.exe +if exist C:\Windows\System32\bash.exe set BASH=C:\Windows\System32\bash.exe +if exist C:\Windows\Sysnative\bash.exe set BASH=C:\Windows\Sysnative\bash.exe + +%BASH% -c "%*"