forked from ligershark/template-builder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.proj
130 lines (106 loc) · 5.35 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
<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>
<!-- This item should never have more than 1 value -->
<_NugetSpecFile Include="$(NuspecFile)" />
<ToolsItems Include="$(SourceRoot)tools\**\*" />
<ToolsItems Include="$(OutputRoot)LigerShark.TemplateBuilder.Tasks.dll" />
<!-- <ToolsItems Include="$(SourceRoot)WebTemplatePack\Build\ligershark.vstemplates.targets" />
<ToolsItems Include="$(SourceRoot)WebTemplatePack\Build\Lib\**\*" /> -->
<ContentItems Include="$(SourceRoot)content\**\*">
<DestDir>%(RecursiveDir)</DestDir>
</ContentItems>
<LibItems Include="$(OutputRoot)TemplateBuilder.dll"/>
<NuGetRootItems Include="$(SourceRoot)readme.txt"/>
<ProjectsToBuild Include="$(SourceRoot)src\LigerShark.TemplateBuilder.Tasks\LigerShark.TemplateBuilder.Tasks.csproj" />
<ProjectsToBuild Include="$(SourceRoot)src\TemplateBuilder\TemplateBuilder.csproj" />
</ItemGroup>
<PropertyGroup>
<FullBuildDependsOn>
CleanAndInitalize;
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>
CleanAndInitalize;
PrepareAndPopulateNugetFolder;
CoreCreateNugetPackage;
</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)" -NoPackageAnalysis -OutputDirectory "$(OutputRootNoTrailingSlash)" </_Cmd>
</PropertyGroup>
<Message Text="_Cmd: $(_Cmd)" Importance="low" />
<Exec Command="$(_Cmd)"/>
<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="CleanAndInitalize">
<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>
</Project>