Skip to content

Commit

Permalink
Put the commit hash into the msvc binary package
Browse files Browse the repository at this point in the history
  • Loading branch information
rprichard committed Jan 18, 2017
1 parent 9fcad3a commit a703349
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 9 deletions.
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,3 @@ configure text
*.sh eol=lf
configure eol=lf
VERSION.txt eol=lf
shared/GetCommitHash.cmd text eol=crlf
3 changes: 2 additions & 1 deletion ship/make_msvc_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ def build(arch, packageDir, xp=False):
'"' + devCmdPath + '" && '
" vcbuild.bat" +
" --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)
Expand Down
File renamed without changes.
8 changes: 2 additions & 6 deletions src/shared/UpdateGenVersion.bat
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,9 @@ rem -- output nothing instead.
mkdir ..\gen 2>nul

set /p VERSION=<..\..\VERSION.txt
git rev-parse HEAD >nul 2>nul && (
for /F "delims=" %%i IN ('git rev-parse HEAD') DO set COMMIT=%%i
) || (
set COMMIT=none
)
set COMMIT=%1

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_Commit[] = "%COMMIT%";>>..\gen\GenVersion.h

Expand Down
5 changes: 4 additions & 1 deletion src/winpty.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
# can be configured by passing variables to make, e.g.:
# 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' : {
'defines' : [
'UNICODE',
Expand All @@ -19,7 +22,7 @@
'include_dirs': [
# Add the 'src/gen' directory to the include path and force gyp to
# run the script (re)generating the version header.
'<!(cmd /c "cd shared && UpdateGenVersion.bat")',
'<!(cmd /c "cd shared && UpdateGenVersion.bat <(WINPTY_COMMIT_HASH)")',
],
},
'targets' : [
Expand Down
5 changes: 5 additions & 0 deletions vcbuild.bat
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ if "%1" == "--toolset" (
shift && shift
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
exit /b 1
:ParamDone
Expand Down

0 comments on commit a703349

Please sign in to comment.