forked from dotnet/buildtools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.proj
82 lines (69 loc) · 2.9 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
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectDir>$(MSBuildThisFileDirectory)</ProjectDir>
<SourceDir>$(ProjectDir)src\</SourceDir>
<BinDir>$(ProjectDir)bin\</BinDir>
<ToolsDir>$(BinDir)tools\</ToolsDir>
<NuGetToolPath>$(ToolsDir)NuGet.exe</NuGetToolPath>
<NuGetConfigFile>$(SourceDir)nuget\NuGet.Config</NuGetConfigFile>
<NuGetConfigCommandLine
Condition="Exists($(NuGetConfigFile))">-ConfigFile "$(NuGetConfigFile)"</NuGetConfigCommandLine>
<PackagesDir>$(SourceDir)packages\</PackagesDir>
</PropertyGroup>
<ItemGroup>
<BuildToolFiles Include="$(SourceDir)Microsoft.DotNet.Build.Tasks\Targets\*" />
<PackageConfigs Include="$(SourceDir)*\packages.config" />
</ItemGroup>
<UsingTask TaskName="DownloadFile" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<Address ParameterType="System.String" Required="true"/>
<FileName ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Reference Include="System" />
<Code Type="Fragment" Language="cs">
<![CDATA[
var directory = System.IO.Path.GetDirectoryName(FileName);
System.IO.Directory.CreateDirectory(directory);
var client = new System.Net.WebClient();
client.Proxy = System.Net.WebRequest.DefaultWebProxy;
client.Proxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
client.DownloadFile(Address, FileName);
]]>
</Code>
</Task>
</UsingTask>
<Target Name="Clean">
<!-- Execute build tools -->
<MSBuild
Projects="$(ToolsDir)fxbuild.proj"
SkipNonexistentProjects="true"
Targets="Clean" />
<!-- Remove build tools -->
<Delete
Files="@(BuildToolFiles->'$(ToolsDir)Targets\%(Filename)%(Extension)')" />
</Target>
<Target Name="Build">
<!-- Download latest nuget.exe -->
<DownloadFile
Condition="!Exists($(NuGetToolPath))"
Address="http://nuget.org/nuget.exe"
FileName="$(NuGetToolPath)" />
<!-- Restore packages -->
<Exec
Condition="'@(PackageConfigs)'!=''"
StandardOutputImportance="Low"
Command=""$(NuGetToolPath)" restore "%(PackageConfigs.FullPath)" -PackagesDirectory "$(PackagesDir) " $(NuGetConfigCommandLine)" />
<!-- Pre-build tasks and targets -->
<MSBuild
Projects="$(SourceDir)BuildTools.sln"
Properties="OutDir=$(ToolsDir);BaseIntermediateOutputPath=$(ToolsDir)obj\" />
<!-- Execute build tools -->
<MSBuild
Projects="$(ToolsDir)fxbuild.proj"
Properties="$(FxBuildProjectProperties)"
Targets="Build" />
</Target>
<Target Name="Rebuild" DependsOnTargets="Clean;Build" />
</Project>