forked from chcosta/core-compose
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.proj
172 lines (153 loc) · 9.25 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
160
161
162
163
164
165
166
167
168
169
170
171
172
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask TaskName="ZipFileExtractToDirectory" AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.Tasks.dll" />
<Import Project="dir.props" />
<Import Project="config.props" />
<PropertyGroup>
<!-- Note: escape msbuild characters with ascii escape codes. < == %3C, > == %3E-->
<PackageNameRegex Condition="'$(PackageNameRegex)' == ''">(?%3Cname%3E.*)\.(?%3Cversion%3E\d+\.\d+\.\d+)(-(?%3Cprerelease%3E.*)?)?</PackageNameRegex>
</PropertyGroup>
<PropertyGroup>
<DotNetCommand Condition="'$(OSGroup)' == 'Windows_NT'">$(ToolsDir)/dotnetcli/dotnet.exe</DotNetCommand>
<DotNetCommand Condition="'$(OSGroup)' != 'Windows_NT'">$(ToolsDir)/dotnetcli/dotnet</DotNetCommand>
</PropertyGroup>
<Target Name="Build"
DependsOnTargets="GetRuntimeId;InitProperties;BuildCoreSetup;BuildCli" />
<Target Name="InitProperties"
DependsOnTargets="GetRuntimeId">
<PropertyGroup>
<CoreClrPkgs>$(CoreClrRepo)bin/Product/$(OSGroup).x64.Release/.nuget/pkg/</CoreClrPkgs>
<CoreSetupPkgs>$(CoreSetupRepo)artifacts/$(RuntimeId)/corehost/</CoreSetupPkgs>
<CliIntermediatePath>$(CliRepo)artifacts/$(RuntimeId)/intermediate/</CliIntermediatePath>
<CliSignalFilesRootPath>$(CliIntermediatePath)coreSetupDownload/</CliSignalFilesRootPath>
<CliSharedFrameworkRootPath>$(CliIntermediatePath)sharedFrameworkPublish</CliSharedFrameworkRootPath>
<CoreSetupInstallersSourcePath>$(CoreSetupRepo)artifacts/$(RuntimeId)/packages/</CoreSetupInstallersSourcePath>
<CliInstallersDestinationPath>$(CliRepo)artifacts/$(RuntimeId)/packages/</CliInstallersDestinationPath>
<CoreSetupDotNetWinZip>$(CoreSetupInstallersSourcePath)</CoreSetupDotNetWinZip>
</PropertyGroup>
</Target>
<Target Name="GetRuntimeId"
DependsOnTargets="InstallSharedFramework100;
GetRuntimeIdFromUpdateRepo" />
<Target Name="BuildCli"
DependsOnTargets="UpdateCliDependencyVersions;
UpdateNuGetConfig;
LayoutCoreSetupInstallers" >
<PropertyGroup>
<BuildCommand Condition="'$(OSGroup)' == 'Windows_NT'">$(CliRepo)build.cmd</BuildCommand>
<BuildCommand Condition="'$(OsGroup)' != 'Windows_NT'">$(CliRepo)build.sh</BuildCommand>
</PropertyGroup>
<Exec Condition="'$(OSGroup)' == 'Windows_NT'" Command="powershell.exe Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope Process" />
<Exec Command="$(BuildCommand)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(CliRepo)" />
</Target>
<Target Name="BuildCoreSetup"
DependsOnTargets="InstallSharedFramework100;
UpdateCoreSetupDependencyVersions;
UpdateNuGetConfig">
<PropertyGroup>
<BuildCommand Condition="'$(OSGroup)' == 'Windows_NT'">$(CoreSetupRepo)build.cmd</BuildCommand>
<BuildCommand Condition="'$(OsGroup)' != 'Windows_NT'">bash $(CoreSetupRepo)build.sh</BuildCommand>
</PropertyGroup>
<Exec Condition="'$(OSGroup)' == 'Windows_NT'" Command="powershell.exe Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope Process" />
<Exec Command="$(BuildCommand)" WorkingDirectory="$(CoreSetupRepo)" />
</Target>
<Target Name="InstallSharedFramework100"
Condition="!Exists('$(MSBuildThisFileDirectory)Tools/dotnetcli/shared/Microsoft.NETCore.App/1.0.0/dotnet.exe')">
<Message Importance="High" Text="Installing shared framework 1.0.0" />
<PropertyGroup>
<BuildCommand Condition="'$(OSGroup)' == 'Windows_NT'">powershell.exe $(CliRepo)scripts\obtain\dotnet-install.ps1"</BuildCommand>
<BuildCommand Condition="'$(OSGroup)' != 'Windows_NT'">bash $(CliRepo)scripts/obtain/dotnet-install.sh</BuildCommand>
</PropertyGroup>
<Exec Condition="'$(OSGroup)' == 'Windows_NT'" Command="$(BuildCommand) -Version 1.0.0 -Architecture x64 -Channel preview -SharedRuntime -InstallDir $(MSBuildThisFileDirectory)Tools/dotnetcli"
WorkingDirectory="$(MSBuildThisFileDirectory)" />
</Target>
<Target Name="LayoutCoreSetupInstallers"
DependsOnTargets="WriteInstallerSignalFiles;
UnzipDotnetWinInstaller;
CopyCoreSetupInstallers" />
<Target Name="CopyCoreSetupInstallers">
<ItemGroup>
<InstallerFiles Include="$(CoreSetupInstallersSourcePath)/*" />
</ItemGroup>
<Copy SourceFiles="@(InstallerFiles)"
DestinationFolder="$(CliInstallersDestinationPath)"
SkipUnchangedFiles="true" />
</Target>
<Target Name="UnzipDotnetWinInstaller">
<MakeDir Directories="$(CliSharedFrameworkRootPath)" />
<PropertyGroup>
<SourceArchive>$(CoreSetupInstallersSourcePath)dotnet-win-x64.$(SharedFrameworkVersion).zip</SourceArchive>
<SourceArchive Condition="'$(OSGroup)' != 'Windows_NT'">$(SharedFrameworkFile)</SourceArchive>
</PropertyGroup>
<ZipFileExtractToDirectory SourceArchive="$(SourceArchive)"
DestinationDirectory="$(CliSharedFrameworkRootPath)"
OverwriteDestination="true"
Condition="'$(OSGroup)' == 'Windows_NT'" />
<Exec Command="tar -xvf $(SourceArchive) -C $(CliSharedFrameworkRootPath)"
Condition="'$(OSGroup)' != 'Windows_NT'" />
</Target>
<Target Name="GetSharedFrameworkVersion">
<ItemGroup>
<SharedFrameworkFiles Include="$(CoreSetupInstallersSourcePath)dotnet-sharedframework-*.msi" />
<SharedFrameworkFiles Condition="'$(OSGroup)' != 'Windows_NT'" Include="$(CoreSetupInstallersSourcePath)dotnet-*" />
</ItemGroup>
<PropertyGroup>
<SharedFrameworkFile Condition="'$(SharedFrameworkFile)' == ''">%(SharedFrameworkFiles.Identity)</SharedFrameworkFile>
<SharedFrameworkVersion>$([System.Text.RegularExpressions.Regex]::Match($(SharedFrameworkFile), (\d+\.\d+\.\d+-[^\.]+)))</SharedFrameworkVersion>
</PropertyGroup>
<Message Text="Shared Framework File: $(SharedFrameworkFile)" Importance="High" />
<Message Text="Shared Framework Version: $(SharedFrameworkVersion)" Importance="High" />
</Target>
<Target Name="GatherInstallerSignalFiles"
DependsOnTargets="GetSharedFrameworkVersion">
<ItemGroup>
<InstallerSignalFile Include="$(CliSignalFilesRootPath)$(SharedFrameworkVersion)/combinedSharedHostAndFrameworkArchive" />
<InstallerSignalFile Include="$(CliSignalFilesRootPath)$(SharedFrameworkVersion)/sharedFrameworkInstaller" />
<InstallerSignalFile Include="$(CliSignalFilesRootPath)$(SharedFrameworkVersion)/sharedHostInstaller" />
<InstallerSignalFile Include="$(CliSignalFilesRootPath)$(SharedFrameworkVersion)/hostFxrInstaller" />
</ItemGroup>
</Target>
<Target Name="WriteInstallerSignalFiles"
DependsOnTargets="GatherInstallerSignalFiles"
Inputs="%(InstallerSignalFile.Identity)"
Outputs="fake">
<MakeDir Directories="$(CliSignalFilesRootPath)$(SharedFrameworkVersion)/" />
<Message Text="Writing signal file: %(InstallerSignalFile.Identity)" Importance="High" />
<WriteLinesToFile File="%(InstallerSignalFile.Identity)"
Lines="Empty signal file"
Overwrite="true" />
</Target>
<Target Name="GetRuntimeIdFromUpdateRepo">
<Exec Command="$(DotNetCommand) restore"
WorkingDirectory="$(MSBuildThisFileDirectory)src/UpdateRepo/src/UpdateRepo" />
<Exec Command="$(DotNetCommand) run GetRuntimeId"
ConsoleToMSBuild="true"
WorkingDirectory="$(MSBuildThisFileDirectory)src/UpdateRepo/src/UpdateRepo">
<Output TaskParameter="ConsoleOutput" PropertyName="OutputOfExec" />
</Exec>
<PropertyGroup>
<RuntimeId Condition="'$(RuntimeId)' == ''">$([System.Text.RegularExpressions.Regex]::Match($(OutputOfExec), Runtime Identifier: (.*)).get_Groups().get_Item(1).ToString())</RuntimeId>
</PropertyGroup>
<Message Text="RuntimeId: $(RuntimeId)" Importance="High" />
</Target>
<Target Name="UpdateCoreSetupDependencyVersions">
<Exec Command="$(DotNetCommand) restore"
WorkingDirectory="$(MSBuildThisFileDirectory)src/UpdateRepo/src/UpdateRepo" />
<Exec Command="$(DotNetCommand) run $(CoreSetupRepo) $(CoreClrPkgs)"
WorkingDirectory="$(MSBuildThisFileDirectory)src/UpdateRepo/src/UpdateRepo" />
</Target>
<Target Name="UpdateCliDependencyVersions">
<Exec Command="$(DotNetCommand) restore"
WorkingDirectory="$(MSBuildThisFileDirectory)src/UpdateRepo/src/UpdateRepo" />
<Exec Command="$(DotNetCommand) run $(CliRepo) $(CoreClrPkgs) $(CoreSetupPkgs)"
WorkingDirectory="$(MSBuildThisFileDirectory)src/UpdateRepo/src/UpdateRepo" />
</Target>
<Target Name="UpdateNuGetConfig">
<Exec Command="$(DotNetCommand) restore"
WorkingDirectory="$(MSBuildThisFileDirectory)src/UpdateNuGetConfig" />
<Exec Command="$(DotNetCommand) run $(CoreSetupRepo)NuGet.Config $(CoreClrPkgs)"
WorkingDirectory="$(MSBuildThisFileDirectory)src/UpdateNuGetConfig" />
<Exec Command="$(DotNetCommand) run $(CliRepo)NuGet.Config $(CoreSetupPkgs) $(CoreClrPkgs)"
WorkingDirectory="$(MSBuildThisFileDirectory)src/UpdateNuGetConfig" />
</Target>
</Project>