-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.proj
99 lines (79 loc) · 3.81 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
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="CreateNugetPackage">
<!--
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>
</PropertyGroup>
<PropertyGroup>
<Configuration Condition=" '$(Configuration)'=='' ">Release</Configuration>
</PropertyGroup>
<ItemGroup>
<!-- This item should never have more than 1 value -->
<_NugetSpecFile Include="$(SourceRoot)vsix-compress.nuspec" />
<ToolsItems Include="$(SourceRoot)tools\**\*" />
<ContentItems Include="$(SourceRoot)content\**\*">
<DestDir>%(RecursiveDir)</DestDir>
</ContentItems>
</ItemGroup>
<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)')"/>
</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>