forked from wixtoolset/wix3
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathWixBuild.zipproj.targets
93 lines (78 loc) · 3.33 KB
/
WixBuild.zipproj.targets
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?xml version="1.0" encoding="utf-8" ?>
<!--
<copyright file="WixBuild.zipproj.targets" company="Outercurve Foundation">
Copyright (c) 2004, Outercurve Foundation.
This software is released under Microsoft Reciprocal License (MS-RL).
The license and further copyright text can be found in the file
LICENSE.TXT at the root directory of the distribution.
</copyright>
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask AssemblyFile="$(ExtensionPackPath)MSBuild.ExtensionPack.dll" TaskName="Zip" />
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildProjectFullPath)</MSBuildAllProjects>
<ZipName Condition=" '$(ZipName)'=='' ">$(OutputName)</ZipName>
<ZipRootPath Condition=" '$(ZipRootPath)'=='' ">$(MSBuildProjectDirectory)</ZipRootPath>
<TargetPath>$(OutputPath)$(ZipOutputSubDirectory)$(ZipName).zip</TargetPath>
</PropertyGroup>
<!--
================================================================================================
Stage
Stages items then creates the .zip files.
[IN]
@(Stage) - Items to stage.
[OUT]
@(Zip) - The items to zip.
================================================================================================
-->
<ItemDefinitionGroup>
<Stage>
<Hardlink>true</Hardlink>
</Stage>
</ItemDefinitionGroup>
<Target Name="Stage"
DependsOnTargets="_PrepareStageItems"
Inputs="@(_Stage)"
Outputs="$(TargetPath)"
Condition=" '@(Stage)'!='' ">
<Error Text="A .zipproj cannot have both Stage and Zip items. Remove one of the item types and rebuild." Condition=" '@(Zip)'!='' " />
<Message Importance="low" Text="Stage = %(_Stage.Identity) -> %(_Stage.TargetPath)"/>
<Copy SourceFiles="@(_Stage)" DestinationFiles="%(_Stage.TargetPath)"
SkipUnchangedFiles="true" UseHardlinksIfPossible="%(_Stage.Hardlink)">
<Output TaskParameter="CopiedFiles" ItemName="Zip"/>
<Output TaskParameter="CopiedFiles" ItemName="FileWrites"/>
</Copy>
<PropertyGroup>
<ZipRootPath>$(IntermediateOutputPath)</ZipRootPath>
</PropertyGroup>
</Target>
<Target Name="_PrepareStageItems"
Condition=" '@(Stage)'!='' ">
<ItemGroup>
<_Stage Include="@(Stage)" Condition=" '%(Stage.StageSubDirectory)'!='' ">
<TargetPath>$(IntermediateOutputPath)%(Stage.StageSubDirectory)\%(Stage.Filename)%(Stage.Extension)</TargetPath>
<Hardlink>%(Stage.Hardlink)</Hardlink>
</_Stage>
<_Stage Include="@(Stage)" Condition=" '%(Stage.StageSubDirectory)'=='' ">
<TargetPath>$(IntermediateOutputPath)%(Stage.Filename)%(Stage.Extension)</TargetPath>
<Hardlink>%(Stage.Hardlink)</Hardlink>
</_Stage>
</ItemGroup>
</Target>
<Target Name="Zip"
Inputs="@(Zip)"
Outputs="$(TargetPath)">
<Message Importance="low" Text="(before) ZipRoot = $(ZipRootPath), Zip = @(Zip)" />
<Zip TaskAction="Create"
CompressFiles="@(Zip)"
RemoveRoot="$(ZipRootPath)"
ZipFileName="$(TargetPath)" />
<ItemGroup>
<FileWrites Include="$(TargetPath)" />
</ItemGroup>
</Target>
<Target Name="Build"
DependsOnTargets="Stage;Zip"
Inputs="$(MSBuildAllProjects);$(MSBuildProjectFullPath);@(Stage);@(Zip)"
Outputs="$(TargetPath)" />
</Project>