blob: 9843bc97ccdc1e3fc41b57cc8f9e1dc9ddd0fc45 [file] [log] [blame]
Steve Dower33f73102016-06-24 10:32:15 -07001<?xml version="1.0" encoding="utf-8"?>
2<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 <PropertyGroup>
4 <ProjectGuid>{10487945-15D1-4092-A214-338395C4116B}</ProjectGuid>
5 <OutputName>python</OutputName>
6 <OutputName Condition="$(Platform) == 'x86'">$(OutputName)x86</OutputName>
Steve Dowerf0851912017-07-26 09:09:01 -07007 <OutputName Condition="$(BuildForDaily) == 'true'">$(OutputName)daily</OutputName>
Steve Dower33f73102016-06-24 10:32:15 -07008 <OutputSuffix></OutputSuffix>
9 <SupportSigning>false</SupportSigning>
Steve Dowere7614dd2016-06-25 16:13:30 -070010 <BuildForRelease Condition="$(BuildForRelease) == ''">true</BuildForRelease>
Steve Dower33f73102016-06-24 10:32:15 -070011 </PropertyGroup>
12
13 <Import Project="..\msi\msi.props" />
14
15 <PropertyGroup>
16 <Nuget Condition="$(Nuget) == ''">$(ExternalsDir)\windows-installer\nuget\nuget.exe</Nuget>
17 <NuspecVersion>$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)</NuspecVersion>
Steve Dower41fca9d2016-09-12 13:29:58 -070018 <NuspecVersion Condition="$(ReleaseLevelName) != ''">$(NuspecVersion)-$(ReleaseLevelName)</NuspecVersion>
Steve Dowerf0851912017-07-26 09:09:01 -070019 <NuspecVersion Condition="$(BuildForDaily) == 'true'">$(MajorVersionNumber).$(MinorVersionNumber).$(DailyBuildVersion)</NuspecVersion>
Steve Dower33f73102016-06-24 10:32:15 -070020 <SignOutput>false</SignOutput>
21 <TargetName>$(OutputName).$(NuspecVersion)</TargetName>
22 <TargetExt>.nupkg</TargetExt>
Victor Stinnercb0b78a2018-12-07 12:57:43 +010023 <IntermediateOutputPath>$(IntermediateOutputPath)\nuget_$(ArchName)</IntermediateOutputPath>
Steve Dower33f73102016-06-24 10:32:15 -070024
Victor Stinnercb0b78a2018-12-07 12:57:43 +010025 <CleanCommand>rmdir /q/s "$(IntermediateOutputPath)"</CleanCommand>
Steve Dower33f73102016-06-24 10:32:15 -070026
Victor Stinnercb0b78a2018-12-07 12:57:43 +010027 <PythonArguments>"$(PythonExe)" "$(MSBuildThisFileDirectory)\..\msi\make_zip.py"</PythonArguments>
28 <PythonArguments>$(PythonArguments) -t "$(IntermediateOutputPath)" -b "$(BuildPath.TrimEnd(`\`))"</PythonArguments>
Steve Dower33f73102016-06-24 10:32:15 -070029
Victor Stinnercb0b78a2018-12-07 12:57:43 +010030 <PipArguments>"$(IntermediateOutputPath)\python.exe" -B -c "import sys; sys.path.append(r'$(PySourcePath)\Lib'); import ensurepip; ensurepip._main()"</PipArguments>
31 <PackageArguments Condition="$(Packages) != ''">"$(IntermediateOutputPath)\python.exe" -B -m pip install -U $(Packages)</PackageArguments>
Steve Dower3f9fbfc2016-06-24 11:37:50 -070032
Victor Stinnercb0b78a2018-12-07 12:57:43 +010033 <NugetPackCommand>"$(Nuget)" pack "$(MSBuildThisFileDirectory)\$(OutputName).nuspec" -BasePath "$(IntermediateOutputPath)"</NugetPackCommand>
Steve Dowerf1ff2c42017-08-17 10:24:18 -070034 <NugetPackSymbolsCommand Condition="Exists('$(MSBuildThisFileDirectory)\$(OutputName).symbols.nuspec')">"$(Nuget)" pack "$(MSBuildThisFileDirectory)\$(OutputName).symbols.nuspec" -BasePath "$(BuildPath.TrimEnd(`\`))"</NugetPackSymbolsCommand>
Steve Dower33128c82016-06-27 09:34:18 -070035 <NugetArguments>$(NugetArguments) -OutputDirectory "$(OutputPath.Trim(`\`))"</NugetArguments>
Steve Dower33f73102016-06-24 10:32:15 -070036 <NugetArguments>$(NugetArguments) -Version "$(NuspecVersion)"</NugetArguments>
37 <NugetArguments>$(NugetArguments) -NoPackageAnalysis -NonInteractive</NugetArguments>
38
Victor Stinnercb0b78a2018-12-07 12:57:43 +010039 <Environment>set DOC_FILENAME=python$(PythonVersion).chm</Environment>
Steve Dowerf0851912017-07-26 09:09:01 -070040 <Environment>$(Environment)%0D%0Aset PYTHONPATH=$(PySourcePath)Lib</Environment>
Victor Stinnercb0b78a2018-12-07 12:57:43 +010041 <Environment Condition="Exists($(CRTRedist))">$(Environment)%0D%0Aset VCREDIST_PATH=$(CRTRedist)\$(Platform)</Environment>
Steve Dowerf0851912017-07-26 09:09:01 -070042 <Environment>$(Environment)%0D%0Amkdir "$(OutputPath.Trim(`\`))" &gt;nul 2&gt;nul</Environment>
Steve Dower33f73102016-06-24 10:32:15 -070043 </PropertyGroup>
44
45 <Target Name="_NugetMissing" BeforeTargets="_Build" Condition="!Exists($(Nuget))">
46 <Error Text="$(Nuget) could not be found. Either avoid specifying the property or update your externals/windows-installer files." />
47 </Target>
48
49 <Target Name="_Build">
Steve Dower3f9fbfc2016-06-24 11:37:50 -070050 <Exec Command="$(CleanCommand)" />
Victor Stinnercb0b78a2018-12-07 12:57:43 +010051 <Exec Command="setlocal%0D%0A$(Environment)%0D%0A$(PythonArguments)" />
52 <Exec Command="$(PipArguments)" />
53 <Exec Command="$(PackageArguments)" Condition="$(PackageArguments) != ''" />
54
55 <PropertyGroup>
56 <_PropsContents>$([System.IO.File]::ReadAllText('python.props'))</_PropsContents>
57 <_PropsContents>$(_PropsContents.Replace('$$PYTHON_TAG$$', '$(MajorVersionNumber).$(MinorVersionNumber)'))</_PropsContents>
58 <_PropsContents>$(_PropsContents.Replace('$$PYTHON_VERSION$$', '$(NuspecVersion)'))</_PropsContents>
59 <_PropsContents Condition="$(Platform) == 'x86'">$(_PropsContents.Replace('$$PYTHON_PLATFORM$$', 'Win32'))</_PropsContents>
60 <_PropsContents Condition="$(Platform) != 'x86'">$(_PropsContents.Replace('$$PYTHON_PLATFORM$$', '$(Platform)'))</_PropsContents>
61 <_PropsContents>$(_PropsContents.Replace('$$PYTHON_TARGET$$', '_GetPythonRuntimeFilesDependsOn$(MajorVersionNumber)$(MinorVersionNumber)_$(Platform)'))</_PropsContents>
62 <_ExistingContents Condition="Exists('$(IntermediateOutputPath)\python.props')">$([System.IO.File]::ReadAllText('$(IntermediateOutputPath)\python.props'))</_ExistingContents>
63 </PropertyGroup>
64 <WriteLinesToFile File="$(IntermediateOutputPath)\python.props"
65 Lines="$(_PropsContents)"
66 Condition="$(_PropsContents) != $(_ExistingContents)" />
Steve Dower1f06a682017-09-06 19:29:10 -070067
Steve Dowerf1ff2c42017-08-17 10:24:18 -070068 <Exec Command="$(NugetPackCommand) $(NugetArguments)" />
69 <Exec Command="$(NugetPackSymbolsCommand) $(NugetArguments)" Condition="$(NugetPackSymbolsCommand) != ''" />
Steve Dower33f73102016-06-24 10:32:15 -070070 </Target>
71
72 <Target Name="AfterBuild" />
73 <Target Name="Build" DependsOnTargets="_Build;AfterBuild" />
74</Project>