-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbuild.proj
200 lines (188 loc) · 10.3 KB
/
build.proj
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"
DefaultTargets="Pack">
<ItemGroup>
<ProjectItem Include="Source\PresentationTheme.Aero\PresentationTheme.Aero.csproj"/>
<ProjectItem Include="Source\PresentationTheme.Aero.Win8\PresentationTheme.Aero.Win8.csproj"/>
<ProjectItem Include="Source\PresentationTheme.Aero.Win10\PresentationTheme.Aero.Win10.csproj"/>
<ProjectItem Include="Source\PresentationTheme.AeroLite.Win8\PresentationTheme.AeroLite.Win8.csproj"/>
<ProjectItem Include="Source\PresentationTheme.AeroLite.Win10\PresentationTheme.AeroLite.Win10.csproj"/>
<ProjectItem Include="Source\PresentationTheme.HighContrast.Win8\PresentationTheme.HighContrast.Win8.csproj"/>
<ProjectItem Include="Source\PresentationTheme.HighContrast.Win10\PresentationTheme.HighContrast.Win10.csproj"/>
<PlatformProjectItem Include="Source\ThemeBrowser\ThemeBrowser.csproj"/>
<PlatformProjectItem Include="Source\ThemePreviewer\ThemePreviewer.csproj"/>
<NativeProjectItem Include="Source\UxThemeEx\UxThemeEx.vcxproj"/>
</ItemGroup>
<PropertyGroup>
<Configuration Condition="'$(Configuration)' == ''">Release</Configuration>
<OfficialBuildId Condition="'$(OfficialBuildId)' == '' AND '$(OfficialBuild)' == 'true'">$([System.DateTime]::UtcNow.ToString(`yyyyMMdd.HHmm`))</OfficialBuildId>
<Platform Condition="'$(Platform)' == ''">x64</Platform>
<BuildProperties>Configuration=$(Configuration);Platform=AnyCPU;OfficialBuildId=$(OfficialBuildId)</BuildProperties>
<PlatformBuildProperties>Configuration=$(Configuration);Platform=$(Platform);OfficialBuildId=$(OfficialBuildId)</PlatformBuildProperties>
<PackProperties>$(BuildProperties);IncludeSource=true</PackProperties>
<PackageDir>$(MSBuildThisFileDirectory)build\publish\</PackageDir>
<ToolsOutputPath>$(MSBuildThisFileDirectory)build\x64\bin\</ToolsOutputPath>
<GitHubPagesDir>Docs\_site\</GitHubPagesDir>
</PropertyGroup>
<Import Project="Eng\ProjectInfo.props"/>
<Import Project="Eng\Common\Common.props"/>
<Import Project="Eng\Common\RepoLayout.props"/>
<Import Project="Eng\Common\ProjectLayout.props"/>
<Import Project="Eng\Common\GenerateVersionInfo.targets"/>
<Import Project="$(MSBuildThisFileDirectory)Tools\MSBuildTasks.1.5.0.235\MSBuild.Community.Tasks.Targets"/>
<UsingTask TaskName="ConcatFiles" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<OutputFilename ParameterType="System.String" Required="true"/>
<Files ParameterType="Microsoft.Build.Framework.ITaskItem[]" Required="true"/>
<Separator ParameterType="System.Boolean" Required="false"/>
</ParameterGroup>
<Task>
<Code Type="Fragment" Language="cs">
<![CDATA[
try {
var sepString = new string('-', 80);
var trimChars = new char[] { ' ', '\r', '\n', '\t' };
const string LF = "\n";
const string CRLF = "\r\n";
string outputFile = Path.GetFullPath(OutputFilename);
Directory.CreateDirectory(Path.GetDirectoryName(outputFile));
using (var output = new FileStream(outputFile, FileMode.Create, FileAccess.Write))
using (var writer = new StreamWriter(output)) {
int idx = 0;
foreach (ITaskItem fileItem in Files) {
if (idx++ != 0 && Separator) {
writer.Write(LF);
writer.Write(sepString);
writer.Write(LF);
writer.Write(LF);
}
string text = File.ReadAllText(fileItem.ItemSpec);
writer.Write(text.Trim(trimChars).Replace(CRLF, LF));
writer.Write(LF);
}
}
return true;
} catch (Exception ex) {
Log.LogErrorFromException(ex);
return false;
}
]]>
</Code>
</Task>
</UsingTask>
<Target Name="Clean" Condition="'$(Clean)'!='false'">
<ItemGroup>
<_Dir Include="build\any"/>
<_Dir Include="build\x64"/>
<_Dir Include="build\x86"/>
</ItemGroup>
<MSBuild Projects="@(ProjectItem)"
Properties="$(BuildProperties)"
Targets="Clean"
BuildInParallel="true"
StopOnFirstFailure="true"/>
<MSBuild Projects="@(PlatformProjectItem)"
Properties="$(PlatformBuildProperties)"
Targets="Clean"
BuildInParallel="true"
StopOnFirstFailure="true"/>
<MSBuild Projects="@(NativeProjectItem)"
Properties="$(PlatformBuildProperties)"
Targets="Clean"
BuildInParallel="true"
StopOnFirstFailure="true"/>
<RemoveDir Directories="@(_Dir)" ContinueOnError="WarnAndContinue"/>
<RemoveDir Directories="@(_Dir)"/>
</Target>
<Target Name="Restore" Condition="'$(Restore)'!='false'">
<!-- Parallel restore is not threadsafe and cannot be used reliably for CI
builds. See https://github.com/NuGet/Home/issues/7648 -->
<MSBuild Projects="@(ProjectItem)"
Properties="$(BuildProperties)"
Targets="Restore"
BuildInParallel="false"
StopOnFirstFailure="true"/>
<MSBuild Projects="@(PlatformProjectItem)"
Properties="$(PlatformBuildProperties)"
Targets="Restore"
BuildInParallel="false"
StopOnFirstFailure="true"/>
<Exec Command="nuget restore -PackagesDirectory "$(MSBuildThisFileDirectory)Source\packages" "@(NativeProjectItem)""/>
</Target>
<Target Name="Build" DependsOnTargets="Restore" Condition="'$(Build)'!='false'">
<!--
Force re-evaluation of any native project by passing in a different set of
global properties. A dummy property is enough. This is necessary since the
project might have been loaded before restoring its NuGet packages. The
seemingly useful MSBuild task property 'UnloadProjectsOnCompletion' cannot
be used since it does not do anything.
-->
<MSBuild Projects="@(NativeProjectItem)"
Properties="$(PlatformBuildProperties);Dummy=ForceReload"
BuildInParallel="true"
StopOnFirstFailure="true"/>
<MSBuild Projects="@(ProjectItem)"
Properties="$(BuildProperties);Dummy=ForceReload"
BuildInParallel="true"
StopOnFirstFailure="true"/>
<MSBuild Projects="@(PlatformProjectItem)"
Properties="$(PlatformBuildProperties);Dummy=ForceReload"
BuildInParallel="true"
StopOnFirstFailure="true"/>
</Target>
<Target Name="Pack" DependsOnTargets="Build;InitializeSourceControlInformation" Condition="'$(Pack)'!='false'">
<Error Condition="'$(SourceRevisionId)' == ''" Text="SourceRevisionId is empty."/>
<PropertyGroup>
<PackArgs>-Version "$(Version)" -Symbols -SymbolPackageFormat snupkg</PackArgs>
<PackArgs>$(PackArgs) -NoPackageAnalysis -OutputDirectory "$(PackageDir)\"</PackArgs>
<PackArgs>$(PackArgs) -Properties "SourceRevisionId=$(SourceRevisionId)"</PackArgs>
</PropertyGroup>
<MakeDir Directories="$(PackageDir)"/>
<Exec Command="nuget.exe pack $(PackArgs) Source\PresentationTheme.Aero.nuspec"/>
</Target>
<Target Name="BuildDocs">
<Exec Command="docfx.exe Docs/docfx.json -f"/>
</Target>
<Target Name="UpdateDocs" DependsOnTargets="BuildDocs">
<Exec WorkingDirectory="$(GitHubPagesDir)" Command="git add ."/>
<Exec WorkingDirectory="$(GitHubPagesDir)" Command="git commit -m "Update gh-pages""/>
</Target>
<Target Name="PrepareToolsLicense">
<ItemGroup>
<LicenseFile Include="LICENSE.txt"/>
<LicenseFile Include="ThirdParty\EasyHook\LICENSE.txt"/>
</ItemGroup>
<ConcatFiles OutputFilename="$(ToolsOutputPath)LICENSE.txt" Files="@(LicenseFile)" Separator="true"/>
</Target>
<Target Name="PackTools" DependsOnTargets="PrepareToolsLicense;Build">
<ItemGroup>
<ToolItem Include="$(ToolsOutputPath)ThemeBrowser\netcoreapp3.0\ThemeBrowser.dll"/>
<ToolItem Include="$(ToolsOutputPath)ThemeBrowser\netcoreapp3.0\ThemeBrowser.exe"/>
<ToolItem Include="$(ToolsOutputPath)ThemeBrowser\netcoreapp3.0\ThemeBrowser.pdb"/>
<ToolItem Include="$(ToolsOutputPath)ThemeBrowser\netcoreapp3.0\ThemeBrowser.runtimeconfig.json"/>
<ToolItem Include="$(ToolsOutputPath)ThemePreviewer\netcoreapp3.0\PresentationTheme.Aero.dll"/>
<ToolItem Include="$(ToolsOutputPath)ThemePreviewer\netcoreapp3.0\PresentationTheme.Aero.Win8.dll"/>
<ToolItem Include="$(ToolsOutputPath)ThemePreviewer\netcoreapp3.0\PresentationTheme.Aero.Win10.dll"/>
<ToolItem Include="$(ToolsOutputPath)ThemePreviewer\netcoreapp3.0\PresentationTheme.AeroLite.Win8.dll"/>
<ToolItem Include="$(ToolsOutputPath)ThemePreviewer\netcoreapp3.0\PresentationTheme.AeroLite.Win10.dll"/>
<ToolItem Include="$(ToolsOutputPath)ThemePreviewer\netcoreapp3.0\PresentationTheme.HighContrast.Win8.dll"/>
<ToolItem Include="$(ToolsOutputPath)ThemePreviewer\netcoreapp3.0\PresentationTheme.HighContrast.Win10.dll"/>
<ToolItem Include="$(ToolsOutputPath)ThemePreviewer\netcoreapp3.0\Microsoft.Xaml.Behaviors.dll"/>
<ToolItem Include="$(ToolsOutputPath)ThemePreviewer\netcoreapp3.0\ThemeCore.dll"/>
<ToolItem Include="$(ToolsOutputPath)ThemePreviewer\netcoreapp3.0\ThemeCore.pdb"/>
<ToolItem Include="$(ToolsOutputPath)ThemePreviewer\netcoreapp3.0\ThemePreviewer.dll"/>
<ToolItem Include="$(ToolsOutputPath)ThemePreviewer\netcoreapp3.0\ThemePreviewer.exe"/>
<ToolItem Include="$(ToolsOutputPath)ThemePreviewer\netcoreapp3.0\ThemePreviewer.pdb"/>
<ToolItem Include="$(ToolsOutputPath)ThemePreviewer\netcoreapp3.0\ThemePreviewer.runtimeconfig.json"/>
<ToolItem Include="$(ToolsOutputPath)UxThemeEx\EasyHook64.dll"/>
<ToolItem Include="$(ToolsOutputPath)UxThemeEx\UxThemeEx.dll"/>
<ToolItem Include="$(ToolsOutputPath)UxThemeEx\UxThemeEx.pdb"/>
<ToolItem Include="$(ToolsOutputPath)LICENSE.txt"/>
</ItemGroup>
<Error Condition="!Exists(@(ToolItem))" Text="Missing file: %(ToolItem.Identity)"/>
<Zip ZipFileName="$(PackageDir)ThemeTools-$(Version).zip"
WorkingDirectory="$(ToolsOutputPath)"
Files="@(ToolItem)"
Flatten="true"/>
</Target>
</Project>