Put the commit hash into the msvc binary package

This commit is contained in:
Ryan Prichard 2017-01-18 04:57:11 -06:00
parent 9fcad3a144
commit a703349883
6 changed files with 13 additions and 9 deletions

1
.gitattributes vendored
View File

@ -17,4 +17,3 @@ configure text
*.sh eol=lf *.sh eol=lf
configure eol=lf configure eol=lf
VERSION.txt eol=lf VERSION.txt eol=lf
shared/GetCommitHash.cmd text eol=crlf

View File

@ -106,7 +106,8 @@ def build(arch, packageDir, xp=False):
'"' + devCmdPath + '" && ' '"' + devCmdPath + '" && '
" vcbuild.bat" + " vcbuild.bat" +
" --gyp-msvs-version " + versionInfo["gyp_version"] + " --gyp-msvs-version " + versionInfo["gyp_version"] +
" --msvc-platform " + archInfo["msvc_platform"] " --msvc-platform " + archInfo["msvc_platform"] +
" --commit-hash " + common_ship.commitHash
) )
subprocess.check_call(commandLine, shell=True, env=newEnv) subprocess.check_call(commandLine, shell=True, env=newEnv)

View File

@ -6,13 +6,9 @@ rem -- output nothing instead.
mkdir ..\gen 2>nul mkdir ..\gen 2>nul
set /p VERSION=<..\..\VERSION.txt set /p VERSION=<..\..\VERSION.txt
git rev-parse HEAD >nul 2>nul && ( set COMMIT=%1
for /F "delims=" %%i IN ('git rev-parse HEAD') DO set COMMIT=%%i
) || (
set COMMIT=none
)
echo // AUTO-GENERATED BY %0>..\gen\GenVersion.h echo // AUTO-GENERATED BY %0 %*>..\gen\GenVersion.h
echo const char GenVersion_Version[] = "%VERSION%";>>..\gen\GenVersion.h echo const char GenVersion_Version[] = "%VERSION%";>>..\gen\GenVersion.h
echo const char GenVersion_Commit[] = "%COMMIT%";>>..\gen\GenVersion.h echo const char GenVersion_Commit[] = "%COMMIT%";>>..\gen\GenVersion.h

View File

@ -9,6 +9,9 @@
# can be configured by passing variables to make, e.g.: # can be configured by passing variables to make, e.g.:
# make -j4 CXX=i686-w64-mingw32-g++ LDFLAGS="-static -static-libgcc -static-libstdc++" # make -j4 CXX=i686-w64-mingw32-g++ LDFLAGS="-static -static-libgcc -static-libstdc++"
'variables': {
'WINPTY_COMMIT_HASH%': '<!(cmd /c "cd shared && GetCommitHash.bat")',
},
'target_defaults' : { 'target_defaults' : {
'defines' : [ 'defines' : [
'UNICODE', 'UNICODE',
@ -19,7 +22,7 @@
'include_dirs': [ 'include_dirs': [
# Add the 'src/gen' directory to the include path and force gyp to # Add the 'src/gen' directory to the include path and force gyp to
# run the script (re)generating the version header. # run the script (re)generating the version header.
'<!(cmd /c "cd shared && UpdateGenVersion.bat")', '<!(cmd /c "cd shared && UpdateGenVersion.bat <(WINPTY_COMMIT_HASH)")',
], ],
}, },
'targets' : [ 'targets' : [

View File

@ -43,6 +43,11 @@ if "%1" == "--toolset" (
shift && shift shift && shift
goto :ParamLoop goto :ParamLoop
) )
if "%1" == "--commit-hash" (
set GYP_ARGS=%GYP_ARGS% -D WINPTY_COMMIT_HASH=%2
shift && shift
goto :ParamLoop
)
echo error: Unrecognized argument: %1 echo error: Unrecognized argument: %1
exit /b 1 exit /b 1
:ParamDone :ParamDone