-
Notifications
You must be signed in to change notification settings - Fork 18
/
psbuild.proj
128 lines (104 loc) · 5.78 KB
/
psbuild.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
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0" DefaultTargets="FullBuild">
<!-- This file is designed to be executed from the OutputRoot\ directory not the source directory -->
<PropertyGroup>
<Root>$(MSBuildThisFileDirectory)</Root>
<SourceRoot Condition=" '$(SourceRoot)'=='' ">$(Root)src\</SourceRoot>
<OutputRootNoTrailingSlash Condition=" '$(OutputRoot)'=='' ">$(Root)OutputRoot</OutputRootNoTrailingSlash>
<OutputRoot Condition=" '$(OutputRoot)'=='' ">$(OutputRootNoTrailingSlash)\</OutputRoot>
<ToolsRoot Condition=" ''=='' ">$(Root)build-tools\</ToolsRoot>
<NugetLocalRepo Condition=" '$(NugetLocalRepo)'=='' ">C:\Temp\Nuget\LocalRepo\</NugetLocalRepo>
<RestorePackages Condition=" '$(RestorePackages)'=='' ">true</RestorePackages>
<Configuration Condition=" '$(Configuration)'=='' ">Release</Configuration>
<PsbuildSourceRoot Condition=" '$(PsbuildSourceRoot)'=='' ">$(SourceRoot)</PsbuildSourceRoot>
<PSBuildOutputRoot Condition=" '$(PSBuildOutputRoot)'=='' ">$(OutputRoot)PSBuild\</PSBuildOutputRoot>
<!--<ImgCompSourceRoot Condition=" '$(ImgCompSourceRoot)'=='' ">$(SourceRoot)ImageCompressor.Job\</ImgCompSourceRoot>
<TextMinSourceRoot Condition=" '$(TextMinSourceRoot)'=='' ">$(SourceRoot)TextMinifier.Job\</TextMinSourceRoot>
<SharedSourceRoot Condition=" '$(SharedSourceRoot)'=='' ">$(SourceRoot)AzureJobs.NuGet.Shared\</SharedSourceRoot>
<OutputPathImgComp Condition=" '$(OutputPathImgComp)'=='' ">$(OutputRoot)ImageCompressor.Job\</OutputPathImgComp>
<OutputPathTextMin Condition=" '$(OutputPathTextMin)'=='' ">$(OutputRoot)TextMinifier.Job\</OutputPathTextMin>
<OutputPathShared Condition=" '$(OutputPathShared)'=='' ">$(OutputRoot)AzureJobs.NuGet.Shared\</OutputPathShared>-->
</PropertyGroup>
<PropertyGroup>
<NuspecFile Condition=" '$(NuspecFile)'=='' ">$(MSBuildThisProjectDirectory)psbuild.nuspec</NuspecFile>
<NugetSourceRoot Condition=" ''=='' ">$(PsbuildSourceRoot)</NugetSourceRoot>
<ContribSourceRoot Condition=" ''=='' ">$(PsbuildSourceRoot)..\contrib\</ContribSourceRoot>
<PackageRoot Condition=" '$(PackageRoot)'=='' ">$(OutputRoot)_psbuild-nuget\</PackageRoot>
<_ls-tempoutfolder Condition=" '$(_ls-tempoutfolder)'=='' ">$(OutputRoot)temp\</_ls-tempoutfolder>
</PropertyGroup>
<ItemGroup>
<ProjectsToBuild Include="$(SourceRoot)PSBuild\PSBuild.csproj"/>
</ItemGroup>
<PropertyGroup>
<FullBuildDependsOn>
BuildProjects;
CreateNugetPackage
</FullBuildDependsOn>
<BuildProjectsDependsOn>
CoreBuildProjects;
</BuildProjectsDependsOn>
<CreateNugetPackageDependsOn>
GetNuget;
GatherNuGetFiles;
PrepareAndPopulateNugetFolder;
CoreCreateNugetPackage;
</CreateNugetPackageDependsOn>
</PropertyGroup>
<Target Name="FullBuild" DependsOnTargets="$(FullBuildDependsOn)"/>
<Target Name="BuildProjects" DependsOnTargets="$(BuildProjectsDependsOn)"/>
<Target Name="CoreBuildProjects">
<Message Text="Building projects now [@(ProjectsToBuild)]" Importance="high"/>
<MSBuild Projects="@(ProjectsToBuild)" Properties="Configuration=$(Configuration);OutputPath=$(PSBuildOutputRoot)"/>
</Target>
<Target Name="GatherNuGetFiles">
<ItemGroup>
<!-- This item should never have more than 1 value -->
<_NugetSpecFile Include="$(NuspecFile)" />
<!-- Standard declarations -->
<LibItems Include="$(NugetSourceRoot)NuGet\lib\**\*" />
<ContentItems Include="$(NugetSourceRoot)NuGet\content\**\*"/>
<ToolsItems Include="$(NugetSourceRoot)NuGet\tools\**\*" />
<ToolsItems Include="$(NugetSourceRoot)init.ps1"/>
<ToolsItems Include="$(NugetSourceRoot)psbuild.psm1"/>
<ToolsItems Include="$(NugetSourceRoot)psbuild.psd1"/>
<ToolsItems Include="$(PSBuildOutputRoot)*.dll"/>
<ToolsItems Include="$(ContribSourceRoot)*.*" />
</ItemGroup>
</Target>
<Target Name="CreateNugetPackage" DependsOnTargets="$(CreateNugetPackageDependsOn)" />
<Target Name="CoreCreateNugetPackage" DependsOnTargets="GetNuget">
<Message Text="
OutputRoot: $(OutputRoot)
NugetSourceRoot: $(NugetSourceRoot)" Importance="low"/>
<PropertyGroup>
<_NugetSpecFile>%(_NugetSpecOutputFile.FullPath)</_NugetSpecFile>
<_Cmd>"$(NuGetExePath)" 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>
<Message Text="ToolsItems: [@(ToolsItems)]
ContentItems : [@(ContentItems)]
LibItems : [@(LibItems)]
NuGetRootItems : [@(NuGetRootItems)]" Importance="low"/>
<Copy SourceFiles="@(ToolsItems)"
DestinationFiles="@(ToolsItems->'$(PackageRoot)tools\%(DestDir)%(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>
<Import Project="getnuget.targets"/>
</Project>