forked from dotnet/diagnostics
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInstallRuntimes.proj
156 lines (125 loc) · 6.77 KB
/
InstallRuntimes.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
<!-- All Rights Reserved. Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. See the LICENSE file in the project root for more information. -->
<Project Sdk="Microsoft.Build.NoTargets">
<!--
$(BuildArch) - architecture to test (x64, x86, arm, arm64). Defaults to x64.
From Versions.props:
$(MicrosoftNetSdkVersion) - .NET SDK to use for testing
$(InternalReleaseTesting) - if true, internal service release testing
$(PrivateBuildTesting) - if true, test against a locally built runtime
@(RuntimeTestVersions) - runtime/aspnetcore versions to install and test against
From Arcade:
$(RepoRoot) - the root of the diagnostics repo
$(RepositoryEngineeringDir) - the "eng" directory
$(VersionsPropsPath) - path of Versions.props
-->
<PropertyGroup>
<BuildArch Condition="'$(BuildArch)' == ''">$(Platform)</BuildArch>
<BuildArch Condition="'$(BuildArch)' == 'AnyCpu'">$([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToLowerInvariant)</BuildArch>
</PropertyGroup>
<PropertyGroup Condition="'$(BuildArch)' != 'x86'">
<DotNetInstallRoot>$(RepoRoot).dotnet-test\</DotNetInstallRoot>
<RegistryRoot>HKEY_LOCAL_MACHINE\SOFTWARE</RegistryRoot>
</PropertyGroup>
<PropertyGroup Condition="'$(BuildArch)' == 'x86'">
<DotNetInstallRoot>$(RepoRoot).dotnet-test\x86\</DotNetInstallRoot>
<RegistryRoot>HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node</RegistryRoot>
</PropertyGroup>
<PropertyGroup>
<CommonInstallArgs>-NoPath -SkipNonVersionedFiles -Architecture $(BuildArch) -InstallDir $(DotNetInstallRoot)</CommonInstallArgs>
<DotNetInstallDir>$([MSBuild]::NormalizeDirectory('$(DotNetInstallRoot)', 'shared', 'Microsoft.NETCore.App', '$(MicrosoftNETCoreAppRuntimewinx64Version)'))</DotNetInstallDir>
<TestConfigFileName>$(DotNetInstallRoot)Debugger.Tests.Versions.txt</TestConfigFileName>
</PropertyGroup>
<Choose>
<When Condition="$([MSBuild]::IsOsPlatform(Windows))">
<PropertyGroup>
<PowershellWrapper>powershell -NonInteractive -ExecutionPolicy ByPass -NoProfile -command</PowershellWrapper>
<DotnetInstallScriptCmd>'$(RepositoryEngineeringDir)\dotnet-install.ps1'</DotnetInstallScriptCmd>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<DotnetInstallScriptCmd>$(RepositoryEngineeringDir)/dotnet-install.sh</DotnetInstallScriptCmd>
</PropertyGroup>
</Otherwise>
</Choose>
<!--
Installs the runtimes for the SOS tests, handles private runtime build support or cleans up the private build registry keys
-->
<Target Name="InstallTestRuntimes"
DependsOnTargets="CleanupVersionManifest;InstallRuntimesWindows;InstallRuntimesUnix;WriteTestVersionManifest;" />
<!--
Installs the test runtimes on Windows
-->
<Target Name="InstallRuntimesWindows"
Condition="$([MSBuild]::IsOsPlatform(Windows))"
Inputs="$(VersionsPropsPath)" Outputs="$(TestConfigFileName)">
<Exec Command="$(PowershellWrapper) "& { &$(DotnetInstallScriptCmd) $(CommonInstallArgs) -Version $(MicrosoftNetSdkVersion) }""
IgnoreStandardErrorWarningFormat="true" />
<Exec Command="$(PowershellWrapper) "& { &$(DotnetInstallScriptCmd) $(CommonInstallArgs) %(RuntimeTestVersions.ExtraInstallArgs) -Version %(RuntimeTestVersions.RuntimeDownload) -Runtime dotnet }""
IgnoreStandardErrorWarningFormat="true" Condition="'%(RuntimeTestVersions.RuntimeDownload)' != ''" />
<Exec Command="$(PowershellWrapper) "& { &$(DotnetInstallScriptCmd) $(CommonInstallArgs) %(RuntimeTestVersions.ExtraInstallArgs) -Version %(RuntimeTestVersions.AspNetDownload) -Runtime aspnetcore }""
IgnoreStandardErrorWarningFormat="true" Condition="'%(RuntimeTestVersions.AspNetDownload)' != ''" />
</Target>
<!--
Installs the test runtimes on Linux/MacOS
-->
<Target Name="InstallRuntimesUnix"
Condition="!$([MSBuild]::IsOsPlatform(Windows))"
Inputs="$(VersionsPropsPath)" Outputs="$(TestConfigFileName)">
<Exec Command="bash $(DotnetInstallScriptCmd) $(CommonInstallArgs) -Version $(MicrosoftNetSdkVersion)"
IgnoreStandardErrorWarningFormat="true" />
<Exec Command="bash $(DotnetInstallScriptCmd) $(CommonInstallArgs) %(RuntimeTestVersions.ExtraInstallArgs) -Version %(RuntimeTestVersions.RuntimeDownload) -Runtime dotnet"
IgnoreStandardErrorWarningFormat="true"
Condition="'%(RuntimeTestVersions.RuntimeDownload)' != ''" />
<Exec Command="bash $(DotnetInstallScriptCmd) $(CommonInstallArgs) %(RuntimeTestVersions.ExtraInstallArgs) -Version %(RuntimeTestVersions.AspNetDownload) -Runtime aspnetcore"
IgnoreStandardErrorWarningFormat="true"
Condition="'%(RuntimeTestVersions.AspNetDownload)' != ''" />
</Target>
<!--
Writes the Debugger.Tests.Versions.txt file used by the SOS test harness
-->
<Target Name="WriteTestVersionManifest"
Inputs="$(VersionsPropsPath)"
Outputs="$(TestConfigFileName)">
<ItemGroup>
<TestConfigFileLines Include="Header">
<ConfigFileEntry>
<![CDATA[
<Configuration>
<InternalReleaseTesting>$(InternalReleaseTesting)</InternalReleaseTesting>
<PrivateBuildTesting>$(PrivateBuildTesting)</PrivateBuildTesting>
]]>
</ConfigFileEntry>
</TestConfigFileLines>
<TestConfigFileLines Include="@(RuntimeTestVersions)">
<ConfigFileEntry>
<![CDATA[
<RuntimeVersion%(RuntimeTestVersions.Identity)>%(RuntimeTestVersions.Runtime)</RuntimeVersion%(RuntimeTestVersions.Identity)>
<AspNetCoreVersion%(RuntimeTestVersions.Identity)>%(RuntimeTestVersions.AspNet)</AspNetCoreVersion%(RuntimeTestVersions.Identity)>
<TargetFramework%(RuntimeTestVersions.Identity)>%(RuntimeTestVersions.TargetFramework)</TargetFramework%(RuntimeTestVersions.Identity)>
]]>
</ConfigFileEntry>
</TestConfigFileLines>
<TestConfigFileLines Include="End">
<ConfigFileEntry>
<![CDATA[
</Configuration>
]]>
</ConfigFileEntry>
</TestConfigFileLines>
</ItemGroup>
<WriteLinesToFile File="$(TestConfigFileName)" Lines="@(TestConfigFileLines->Metadata('ConfigFileEntry'))" Overwrite="true" WriteOnlyWhenDifferent="true" />
<Message Importance="High" Text="Created config file $(TestConfigFileName)" />
<ItemGroup>
<FileWrites Include="$(TestConfigFileName)" />
</ItemGroup>
</Target>
<!--
Removes the test config file if internal service release or private build testing
-->
<Target Name="CleanupVersionManifest"
Condition="$(InternalReleaseTesting) or $(PrivateBuildTesting)">
<!-- Make sure the config file gets regenerated in the WriteTestVersionManifest target -->
<Delete Files="$(TestConfigFileName)" />
</Target>
</Project>