forked from cyotek/HTML-Renderer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.xml
More file actions
129 lines (101 loc) · 6.53 KB
/
Copy pathbuild.xml
File metadata and controls
129 lines (101 loc) · 6.53 KB
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
<Project DefaultTargets="run" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<verbose>Minimal</verbose>
<OutputRoot>Release</OutputRoot>
<OutputSourceRoot>$(OutputRoot)\Source</OutputSourceRoot>
<OutputBinRoot>$(OutputRoot)\Bins</OutputBinRoot>
<SourceRoot>..\Source</SourceRoot>
<LibRoot>$(SourceRoot)\HtmlRenderer</LibRoot>
<DemoRoot>$(SourceRoot)\Demo</DemoRoot>
<BuildWarn>WarningLevel=0</BuildWarn>
<Build20>TargetFrameworkVersion=v2.0</Build20>
<Build35>TargetFrameworkVersion=v3.5;TargetFrameworkProfile=client</Build35>
<Build40>TargetFrameworkVersion=v4.0;TargetFrameworkProfile=client</Build40>
<Build45>TargetFrameworkVersion=v4.5</Build45>
<BuildProperties>Configuration=Release</BuildProperties>
<BuildOutputPath>OutputPath=..\..\Build\$(OutputBinRoot)</BuildOutputPath>
<DemoBuildOutputPath>OutputPath=..\..\Build\$(OutputRoot)</DemoBuildOutputPath>
</PropertyGroup>
<!--Execute all steps of the build-->
<Target Name="Run">
<Message Importance="high" Text="====================== Clean build output..."/>
<RemoveDir Directories="$(OutputRoot)" ContinueOnError="true"/>
<RemoveDir Directories="$(OutputRoot)" ContinueOnError="true"/>
<RemoveDir Directories="$(OutputRoot)" ContinueOnError="true"/>
<RemoveDir Directories="$(OutputRoot)"/>
<Message Importance="high" Text="====================== Build demo..."/>
<CallTarget Targets="BuildDemo"/>
<Message Importance="high" Text="====================== Build libraries..."/>
<CallTarget Targets="BuildLibrary"/>
<Message Importance="high" Text="====================== Get current version..."/>
<GetAssemblyIdentity AssemblyFiles="$(OutputBinRoot)\NET20\HtmlRenderer.dll">
<Output TaskParameter="Assemblies" ItemName="AsmInfo" />
</GetAssemblyIdentity>
<Message Importance="high" Text="====================== Build demo..."/>
<CallTarget Targets="BuildDemo" />
<Message Importance="high" Text="====================== Copy source..."/>
<CallTarget Targets="CopySource"/>
<Message Importance="high" Text="====================== Create archive..."/>
<MSBuild Projects="build.xml" Targets="CreateArchive" Properties="Version=%(AsmInfo.Version)"/>
<Message Importance="high" Text="====================== Create NuGet package..."/>
<MSBuild Projects="build.xml" Targets="CreatePackage" Properties="Version=%(AsmInfo.Version)"/>
<Message Importance="high" Text="====================== Validating build..."/>
<Error Condition="!Exists('$(OutputBinRoot)\NET20\HtmlRenderer.dll')" Text="Validation failed (.NET 2.0)!" />
<Error Condition="!Exists('$(OutputBinRoot)\NET35\HtmlRenderer.dll')" Text="Validation failed (.NET 3.5)!" />
<Error Condition="!Exists('$(OutputBinRoot)\NET40\HtmlRenderer.dll')" Text="Validation failed (.NET 4.0)!" />
<Error Condition="!Exists('$(OutputBinRoot)\NET45\HtmlRenderer.dll')" Text="Validation failed (.NET 4.5)!" />
<Error Condition="!Exists('$(OutputSourceRoot)\HtmlRenderer.sln')" Text="Validation failed (Source)!" />
<Error Condition="!Exists('$(OutputRoot)\HtmlRendererDemo.WinForms.exe')" Text="Validation failed (Demo)!" />
<Error Condition="!Exists('$(OutputRoot)\HtmlRenderer %(AsmInfo.Version).zip')" Text="Validation failed (zip)!" />
<Message Importance="high" Text="====================== SUCCESS!"/>
</Target>
<!--Build all the multi-target dlls of the library-->
<Target Name="BuildLibrary">
<Message Importance="high" Text="====================== Build .NET 2.0..."/>
<MSBuild Properties="$(BuildProperties);$(BuildOutputPath)\NET20;$(BuildWarn);$(Build20)" UseResultsCache="true" Targets="Rebuild" Projects="$(LibRoot)\HtmlRenderer.csproj" />
<Message Importance="high" Text="====================== Build .NET 3.5..."/>
<MSBuild Properties="$(BuildProperties);$(BuildOutputPath)\NET35;$(BuildWarn);$(Build35)" Targets="Rebuild" Projects="$(LibRoot)\HtmlRenderer.csproj" />
<Message Importance="high" Text="====================== Build .NET 4.0..."/>
<MSBuild Properties="$(BuildProperties);$(BuildOutputPath)\NET40;$(BuildWarn);$(Build40)" Targets="Rebuild" Projects="$(LibRoot)\HtmlRenderer.csproj" />
<Message Importance="high" Text="====================== Build .NET 4.5..."/>
<MSBuild Properties="$(BuildProperties);$(BuildOutputPath)\NET45;$(BuildWarn);$(Build45)" Targets="Rebuild" Projects="$(LibRoot)\HtmlRenderer.csproj" />
</Target>
<!--Get current version-->
<Target Name="GetVersion">
<GetAssemblyIdentity AssemblyFiles="$(OutputBinRoot)\NET20\HtmlRenderer.dll">
<Output TaskParameter="Assemblies" ItemName="AsmInfo" />
</GetAssemblyIdentity>
<CreateProperty Value="%(AsmInfo.Version)">
<Output TaskParameter="Value" PropertyName="Version"/>
</CreateProperty>
</Target>
<!--Build the demo application, merge to single exe and delete the rest of the files-->
<Target Name="BuildDemo">
<MSBuild Properties="$(BuildProperties);$(DemoBuildOutputPath);$(BuildWarn)" UseResultsCache="true" Targets="Rebuild" Projects="$(DemoRoot)\HtmlRenderer.Demo.csproj" />
<GetAssemblyIdentity AssemblyFiles="$(OutputRoot)\HtmlRenderer.dll">
<Output TaskParameter="Assemblies" ItemName="AsmInfo" />
</GetAssemblyIdentity>
<Exec Command="ILMerge.exe $(OutputRoot)\HtmlRendererDemo.exe $(OutputRoot)\HtmlRenderer.dll /out:$(OutputRoot)\HtmlRendererDemo.WinForms.exe /ver:%(AsmInfo.Version)" />
<ItemGroup>
<files Include="$(OutputRoot)\*.*" Exclude="$(OutputRoot)\HtmlRendererDemo.WinForms.exe"/>
</ItemGroup>
<Delete Files="@(files)"/>
</Target>
<!--Copy all the source and remove the bin and obj folders-->
<Target Name="CopySource">
<ItemGroup>
<Source Include="$(SourceRoot)\**\*.*" />
</ItemGroup>
<Copy SourceFiles="@(Source)" DestinationFolder="$(OutputSourceRoot)\%(RecursiveDir)"/>
<RemoveDir Directories="$(OutputSourceRoot)\Demo\bin;$(OutputSourceRoot)\Demo\obj;$(OutputSourceRoot)\HtmlRenderer\bin;$(OutputSourceRoot)\HtmlRenderer\obj"/>
</Target>
<!--Create zip archive for the bins, source and demo-->
<Target Name="CreateArchive">
<Exec Command="..\7za.exe a "HtmlRenderer $(Version).zip" **" WorkingDirectory="$(OutputRoot)" />
</Target>
<!--Create NuGet package-->
<Target Name="CreatePackage">
<Copy SourceFiles="readme.txt" DestinationFolder="$(OutputRoot)"/>
<Exec Command="nuget.exe pack HtmlRenderer.WinForms.nuspec -Version $(Version) -OutputDirectory $(OutputRoot)" />
</Target>
</Project>