forked from dotnet/machinelearning
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.proj
159 lines (132 loc) · 6.03 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
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build">
<PropertyGroup>
<!-- versioning.targets will import this file, so don't import it again -->
<DisableImportVersioningProps>true</DisableImportVersioningProps>
</PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.props))\Directory.Build.props" />
<Import Project="build/ExternalBenchmarkDataFiles.props" />
<Import Project="build/TensorflowMetaFiles.props" />
<Import Project="$(ToolsDir)VersionTools.targets" Condition="Exists('$(ToolsDir)VersionTools.targets')" />
<UsingTask TaskName="DownloadFilesFromUrl" AssemblyFile="$(ToolsDir)Microsoft.DotNet.Build.Tasks.dll"/>
<PropertyGroup>
<!-- To disable the restoration of packages, set RestoreDuringBuild=false or pass /p:RestoreDuringBuild=false.-->
<RestoreDuringBuild Condition="'$(RestoreDuringBuild)'==''">true</RestoreDuringBuild>
</PropertyGroup>
<PropertyGroup>
<!-- CreateOrUpdateCurrentVersionFile needs ProjectDir set to generate the SourceLink file -->
<ProjectDir>$(RepoRoot)</ProjectDir>
</PropertyGroup>
<ItemGroup>
<Project Include="Microsoft.ML.sln" />
</ItemGroup>
<Import Project="dir.traversal.targets" />
<Import Project="$(ToolsDir)clean.targets" />
<PropertyGroup>
<TraversalBuildDependsOn>
CreateOrUpdateCurrentVersionFile;
RestoreProjects;
BuildRedist;
BuildNative;
$(TraversalBuildDependsOn);
DownloadExternalTestFiles;
DownloadTensorflowMetaFiles;
DeleteTestHost;
</TraversalBuildDependsOn>
</PropertyGroup>
<Target Name="RestoreProjects" Condition="'$(RestoreDuringBuild)'=='true'">
<Message Importance="High" Text="Restoring all projects..." />
<MSBuild Projects="@(Project)"
Targets="Restore"
Properties="MSBuildWarningsAsMessages=NU1503;RestoreDisableParallel=true" />
</Target>
<Target Name="BuildRedist"
Condition="'$(SkipRedistBuild)' != 'true'"
DependsOnTargets="RestoreProjects">
<Message Importance="High" Text="Building redist components..." />
<MSBuild Projects="src/Redist/build.proj"
Targets="Build" />
</Target>
<Target Name="BuildNative"
Condition="'$(SkipNativeBuild)' != 'true'"
DependsOnTargets="RestoreProjects;BuildRedist">
<Message Importance="High" Text="Building native components..." />
<MSBuild Projects="src/Native/build.proj"
Targets="Build" />
</Target>
<Target Name="BuildPackages"
DependsOnTargets="CreateOrUpdateCurrentVersionFile;RestoreProjects">
<Message Importance="High" Text="Building packages ..." />
<ItemGroup>
<PkgProject Include="pkg\**\*.nupkgproj" />
</ItemGroup>
<MSBuild Projects="@(PkgProject)"
Targets="Restore" />
<MSBuild Projects="@(PkgProject)"
Targets="Pack" />
</Target>
<ItemGroup Condition="'$(IncludeBenchmarkData)' == 'true'">
<BenchmarkFile Update="@(BenchmarkFile)">
<Url>https://aka.ms/mlnet-resources/benchmarks/%(Identity)</Url>
<DestinationFile>$(MSBuildThisFileDirectory)/test/data/external/%(Identity)</DestinationFile>
</BenchmarkFile>
<TestFile Include="@(BenchmarkFile->'$(MSBuildThisFileDirectory)/test/data/external/%(Identity)')" />
</ItemGroup>
<Target Name="DownloadExternalTestFiles" Inputs="@(TestFile)" Outputs="%(TestFile.DestinationFile)">
<Message Importance="High" Text="Downloading external test files... %(TestFile.DestinationFile)" />
<DownloadFile
SourceUrl="%(BenchmarkFile.Url)"
DestinationFolder="$(MSBuildThisFileDirectory)/test/data/external/"
Retries="5"
SkipUnchangedFiles="true">
</DownloadFile>
</Target>
<ItemGroup Condition="'$(IncludeTensorflowMetaFile)' == 'true'">
<MetaFile Update="@(MetaFile)">
<Url>https://aka.ms/mlnet-resources/meta/%(Identity)</Url>
<DestinationFile>$([System.IO.Path]::GetTempPath())/MLNET/</DestinationFile>
</MetaFile>
<TensorflowMetaFile Include="@(MetaFile->'$([System.IO.Path]::GetTempPath())/MLNET/%(Identity)')" />
</ItemGroup>
<Target Name="DownloadTensorflowMetaFiles" Inputs="@(TensorflowMetaFile)" Outputs="%(TensorflowMetaFile.DestinationFile)">
<Message Importance="High" Text="Downloading tensorflow meta files... %(TensorflowMetaFile.DestinationFile)" />
<DownloadFile
SourceUrl="%(MetaFile.Url)"
DestinationFolder="$([System.IO.Path]::GetTempPath())/MLNET/"
Retries="5"
SkipUnchangedFiles="true">
</DownloadFile>
</Target>
<!-- Delete testhost.dll and testhost.exe from output folder,
start test from dotnet.exe to keep consistent behavior with older version of Microsoft.NET.Test.Sdk -->
<Target Name="DeleteTestHost">
<Message Importance="High" Text="Delete testhost.dll and testhost.exe from output folder..." />
<ItemGroup>
<FilesToClean Include="$(MSBuildThisFileDirectory)\bin\**\testhost.dll" />
<FilesToClean Include="$(MSBuildThisFileDirectory)\bin\**\testhost.exe" />
</ItemGroup>
<Delete Files="@(FilesToClean)"/>
<RemoveDir Directories="@(FoldersToClean)" />
</Target>
<Target Name="RunTests">
<MSBuild Projects="test\run-tests.proj"
Targets="RunTests" />
</Target>
<Target Name="RunCITests">
<MSBuild Projects="test\run-tests.proj"
Targets="RunCITests" />
</Target>
<Target Name="RunSpecificTests">
<MSBuild Projects="test\run-tests.proj"
Targets="RunSpecificTests" />
</Target>
<Target Name="RunNightlyBuildTests">
<MSBuild Projects="test\run-night-build-tests.proj"
Targets="RunNightlyBuildTests" />
</Target>
<!-- Override CleanAllProjects from dir.traversal.targets and just remove the full BinDir -->
<Target Name="CleanAllProjects">
<RemoveDir Directories="$(BinDir)" />
</Target>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.targets))\Directory.Build.targets" />
</Project>