forked from sayedihashimi/slow-cheetah
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.proj
164 lines (144 loc) · 6.73 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
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="FullBuild">
<PropertyGroup>
<SourceRoot Condition=" '$(SourceRoot)'=='' ">$(MSBuildProjectDirectory)\</SourceRoot>
<OutputRootNoTrailingSlash Condition=" '$(OutputRoot)'=='' ">$(SourceRoot)BuildOutput</OutputRootNoTrailingSlash>
<OutputRoot Condition=" '$(OutputRoot)'=='' ">$(OutputRootNoTrailingSlash)\</OutputRoot>
<PackageRoot Condition=" '$(PackageRoot)'=='' ">$(OutputRoot)Nugetpkg\</PackageRoot>
<NugetExe Condition=" '$(NugetExe)'=='' ">$(SourceRoot)Contrib\NuGet.exe</NugetExe>
<NugetLocalRepo Condition=" '$(NugetLocalRepo)'=='' ">C:\Temp\Nuget\LocalRepo\</NugetLocalRepo>
<!--<PublishPs1 Condition=" '$(PublishPs1)'=='' ">$(SourceRoot)Powershell\Publish-Interactive.ps1</PublishPs1>
<PackageDirectory Condition=" '$(PackageDirectory)'=='' ">_Package</PackageDirectory>-->
<NuGetSrc Condition=" '$(NuGetSrc)'=='' ">$(SourceRoot)NuGet\</NuGetSrc>
<NuGetOutputRootNoTrailingSlash Condition=" '$(NuGetOutputRootNoTrailingSlash)'=='' ">$(OutputRoot)NuGet</NuGetOutputRootNoTrailingSlash>
<NuGetOutputRoot Condition=" '$(NuGetOutputRoot)'=='' ">$(NuGetOutputRootNoTrailingSlash)\</NuGetOutputRoot>
<NuGetLocalRepoFolder Condition=" '$(NuGetLocalRepoFolder)'=='' ">C:\Temp\Nuget\LocalRepo\</NuGetLocalRepoFolder>
<EnableCopyToLocalRepo Condition=" '$(EnableCopyToLocalRepo)'=='' ">true</EnableCopyToLocalRepo>
</PropertyGroup>
<ItemGroup>
<ProjectsToBuild Include="$(SourceRoot)SlowCheetah.sln"/>
<NuGetPackages Include="SlowCheetah">
<SourceFolder>$(SourceRoot)NuGet\</SourceFolder>
<DestFolder>$(NuGetOutputRoot)</DestFolder>
<NuSpec>$(NuGetOutputRoot)SlowCheetah.nuspec</NuSpec>
</NuGetPackages>
</ItemGroup>
<PropertyGroup>
<Configuration Condition=" '$(Configuration)'=='' ">Release</Configuration>
</PropertyGroup>
<PropertyGroup>
<FullBuildDependsOn>
$(FullBuildDependsOn);
Build;
BuildNuGetPackages;
</FullBuildDependsOn>
</PropertyGroup>
<Target Name="FullBuild" DependsOnTargets="$(FullBuildDependsOn)"/>
<PropertyGroup>
<RebuildDependsOn>
$(RebuildDependsOn);
Clean;
FullBuild;
</RebuildDependsOn>
</PropertyGroup>
<Target Name="Rebuild" DependsOnTargets="$(RebuildDependsOn)"/>
<!-- ***************************************************************************************
Begin build targets
*************************************************************************************** -->
<PropertyGroup>
<BuildDependsOn>
$(BuildDependsOn);
Clean;
PrepareForBuild;
CoreBuild
</BuildDependsOn>
</PropertyGroup>
<Target Name="Build" DependsOnTargets="$(BuildDependsOn)"/>
<Target Name="CoreBuild">
<MSBuild Projects="@(ProjectsToBuild)"
Properties="Configuration=$(Configuration);OutputPath=$(OutputRoot);RestorePackages=true" />
</Target>
<Target Name="PrepareForBuild">
<MakeDir Directories="$(OutputRoot)"/>
</Target>
<PropertyGroup>
<CleanDependsOn>
$(CleanDependsOn);
CoreClean;
</CleanDependsOn>
</PropertyGroup>
<Target Name="Clean" DependsOnTargets="$(CleanDependsOn)"/>
<Target Name="CoreClean">
<!-- Just delete the BuildOutput folder -->
<ItemGroup>
<_FilesToDelete Remove="@(_FilesToDelete)"/>
<_FilesToDelete Include="$(OutputRoot)**\*"/>
</ItemGroup>
<Delete Files="@(_FilesToDelete)"/>
</Target>
<!-- ***************************************************************************************
Begin NuGet targets
*************************************************************************************** -->
<PropertyGroup>
<BuildNuGetPackagesDependsOn>
$(BuildNuGetPackagesDependsOn);
Build;
CoreBuildNuGetPackages;
CopyNugetPackagesToLocalRepo;
</BuildNuGetPackagesDependsOn>
</PropertyGroup>
<Target Name="BuildNuGetPackages" DependsOnTargets="$(BuildNuGetPackagesDependsOn)" />
<PropertyGroup>
<CoreBuildNuGetPackagesDependsOn>
CopyNuGetSourceFilesToOutput;
$(CoreBuildNuGetPackagesDependsOn);
</CoreBuildNuGetPackagesDependsOn>
</PropertyGroup>
<Target Name="CoreBuildNuGetPackages"
Outputs="%(NuGetPackages.Identity)"
DependsOnTargets="$(CoreBuildNuGetPackagesDependsOn)" >
<PropertyGroup>
<_dest>%(NuGetPackages.DestFolder)</_dest>
<_NuSpecFullPath>$([System.IO.Path]::GetFullPath(%(NuGetPackages.NuSpec)))</_NuSpecFullPath>
</PropertyGroup>
<!-- nuget pack "C:\...\Package.nuspec" -NoPackageAnalysis -OutputDirectory "C:\...\Output\" -->
<PropertyGroup>
<_Cmd>"$(NugetExe)" pack "$(_NuSpecFullPath)" -NoPackageAnalysis -OutputDirectory "$(NuGetOutputRootNoTrailingSlash)" </_Cmd>
</PropertyGroup>
<Error Text=".nuspec file not found at [$(_NuSpecFullPath)]"
Condition=" !Exists('$(_NuSpecFullPath)')" />
<Message Text="Building NuGet package with the command: [$(_Cmd)]" Importance="low" />
<Exec Command="$(_Cmd)" />
<Message Text="ExitCode: $(exitCode)" Importance="high"/>
</Target>
<Target Name="CopyNuGetSourceFilesToOutput"
Inputs="@(NugetSourceFiles)"
Outputs="@(NugetSourceFiles->'%(Dest)')">
<Copy SourceFiles="@(NugetSourceFiles)"
DestinationFiles="@(NugetSourceFiles->'%(Dest)')"/>
</Target>
<Target Name="CopyNugetPackagesToLocalRepo" Condition=" '$(EnableCopyToLocalRepo)'=='true' " DependsOnTargets="CoreBuildNuGetPackages">
<ItemGroup>
<_NuGetPackagesToCopy Include="$(NuGetOutputRoot)*.nupkg" />
</ItemGroup>
<Copy SourceFiles="@(_NuGetPackagesToCopy)"
DestinationFolder="$(NuGetLocalRepoFolder)"
Condition=" '$(NuGetLocalRepoFolder)'!='' and Exists('$(NuGetLocalRepoFolder)')" />
</Target>
<ItemGroup>
<NugetSourceFiles Include="$(NuGetSrc)**\*">
<Dest>$(NuGetOutputRoot)%(RecursiveDir)%(Filename)%(Extension)</Dest>
</NugetSourceFiles>
<NugetSourceFiles Include="$(SourceRoot)\SlowCheetah\Resources\Install\Microsoft.Web.XmlTransform.dll">
<Dest>$(NuGetOutputRoot)tools\%(Filename)%(Extension)</Dest>
</NugetSourceFiles>
<NugetSourceFiles Include="$(SourceRoot)\SlowCheetah\Resources\Install\SlowCheetah.Xdt.dll">
<Dest>$(NuGetOutputRoot)tools\%(Filename)%(Extension)</Dest>
</NugetSourceFiles>
<NugetSourceFiles Include="$(SourceRoot)\SlowCheetah\Resources\Install\SlowCheetah.Transforms.targets">
<Dest>$(NuGetOutputRoot)tools\%(Filename)%(Extension)</Dest>
</NugetSourceFiles>
<NugetSourceFiles Include="$(SourceRoot)\SlowCheetah\Resources\Install\SlowCheetah.Transforms.targets">
<Dest>$(NuGetOutputRoot)content\Properties\SlowCheetah\%(Filename)%(Extension)</Dest>
</NugetSourceFiles>
</ItemGroup>
</Project>