This repository has been archived by the owner on Mar 6, 2023. It is now read-only.
forked from UbiquityDotNET/Llvm.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Directory.Build.targets
75 lines (69 loc) · 3.91 KB
/
Directory.Build.targets
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
<Project>
<!--
It is tempting to place the SDK ref here so that all the projects benefit from it
However, since this repo has C++ VCXPROJ projects, that doesn't work. It will pull
in requirements that break a VCXPROJ (or anything still stuck in the dark ages with Packages.config)
<Sdk Name="Microsoft.Build.CentralPackageVersions"/>
-->
<!--
Since Nuget.config is configured to include the build output location this
will ensure the folder exists during restore so that it won't fail.
-->
<Target Name="CreateBuildOutputNuget" BeforeTargets="Restore;Build;Rebuild">
<MakeDir Directories="$(MSBuildThisFileDirectory)BuildOutput\NuGet" />
</Target>
<Target Name="SetProjectSpecficVersionDependentProperties" AfterTargets="SetVersionDependentProperties">
<PropertyGroup>
<LlvmVersion Condition="'$(LlvmVersion)'==''">$(LlvmVersionMajor).$(LlvmVersionMinor).$(LlvmVersionPatch)</LlvmVersion>
<NuspecProperties Condition="'$(NuspecFile)'!=''" >version=$(PackageVersion);llvmversion=$(LlvmVersion);buildbinoutput=$(BaseOutputPath);configuration=$(Configuration);$(NuspecProperties)</NuspecProperties>
</PropertyGroup>
</Target>
<!-- Download nuget.exe if it isn't found-->
<Target Name="_DownloadNugetExe" >
<MakeDir Directories="$(PackageOutputPath)" Condition="!EXISTS('$(PackageOutputPath')" />
<DownloadFile Condition="!EXISTS('$(PackageOutputPath)\NuGet.exe')"
SourceUrl="https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
DestinationPath="$(PackageOutputPath)\NuGet.exe"
/>
</Target>
<!-- Custom task to download a file from a web URL -->
<UsingTask TaskName="DownloadFile"
TaskFactory="CodeTaskFactory"
AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll"
>
<ParameterGroup>
<SourceUrl ParameterType="System.String" Required="true"/>
<DestinationPath ParameterType="System.String" Required="true"/>
</ParameterGroup>
<Task>
<Using Namespace="System.Net"/>
<Code Type="Fragment" Language="cs">
<![CDATA[
var client = new WebClient();
client.DownloadFile( SourceUrl, DestinationPath );
]]>
</Code>
</Task>
</UsingTask>
<!-- Create NuGet packages for NuSpec property in VCXPROJ projects -->
<Target Name="Pack" DependsOnTargets="_DownloadNugetExe;SetProjectSpecficVersionDependentProperties" Condition="'$(MSBuildProjectExtension)'=='.vcxproj'">
<Exec Condition="exists('$(NuSpecFile)')"
Command='"$(PackageOutputPath)NuGet.exe" pack $(NuSpecFile) -OutputDirectory $(PackageOutputPath) -Properties $(NuspecProperties) -NoPackageAnalysis' />
</Target>
<Target Name="EnsureBuildOutputPaths" BeforeTargets="Build;Restore">
<MakeDir Directories="$(PackageOutputPath)"/>
</Target>
<Target Name="ShowBuildParameters" AfterTargets="SetProjectSpecficVersionDependentProperties">
<Message Importance="normal" Text=" BuildRootDir: $(BuildRootDir)" />
<Message Importance="normal" Text=" BaseBuildOutputPath: $(BaseBuildOutputPath)" />
<Message Importance="normal" Text="BaseIntermediateOutputPath: $(BaseIntermediateOutputPath)" />
<Message Importance="normal" Text=" IntDir: $(IntDir)" />
<Message Importance="normal" Text=" BaseOutputPath: $(BaseOutputPath)" />
<Message Importance="normal" Text=" FullBuildNumber: $(FullBuildNumber)"/>
<Message Importance="normal" Text=" PackageVersion: $(PackageVersion)"/>
<Message Importance="normal" Text=" FileVersion: $(FileVersion)"/>
<Message Importance="normal" Text=" LlvmVersion: $(LlvmVersion)"/>
<Message Importance="normal" Text=" Platform: $(Platform)"/>
<Message Importance="normal" Text=" Configuration: $(Configuration)"/>
</Target>
</Project>