forked from kayakhttp/kayak
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.proj
59 lines (54 loc) · 2.92 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
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)'=='' ">Release</Configuration>
<OutputPath Condition=" '$(OutputPath)'=='' ">$(MSBuildProjectDirectory)\build\</OutputPath>
<ConfigurationOutputPath>$(OutputPath)\$(Configuration)\</ConfigurationOutputPath>
<CompileOutputPath>$(ConfigurationOutputPath)\out\</CompileOutputPath>
<NupkgPath>$(ConfigurationOutputPath)\nupkg\</NupkgPath>
<NupkgLibPath>$(NupkgPath)\lib\</NupkgLibPath>
<NupkgSpecName>Kayak.nuspec</NupkgSpecName>
<NugetExeLocation>$(MSBuildProjectDirectory)\tools\nuget</NugetExeLocation>
</PropertyGroup>
<ItemGroup>
<Projects Include="$(MSBuildProjectDirectory)\Kayak\Kayak.csproj"/>
<Projects Include="$(MSBuildProjectDirectory)\Kayak.Tests\Kayak.Tests.csproj"/>
</ItemGroup>
<!-- all of this for recursively deleting a directory. still doesn't work on any directory that doesn't contain
files. what a load of crap. <\3 MSBuild. -->
<ItemGroup>
<!-- list all files under output path -->
<CleanFiles Include="$(OutputPath)\**\*"/>
</ItemGroup>
<ItemGroup>
<!-- list parent dirs of all files -->
<CleanDirectories Include="@(CleanFiles->'%(RelativeDir)')"/>
</ItemGroup>
<Target Name="RemoveDuplicateCleanDirectories">
<!-- remove duplicates (happens when dir contains more than one file) -->
<RemoveDuplicates Inputs="@(CleanDirectories)">
<Output TaskParameter="Filtered" ItemName="FilteredCleanDirectories"/>
</RemoveDuplicates>
</Target>
<Target Name="Clean" DependsOnTargets="RemoveDuplicateCleanDirectories">
<Delete Files="@(CleanFiles)"/>
<RemoveDir Directories="@(FilteredCleanDirectories)"/>
<RemoveDir Directories="$(OutputPath)" Condition="Exists('$(OutputPath)')"/>
</Target>
<Target Name="Build">
<MakeDir Directories="$(CompileOutputPath)"/>
<MSBuild Projects="@(Projects)" Properties="OutputPath=$(CompileOutputPath);NugetExeLocation=$(NugetExeLocation)" />
</Target>
<Target Name="DistNuget" DependsOnTargets="Build">
<MakeDir Directories="$(NupkgLibPath)"/>
<Copy SourceFiles="$(CompileOutputPath)\Kayak.dll" DestinationFolder="$(NupkgLibPath)"/>
<Copy SourceFiles="$(NupkgSpecName)" DestinationFolder="$(NupkgPath)"/>
<GetAssemblyIdentity AssemblyFiles="$(CompileOutputPath)\Kayak.dll">
<Output TaskParameter="Assemblies" ItemName="AssemblyInfo" />
</GetAssemblyIdentity>
<XmlPoke
XmlInputPath="$(NupkgPath)\$(NupkgSpecName)"
Query="//version"
Value="%(AssemblyInfo.Version)"/>
<Exec WorkingDirectory="$(NupkgPath)" Command="$(NugetExeLocation) pack $(NupkgSpecName)"/>
</Target>
</Project>