-
Notifications
You must be signed in to change notification settings - Fork 28
/
main-build.proj
178 lines (147 loc) · 7.02 KB
/
main-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
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="FullBuild">
<!--
You can use this scrip to:
1. Create the NuGet package
#1: msbuild.exe build.proj
-->
<PropertyGroup>
<SourceRoot Condition=" '$(SourceRoot)'=='' ">$(MSBuildProjectDirectory)\</SourceRoot>
<OutputRootNoTrailingSlash Condition=" '$(OutputRoot)'=='' ">$(SourceRoot)OutputRoot</OutputRootNoTrailingSlash>
<OutputRoot Condition=" '$(OutputRoot)'=='' ">$(OutputRootNoTrailingSlash)\</OutputRoot>
<PackageRoot Condition=" '$(PackageRoot)'=='' ">$(OutputRoot)Nugetpkg\</PackageRoot>
<NugetExe Condition=" '$(NugetExe)'=='' ">$(SourceRoot).nuget\NuGet.exe</NugetExe>
<NugetLocalRepo Condition=" '$(NugetLocalRepo)'=='' ">C:\Temp\Nuget\LocalRepo\</NugetLocalRepo>
<PackageDirectory Condition=" '$(PackageDirectory)'=='' ">_Package</PackageDirectory>
<CopyOutputToDevFolder Condition=" '$(CopyOutputToDevFolder)'=='' ">true</CopyOutputToDevFolder>
<DevFolder Condition=" '$(DevFolder)'=='' ">c:\temp\msbuild\</DevFolder>
<RestorePackages Condition=" '$(RestorePackages)'=='' ">true</RestorePackages>
<NuspecFile Condition=" '$(NuspecFile)'=='' ">$(SourceRoot)template-builder.nuspec</NuspecFile>
<VisualStudioVersion Condition=" '$(VisualStudioVersion)'==''">11.0</VisualStudioVersion>
</PropertyGroup>
<PropertyGroup>
<Configuration Condition=" '$(Configuration)'=='' ">Release</Configuration>
</PropertyGroup>
<ItemGroup>
<ProjectsToBuild Include="$(SourceRoot)src\LigerShark.TemplateBuilder.Tasks\LigerShark.TemplateBuilder.Tasks.csproj" />
<ProjectsToBuild Include="$(SourceRoot)src\TemplateBuilder\TemplateBuilder.csproj" />
<ProjectsToBuild Include="$(SourceRoot)src\LigerShark.FileReplacer\LigerShark.FileReplacer.csproj" />
</ItemGroup>
<Target Name="PopulateNuGetItems">
<ItemGroup>
<_nugetcontent Remove="@(_nugetcontent)"/>
<_nugetcontent Include="$(SourceRoot)content\**\*"/>
</ItemGroup>
<ItemGroup>
<!-- This item should never have more than 1 value -->
<_NugetSpecFile Include="$(NuspecFile)" />
<ToolsItems Include="$(SourceRoot)tools\**\*" />
<ToolsItems Include="$(OutputRoot)*.dll" />
<ContentItems Include="@(_nugetcontent)">
<DestDir>%(RecursiveDir)</DestDir>
</ContentItems>
<LibItems Include="$(OutputRoot)TemplateBuilder.dll"/>
<NuGetRootItems Include="$(SourceRoot)readme.txt"/>
</ItemGroup>
</Target>
<PropertyGroup>
<FullBuildDependsOn>
Clean;
BuildProjects;
CreateNugetPackage;
</FullBuildDependsOn>
<BuildProjectsDependsOn>
CoreBuildProjects;
</BuildProjectsDependsOn>
</PropertyGroup>
<Target Name="FullBuild" DependsOnTargets="$(FullBuildDependsOn)"/>
<Target Name="BuildProjects" DependsOnTargets="$(BuildProjectsDependsOn)"/>
<Target Name="CoreBuildProjects">
<Message Text="Building projects [@(ProjectsToBuild)]" Importance="high"/>
<MSBuild Projects="@(ProjectsToBuild)" Properties="VisualStudioVersion=$(VisualStudioVersion);Configuration=$(Configuration);OutputPath=$(OutputRoot)"/>
</Target>
<PropertyGroup>
<CreateNugetPackageDependsOn>
Clean;
PopulateNuGetItems;
PrepareAndPopulateNugetFolder;
CoreCreateNugetPackage;
CreateFileReplacerNuGetPackage;
CopyCreatedNuGetPkgsToLocalRepo;
</CreateNugetPackageDependsOn>
</PropertyGroup>
<Target Name="CreateNugetPackage" DependsOnTargets="$(CreateNugetPackageDependsOn)" />
<Target Name="CoreCreateNugetPackage">
<!-- nuget pack "C:\...\<filename>.nuspec" -NoPackageAnalysis -OutputDirectory "C:\...\Output\" -->
<PropertyGroup>
<_NugetSpecFile>%(_NugetSpecOutputFile.FullPath)</_NugetSpecFile>
<_Cmd>"$(NugetExe)" pack "$(_NugetSpecFile)" -OutputDirectory "$(OutputRootNoTrailingSlash)" </_Cmd>
</PropertyGroup>
<Message Text="_Cmd: $(_Cmd)" Importance="low" />
<Exec Command="$(_Cmd)"/>
<!--<ItemGroup>
<_CreatedPackage Include="$(OutputRoot)TemplateBuilder*.nupkg"/>
</ItemGroup>
<Copy SourceFiles="@(_CreatedPackage)"
DestinationFiles="@(_CreatedPackage->'$(NugetLocalRepo)%(Filename)%(Extension)')"
Condition="Exists('$(NugetLocalRepo)')"/>-->
</Target>
<Target Name="CopyCreatedNuGetPkgsToLocalRepo">
<ItemGroup>
<_CreatedPackage Include="$(OutputRoot)*.nupkg"/>
</ItemGroup>
<Copy SourceFiles="@(_CreatedPackage)"
DestinationFiles="@(_CreatedPackage->'$(NugetLocalRepo)%(Filename)%(Extension)')"
Condition="Exists('$(NugetLocalRepo)')"/>
</Target>
<Target Name="PrepareAndPopulateNugetFolder">
<Copy SourceFiles="@(_NugetSpecFile)"
DestinationFiles="@(_NugetSpecFile->'$(PackageRoot)%(Filename)%(Extension)')">
<Output ItemName="_NugetSpecOutputFile" TaskParameter="DestinationFiles"/>
</Copy>
<Copy SourceFiles="@(ToolsItems)"
DestinationFiles="@(ToolsItems->'$(PackageRoot)tools\%(Filename)%(Extension)')"/>
<Copy SourceFiles="@(ContentItems)"
DestinationFiles="@(ContentItems->'$(PackageRoot)content\%(DestDir)%(Filename)%(Extension)')"/>
<Copy SourceFiles="@(LibItems)"
DestinationFiles="@(LibItems->'$(PackageRoot)lib\%(DestDir)%(Filename)%(Extension)')"/>
<Copy SourceFiles="@(NuGetRootItems)"
DestinationFiles="@(NuGetRootItems->'$(PackageRoot)%(DestDir)%(Filename)%(Extension)')" />
</Target>
<Target Name="Clean">
<MakeDir Directories="$(OutputRoot)"/>
<MakeDir Directories="$(PackageRoot)"/>
<ItemGroup>
<_FilesToDelete Remove="@(_FilesToDelete)"/>
<_FilesToDelete Include="$(OutputRoot)**\*"/>
</ItemGroup>
<Delete Files="@(_FilesToDelete)"/>
<ItemGroup>
<_FilesToDelete Remove="@(_FilesToDelete)"/>
<_FilesToDelete Include="$(PackageRoot)**\*"/>
</ItemGroup>
<Delete Files="@(_FilesToDelete)"/>
</Target>
<ItemGroup>
<FileReplacerSourceFiles Include="$(SourceRoot)file-replacer.nuspec"/>
<FileReplacerSourceFiles Include="$(SourceRoot)file-replacer.psm1"/>
<FileReplacerSourceFiles Include="$(SourceRoot)LICENSE.md"/>
</ItemGroup>
<PropertyGroup>
<CreateFileReplacerNuGetPackageDependsOn>
$(CreateFileReplacerNuGetPackageDependsOn);
CoreBuildProjects;
</CreateFileReplacerNuGetPackageDependsOn>
</PropertyGroup>
<Target Name="CreateFileReplacerNuGetPackage">
<Message Text="Copying file replacer source files to outputroot" Importance="low"/>
<Copy SourceFiles="@(FileReplacerSourceFiles)"
DestinationFiles="@(FileReplacerSourceFiles->'$(OutputRoot)%(RecursiveDir)%(Filename)%(Extension)')"/>
<!-- copy files from source folder to output -->
<PropertyGroup>
<_NugetSpecFile>$(OutputRoot)file-replacer.nuspec</_NugetSpecFile>
<_Cmd>"$(NugetExe)" pack "$(_NugetSpecFile)" -OutputDirectory "$(OutputRootNoTrailingSlash)" </_Cmd>
</PropertyGroup>
<Message Text="Building file replacer nuget package with command [$(_Cmd)]" Importance="low" />
<Exec Command="$(_Cmd)"/>
</Target>
</Project>