| 1 |
<?xml version="1.0" encoding="utf-8"?> |
| 2 |
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
| 3 |
|
| 4 |
<Target Name="ProcessInstallFiles" |
| 5 |
AfterTargets="PrepareForBuild" |
| 6 |
DependsOnTargets="FindPythonForBuild" |
| 7 |
Condition="@(InstallFiles) != ''"> |
| 8 |
<PropertyGroup> |
| 9 |
<_FileListTarget>$(IntermediateOutputPath)$(MSBuildProjectName).g.csv</_FileListTarget> |
| 10 |
<_InstallFilesTarget>$(IntermediateOutputPath)$(MSBuildProjectName).g.wxs</_InstallFilesTarget> |
| 11 |
</PropertyGroup> |
| 12 |
|
| 13 |
<ItemGroup> |
| 14 |
<InstallFiles> |
| 15 |
<_Source>%(Source)$([msbuild]::MakeRelative(%(SourceBase), %(FullPath)))</_Source> |
| 16 |
<_Target>%(Target_)$([msbuild]::MakeRelative(%(TargetBase), %(FullPath)))</_Target> |
| 17 |
</InstallFiles> |
| 18 |
|
| 19 |
<_CatalogFiles Include="@(InstallFiles)" Condition="%(InstallFiles.IncludeInCat) and ''!=$([System.IO.File]::ReadAllText(%(InstallFiles.FullPath)))" /> |
| 20 |
</ItemGroup> |
| 21 |
|
| 22 |
<WriteLinesToFile File="$(_FileListTarget)" Lines="@(InstallFiles->'"%(_Source)","%(_Target)","%(Group)","%(DiskId)","%(Condition)"')" Overwrite="true" /> |
| 23 |
<Exec Command='$(PythonForBuild) csv_to_wxs.py "$(_FileListTarget)" "$(_InstallFilesTarget)"' |
| 24 |
WorkingDirectory="$(MSBuildThisFileDirectory)" /> |
| 25 |
|
| 26 |
<ItemGroup> |
| 27 |
<FileWrites Include="$(_FileListTarget);$(_InstallFilesTarget)" /> |
| 28 |
<Compile Include="$(_InstallFilesTarget)" /> |
| 29 |
</ItemGroup> |
| 30 |
</Target> |
| 31 |
|
| 32 |
<Target Name="GenerateCatalog" AfterTargets="ProcessInstallFiles" Condition="'@(_CatalogFiles)' != ''"> |
| 33 |
<PropertyGroup> |
| 34 |
<_CatFileSourceTarget>$(IntermediateOutputPath)$(MSBuildProjectName).cdf</_CatFileSourceTarget> |
| 35 |
<_CatFileTarget>$(IntermediateOutputPath)python_$(MSBuildProjectName).cat</_CatFileTarget> |
| 36 |
<_CatFile>[CatalogHeader] |
| 37 |
Name=$([System.IO.Path]::GetFileName($(_CatFileTarget))) |
| 38 |
ResultDir=$([System.IO.Path]::GetDirectoryName($(_CatFileTarget))) |
| 39 |
PublicVersion=1 |
| 40 |
CatalogVersion=2 |
| 41 |
HashAlgorithms=SHA256 |
| 42 |
PageHashes=false |
| 43 |
EncodingType= |
| 44 |
|
| 45 |
[CatalogFiles] |
| 46 |
@(_CatalogFiles->'<HASH>%(Filename)%(Extension)=%(FullPath)',' |
| 47 |
') |
| 48 |
</_CatFile> |
| 49 |
</PropertyGroup> |
| 50 |
|
| 51 |
<WriteLinesToFile File="$(_CatFileSourceTarget)" Lines="$(_CatFile)" Overwrite="true" /> |
| 52 |
<Exec Command='$(_MakeCatCommand) "$(_CatFileSourceTarget)"' WorkingDirectory="$(MSBuildThisFileDirectory)" /> |
| 53 |
<Exec Command='$(_SignCommand) "$(_CatFileTarget)" || $(_SignCommand) "$(_CatFileTarget)" || $(_SignCommand) "$(_CatFileTarget)"' WorkingDirectory="$(MSBuildThisFileDirectory)" |
| 54 |
Condition="Exists($(_CatFileTarget)) and '$(_SignCommand)' != ''" /> |
| 55 |
|
| 56 |
<ItemGroup> |
| 57 |
<FileWrites Include="$(_CatFileSourceTarget);$(_CatFileTarget)" /> |
| 58 |
</ItemGroup> |
| 59 |
</Target> |
| 60 |
|
| 61 |
<Target Name="_TransformWxlTemplates" AfterTargets="PrepareForBuild" Inputs="@(WxlTemplate);$(PySourcePath)include\patchlevel.h" Outputs="$(IntermediateOutputPath)%(Filename).wxl"> |
| 62 |
<PropertyGroup Condition="'@(WxlTemplate)' != ''"> |
| 63 |
<_Content>$([System.IO.File]::ReadAllText(%(WxlTemplate.FullPath)).Replace(`{{ShortVersion}}`, `$(MajorVersionNumber).$(MinorVersionNumber)$(PyTestExt)`).Replace(`{{LongVersion}}`, `$(PythonVersion)$(PyTestExt)`).Replace(`{{Bitness}}`, `$(Bitness)`))</_Content> |
| 64 |
<_ExistingContent Condition="Exists('$(IntermediateOutputPath)%(WxlTemplate.Filename).wxl')">$([System.IO.File]::ReadAllText($(IntermediateOutputPath)%(WxlTemplate.Filename).wxl))</_ExistingContent> |
| 65 |
</PropertyGroup> |
| 66 |
|
| 67 |
<WriteLinesToFile File="$(IntermediateOutputPath)%(WxlTemplate.Filename).wxl" |
| 68 |
Lines="$(_Content)" |
| 69 |
Overwrite="true" |
| 70 |
Condition="$(_Content) != $(_ExistingContent)" /> |
| 71 |
|
| 72 |
<ItemGroup Condition="'@(WxlTemplate)' != ''"> |
| 73 |
<EmbeddedResource Include="$(IntermediateOutputPath)%(WxlTemplate.Filename).wxl" /> |
| 74 |
<FileWrites Include="$(IntermediateOutputPath)%(WxlTemplate.Filename).wxl" /> |
| 75 |
</ItemGroup> |
| 76 |
</Target> |
| 77 |
|
| 78 |
<Import Project="$(WixTargetsPath)" /> |
| 79 |
|
| 80 |
<Target Name="SignCabs"> |
| 81 |
<Error Text="Unable to locate signtool.exe. Set /p:SignToolPath and rebuild" Condition="'$(_SignCommand)' == ''" /> |
| 82 |
<Exec Command="$(_SignCommand) @(SignCabs->'"%(FullPath)"',' ') || $(_SignCommand) @(SignCabs->'"%(FullPath)"',' ') || $(_SignCommand) @(SignCabs->'"%(FullPath)"',' ')" ContinueOnError="false" /> |
| 83 |
</Target> |
| 84 |
<Target Name="SignMsi"> |
| 85 |
<Error Text="Unable to locate signtool.exe. Set /p:SignToolPath and rebuild" Condition="'$(_SignCommand)' == ''" /> |
| 86 |
<Exec Command="$(_SignCommand) @(SignMsi->'"%(FullPath)"',' ') || $(_SignCommand) @(SignMsi->'"%(FullPath)"',' ') || $(_SignCommand) @(SignMsi->'"%(FullPath)"',' ')" ContinueOnError="false" /> |
| 87 |
</Target> |
| 88 |
<Target Name="SignBundleEngine"> |
| 89 |
<Error Text="Unable to locate signtool.exe. Set /p:SignToolPath and rebuild" Condition="'$(_SignCommand)' == ''" /> |
| 90 |
<Exec Command="$(_SignCommand) @(SignBundleEngine->'"%(FullPath)"',' ') || $(_SignCommand) @(SignBundleEngine->'"%(FullPath)"',' ') || $(_SignCommand) @(SignBundleEngine->'"%(FullPath)"',' ')" ContinueOnError="false" /> |
| 91 |
</Target> |
| 92 |
<Target Name="SignBundle"> |
| 93 |
<Error Text="Unable to locate signtool.exe. Set /p:SignToolPath and rebuild" Condition="'$(_SignCommand)' == ''" /> |
| 94 |
<Exec Command="$(_SignCommand) @(SignBundle->'"%(FullPath)"',' ') || $(_SignCommand) @(SignBundle->'"%(FullPath)"',' ') || $(_SignCommand) @(SignBundle->'"%(FullPath)"',' ')" ContinueOnError="false" /> |
| 95 |
</Target> |
| 96 |
</Project> |