diff options
author | Steve Dower <steve.dower@python.org> | 2019-06-14 21:20:16 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-14 21:20:16 (GMT) |
commit | f78e66c3c9cd3a65cedba8d35f8e715e0535d8bf (patch) | |
tree | b3e2518679fe351215dff488ee9300d4c42dda3e /PCbuild | |
parent | 322281e7caa161d5b9c0f3fbf79efd15299f3594 (diff) | |
download | cpython-f78e66c3c9cd3a65cedba8d35f8e715e0535d8bf.zip cpython-f78e66c3c9cd3a65cedba8d35f8e715e0535d8bf.tar.gz cpython-f78e66c3c9cd3a65cedba8d35f8e715e0535d8bf.tar.bz2 |
Implement Windows release builds in Azure Pipelines (GH-14065)
Includes backported fixes from GH-14091
Diffstat (limited to 'PCbuild')
-rw-r--r-- | PCbuild/_tkinter.vcxproj | 2 | ||||
-rw-r--r-- | PCbuild/build.bat | 19 | ||||
-rw-r--r-- | PCbuild/pyproject.props | 18 | ||||
-rw-r--r-- | PCbuild/python.props | 4 | ||||
-rw-r--r-- | PCbuild/python.vcxproj | 21 | ||||
-rw-r--r-- | PCbuild/tcltk.props | 21 |
6 files changed, 66 insertions, 19 deletions
diff --git a/PCbuild/_tkinter.vcxproj b/PCbuild/_tkinter.vcxproj index fdfa596..af813b7 100644 --- a/PCbuild/_tkinter.vcxproj +++ b/PCbuild/_tkinter.vcxproj @@ -122,7 +122,7 @@ <ImportGroup Label="ExtensionTargets"> </ImportGroup> <Target Name="_CopyTclTkDLL" Inputs="@(_TclTkDLL)" Outputs="@(_TclTkDLL->'$(OutDir)%(Filename)%(Extension)')" AfterTargets="Build"> - <Copy SourceFiles="@(_TclTkDLL)" DestinationFolder="$(OutDir)" /> + <Copy SourceFiles="@(_TclTkDLL)" DestinationFolder="$(OutDir)" UseHardlinksIfPossible="true" /> </Target> <Target Name="_CleanTclTkDLL" BeforeTargets="Clean"> <Delete Files="@(_TclTkDLL->'$(OutDir)%(Filename)%(Extension)')" /> diff --git a/PCbuild/build.bat b/PCbuild/build.bat index 6f0c85e..bce5993 100644 --- a/PCbuild/build.bat +++ b/PCbuild/build.bat @@ -76,7 +76,7 @@ if "%~1"=="-k" (set kill=true) & shift & goto CheckOpts if "%~1"=="--pgo" (set do_pgo=true) & shift & goto CheckOpts if "%~1"=="--pgo-job" (set do_pgo=true) & (set pgo_job=%~2) & shift & shift & goto CheckOpts if "%~1"=="--test-marker" (set UseTestMarker=true) & shift & goto CheckOpts -if "%~1"=="-V" shift & goto Version +if "%~1"=="-V" shift & goto :Version rem These use the actual property names used by MSBuild. We could just let rem them in through the environment, but we specify them on the command line rem anyway for visibility so set defaults after this @@ -111,10 +111,16 @@ call "%dir%find_msbuild.bat" %MSBUILD% if ERRORLEVEL 1 (echo Cannot locate MSBuild.exe on PATH or as MSBUILD variable & exit /b 2) if "%kill%"=="true" call :Kill +if ERRORLEVEL 1 exit /B 3 if "%do_pgo%"=="true" ( set conf=PGInstrument call :Build %1 %2 %3 %4 %5 %6 %7 %8 %9 +) +rem %VARS% are evaluated eagerly, which would lose the ERRORLEVEL +rem value if we didn't split it out here. +if "%do_pgo%"=="true" if ERRORLEVEL 1 exit /B %ERRORLEVEL% +if "%do_pgo%"=="true" ( del /s "%dir%\*.pgc" del /s "%dir%\..\Lib\*.pyc" echo on @@ -124,7 +130,8 @@ if "%do_pgo%"=="true" ( set conf=PGUpdate set target=Build ) -goto Build +goto :Build + :Kill echo on %MSBUILD% "%dir%\pythoncore.vcxproj" /t:KillPython %verbose%^ @@ -132,7 +139,7 @@ echo on /p:KillPython=true @echo off -goto :eof +exit /B %ERRORLEVEL% :Build rem Call on MSBuild to do the work, echo the command. @@ -148,9 +155,11 @@ echo on %1 %2 %3 %4 %5 %6 %7 %8 %9 @echo off -goto :eof +exit /b %ERRORLEVEL% :Version rem Display the current build version information call "%dir%find_msbuild.bat" %MSBUILD% -if not ERRORLEVEL 1 %MSBUILD% "%dir%pythoncore.vcxproj" /t:ShowVersionInfo /v:m /nologo %1 %2 %3 %4 %5 %6 %7 %8 %9 +if ERRORLEVEL 1 (echo Cannot locate MSBuild.exe on PATH or as MSBUILD variable & exit /b 2) +%MSBUILD% "%dir%pythoncore.vcxproj" /t:ShowVersionInfo /v:m /nologo %1 %2 %3 %4 %5 %6 %7 %8 %9 +if ERRORLEVEL 1 exit /b 3
\ No newline at end of file diff --git a/PCbuild/pyproject.props b/PCbuild/pyproject.props index 12f07dd..7c0f50b 100644 --- a/PCbuild/pyproject.props +++ b/PCbuild/pyproject.props @@ -1,6 +1,8 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" TreatAsLocalProperty="Py_IntDir"> +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" TreatAsLocalProperty="Py_IntDir"> + <Import Project="python.props" Condition="$(__Python_Props_Imported) != 'true'" /> <PropertyGroup Label="Globals"> + <__PyProject_Props_Imported>true</__PyProject_Props_Imported> <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion> <OutDir>$(BuildPath)</OutDir> @@ -29,7 +31,7 @@ <ClCompile> <AdditionalIncludeDirectories>$(PySourcePath)Include;$(PySourcePath)Include\internal;$(PySourcePath)PC;$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>WIN32;$(_PlatformPreprocessorDefinition)$(_DebugPreprocessorDefinition)$(_PydPreprocessorDefinition)%(PreprocessorDefinitions)</PreprocessorDefinitions> - + <Optimization>MaxSpeed</Optimization> <IntrinsicFunctions>true</IntrinsicFunctions> <StringPooling>true</StringPooling> @@ -147,15 +149,15 @@ public override bool Execute() { </Code> </Task> </UsingTask> - + <Target Name="KillPython" BeforeTargets="PrepareForBuild" Condition="'$(KillPython)' == 'true'"> <Message Text="Killing any running python$(PyDebugExt)$(PyTestExt).exe instances..." Importance="high" /> <KillPython FileName="$(OutDir)python$(PyDebugExt)$(PyTestExt).exe" /> </Target> - + <!-- A default target to handle msbuild pcbuild.proj /t:CleanAll. - + Some externals projects don't respond to /t:Clean, so we invoke CleanAll on them when we really want to clean up. --> @@ -189,8 +191,8 @@ public override bool Execute() { <SdkBinPath Condition="!Exists($(SdkBinPath))">$(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots@KitsRoot81)\bin\x86</SdkBinPath> <SdkBinPath Condition="!Exists($(SdkBinPath))">$(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots@KitsRoot)\bin\x86</SdkBinPath> <SdkBinPath Condition="!Exists($(SdkBinPath))">$(registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.1A@InstallationFolder)\Bin\</SdkBinPath> - <_SignCommand Condition="Exists($(SdkBinPath)) and '$(SigningCertificate)' != '' and $(SupportSigning)">"$(SdkBinPath)\signtool.exe" sign /q /a /n "$(SigningCertificate)" /fd sha256 /t http://timestamp.verisign.com/scripts/timestamp.dll /d "Python $(PythonVersion)"</_SignCommand> - <_SignCommand Condition="Exists($(SdkBinPath)) and '$(SigningCertificateSha1)' != '' and $(SupportSigning)">"$(SdkBinPath)\signtool.exe" sign /q /a /sha1 "$(SigningCertificateSha1)" /fd sha256 /t http://timestamp.verisign.com/scripts/timestamp.dll /d "Python $(PythonVersion)"</_SignCommand> + <_SignCommand Condition="Exists($(SdkBinPath)) and '$(SigningCertificate)' != '' and $(SupportSigning)">"$(SdkBinPath)\signtool.exe" sign /a /n "$(SigningCertificate)" /fd sha256 /t http://timestamp.verisign.com/scripts/timestamp.dll /d "Python $(PythonVersion)"</_SignCommand> + <_SignCommand Condition="Exists($(SdkBinPath)) and '$(SigningCertificateSha1)' != '' and $(SupportSigning)">"$(SdkBinPath)\signtool.exe" sign /a /sha1 "$(SigningCertificateSha1)" /fd sha256 /t http://timestamp.verisign.com/scripts/timestamp.dll /d "Python $(PythonVersion)"</_SignCommand> <_MakeCatCommand Condition="Exists($(SdkBinPath))">"$(SdkBinPath)\makecat.exe"</_MakeCatCommand> </PropertyGroup> diff --git a/PCbuild/python.props b/PCbuild/python.props index e6642fc..b13837d 100644 --- a/PCbuild/python.props +++ b/PCbuild/python.props @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> +<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> + <__Python_Props_Imported>true</__Python_Props_Imported> <Platform Condition="'$(Platform)' == ''">Win32</Platform> <Configuration Condition="'$(Configuration)' == ''">Release</Configuration> <!-- @@ -215,6 +216,7 @@ <Message Importance="high" Text="PythonVersionNumber: $(PythonVersionNumber)" /> <Message Importance="high" Text="PythonVersion: $(PythonVersion)" /> <Message Importance="high" Text="PythonVersionHex: 0x$([System.UInt32]::Parse($(PythonVersionHex)).ToString(`X08`))" /> + <Message Importance="high" Text="PythonVersionUnique: $(MajorVersionNumber).$(MinorVersionNumber).$(Field3Value)" /> <Message Importance="high" Text="Field3Value: $(Field3Value)" /> <Message Importance="high" Text="SysWinVer: $(SysWinVer)" /> <Message Importance="high" Text="PyDllName: $(PyDllName)" /> diff --git a/PCbuild/python.vcxproj b/PCbuild/python.vcxproj index bd05146..fdf8f12 100644 --- a/PCbuild/python.vcxproj +++ b/PCbuild/python.vcxproj @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="utf-8"?> +<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup Label="ProjectConfigurations"> <ProjectConfiguration Include="Debug|ARM"> @@ -82,6 +82,7 @@ <ImportGroup Label="PropertySheets"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="pyproject.props" /> + <Import Project="tcltk.props" /> </ImportGroup> <PropertyGroup Label="UserMacros" /> <PropertyGroup> @@ -144,4 +145,22 @@ $(_PGOPath) </PropertyGroup> <WriteLinesToFile File="$(PySourcePath)python.bat" Lines="$(_Content)" Overwrite="true" Condition="'$(_Content)' != '$(_ExistingContent)'" /> </Target> + <Target Name="GenerateLicense" AfterTargets="AfterBuild"> + <ItemGroup> + <LicenseFiles Include="$(PySourcePath)LICENSE; + $(PySourcePath)PC\crtlicense.txt; + $(bz2Dir)LICENSE; + $(opensslOutDir)LICENSE; + $(tcltkDir)tcllicense.terms; + $(tcltkDir)tklicense.terms; + $(tcltkDir)tixlicense.terms" /> + <_LicenseFiles Include="@(LicenseFiles)"> + <Content>$([System.IO.File]::ReadAllText(%(FullPath)))</Content> + </_LicenseFiles> + </ItemGroup> + + <WriteLinesToFile File="$(OutDir)LICENSE.txt" + Overwrite="true" + Lines="@(_LicenseFiles->'%(Content)')" /> + </Target> </Project> diff --git a/PCbuild/tcltk.props b/PCbuild/tcltk.props index b185cb7..7fcd3e1 100644 --- a/PCbuild/tcltk.props +++ b/PCbuild/tcltk.props @@ -1,6 +1,6 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <Import Project="pyproject.props" /> +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="pyproject.props" Condition="$(__PyProject_Props_Imported) != 'true'" /> <PropertyGroup> <TclMajorVersion>8</TclMajorVersion> <TclMinorVersion>6</TclMinorVersion> @@ -42,4 +42,19 @@ <BuildDirTop Condition="$(PlatformToolset) == 'v110'">$(BuildDirTop)_VC11</BuildDirTop> <BuildDirTop Condition="$(PlatformToolset) == 'v100'">$(BuildDirTop)_VC10</BuildDirTop> </PropertyGroup> + + <!-- + Helper target for copying the lib to a specific directory. + + Using "msbuild tcltk.props /t:CopyTclTkLib /p:OutDir=..." is generally + easier than trying to extract the value of $(tcltkdir). + --> + <Target Name="CopyTclTkLib"> + <ItemGroup> + <_TclTkLib Include="$(tcltkdir)\lib\**\*" /> + </ItemGroup> + <Copy SourceFiles="@(_TclTkLib)" + DestinationFiles="$(OutDir)\%(RecursiveDir)\%(Filename)%(Extension)" + UseHardlinksIfPossible="true" /> + </Target> </Project> |