1<?xml version="1.0" encoding="utf-8"?>
2<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" TreatAsLocalProperty="DownloadUrl">
3    <PropertyGroup>
4        <SchemaVersion>2.0</SchemaVersion>
5        <OutputType>Bundle</OutputType>
6
7        <BootstrapConfiguration Condition="'$(BootstrapConfiguration)' == ''">Release</BootstrapConfiguration>
8        <LinkerSuppressSpecificWarnings>1132;1135;1140</LinkerSuppressSpecificWarnings>
9        <OutputName Condition="$(BuildForRelease)">$(OutputName)-$(PythonVersion)</OutputName>
10        <OutputName Condition="!$(BuildForRelease)">$(OutputName)-$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber).$(RevisionNumber)</OutputName>
11        <OutputName Condition="$(Platform) == 'x64'">$(OutputName)-amd64</OutputName>
12        <OutputName Condition="$(Platform) == 'ARM64'">$(OutputName)-arm64</OutputName>
13        <OutputName Condition="'$(OutputSuffix)' != ''">$(OutputName)-$(OutputSuffix)</OutputName>
14        <OutputName Condition="'$(Configuration)' == 'Debug'">$(OutputName)-d</OutputName>
15        <TargetName>$(OutputName)</TargetName>
16
17        <OutputPath>$(OutputPath)en-us\</OutputPath>
18        <OutDir>$(OutputPath)</OutDir>
19
20        <!-- See Tools/msi/buildrelease.bat for help on configuring the download URL -->
21        <DownloadUrl Condition="'$(DownloadUrl)' == '' and '$(DownloadUrlBase)' != ''">$(DownloadUrlBase.TrimEnd(`/`))/{version}/{arch}{releasename}/{msi}</DownloadUrl>
22        <DefineConstants Condition="'$(DownloadUrl)' != ''">$(DefineConstants);DownloadUrl=$(DownloadUrl.Replace(`{version}`, `$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)`).Replace(`{arch}`, `$(ArchName)`).Replace(`{releasename}`, `$(ReleaseLevelName)`).Replace(`{msi}`, `{2}`))</DefineConstants>
23        <DefineConstants Condition="'$(DownloadUrl)' == ''">$(DefineConstants);DownloadUrl={2}</DefineConstants>
24    </PropertyGroup>
25
26    <ItemGroup>
27        <WixExtension Include="WixUtilExtension">
28            <HintPath>WixUtilExtension</HintPath>
29            <Name>WixUtilExtension</Name>
30        </WixExtension>
31        <WixExtension Include="WixDependencyExtension">
32            <HintPath>WixDependencyExtension</HintPath>
33            <Name>WixDependencyExtension</Name>
34        </WixExtension>
35        <WixExtension Include="WixBalExtension">
36            <HintPath>WixBalExtension</HintPath>
37            <Name>WixBalExtension</Name>
38        </WixExtension>
39    </ItemGroup>
40    <ItemGroup>
41        <Compile Include="bundle.wxs" />
42        <Compile Include="packagegroups\*.wxs" />
43    </ItemGroup>
44    <ItemGroup>
45        <Content Include="Default.thm" />
46        <Content Include="SideBar.png" />
47    </ItemGroup>
48    <ItemGroup>
49        <EmbeddedResource Include="bundle.wxl" />
50        <WxlTemplate Include="*_en-US.wxl_template" />
51    </ItemGroup>
52    <ItemGroup>
53        <LinkerBindInputPaths Include="$(OutputPath)">
54            <BindName></BindName>
55        </LinkerBindInputPaths>
56    </ItemGroup>
57
58    <ItemDefinitionGroup>
59        <Package>
60            <Properties>BuildForRelease=$(BuildForRelease)</Properties>
61        </Package>
62    </ItemDefinitionGroup>
63    <ItemGroup>
64        <Package Include="..\core\core*.wixproj" />
65        <Package Include="..\dev\dev*.wixproj" />
66        <Package Include="..\doc\doc*.wixproj" />
67        <Package Include="..\exe\exe*.wixproj" />
68        <Package Include="..\lib\lib*.wixproj" />
69        <Package Include="..\path\path*.wixproj" />
70        <Package Include="..\appendpath\appendpath*.wixproj" />
71        <Package Include="..\pip\pip*.wixproj" />
72        <Package Include="..\tcltk\tcltk*.wixproj" />
73        <Package Include="..\test\test*.wixproj" />
74        <Package Include="..\tools\tools*.wixproj" />
75        <Package Include="..\ucrt\ucrt*.wixproj" Condition="$(Platform) != 'ARM64'" />
76    </ItemGroup>
77
78    <PropertyGroup>
79        <BuildPackagesTargets>Build</BuildPackagesTargets>
80    </PropertyGroup>
81
82    <Target Name="_SetRebuildTarget" BeforeTargets="BeforeRebuild">
83        <PropertyGroup>
84            <BuildPackagesTargets>Rebuild</BuildPackagesTargets>
85        </PropertyGroup>
86    </Target>
87
88    <Target Name="BuildPackages" BeforeTargets="BeforeBuild" Condition="'$(RebuildAll)' != 'false'">
89        <MSBuild Projects="@(Package)" Targets="$(BuildPackagesTargets)" BuildInParallel="true" />
90    </Target>
91
92    <Target Name="BuildBootstrapApplication" BeforeTargets="BeforeBuild">
93        <Message Text="Building bootstrap app" Importance="high" />
94
95        <MSBuild Projects="bootstrap\pythonba.vcxproj"
96                 Targets="Build;GetNativeTargetPath"
97                 UseResultsCache="true"
98                 Properties="Configuration=$(BootstrapConfiguration);Platform=Win32;BuildForPlatform=$(Platform)">
99            <Output TaskParameter="TargetOutputs" PropertyName="BootstrapAppPath" />
100        </MSBuild>
101
102        <PropertyGroup>
103            <DefineConstants>$(DefineConstants);BootstrapApp=$(BootstrapAppPath)</DefineConstants>
104        </PropertyGroup>
105    </Target>
106
107    <Target Name="AddDefaultWxl" AfterTargets="PrepareForBuild" Condition="!Exists('Default.$(Platform).xsl')">
108        <ItemGroup>
109            <EmbeddedResource Include="Default.wxl" />
110        </ItemGroup>
111        <PropertyGroup>
112            <DefineConstants>$(DefineConstants);DefaultWxl=Default.wxl</DefineConstants>
113        </PropertyGroup>
114    </Target>
115    <Target Name="AddUpdatedDefaultWxl" AfterTargets="PrepareForBuild" Condition="Exists('Default.$(Platform).xsl')">
116        <XslTransformation XmlInputPaths="Default.wxl"
117                           OutputPaths="$(IntermediateOutputPath)Default.wxl"
118                           XslInputPath="Default.$(Platform).xsl"
119                           UseTrustedSettings="true" />
120        <ItemGroup>
121          <EmbeddedResource Include="$(IntermediateOutputPath)Default.wxl" />
122        </ItemGroup>
123        <PropertyGroup>
124            <DefineConstants>$(DefineConstants);DefaultWxl=$(IntermediateOutputPath)Default.wxl</DefineConstants>
125        </PropertyGroup>
126    </Target>
127
128    <Import Project="..\msi.targets" />
129</Project>
130