Skip to content

Commit d223099

Browse files
committed
Separate debuggee/tracee build from product build
- Install runtimes from dirs/test.proj and remove installation from the main build script. - Move debuggee and tracee projects out of the main build traversal into a new Debuggees.proj that is built using the test SDK in artifacts instead of the global.json one that's pulled by arcade.
1 parent bc1b058 commit d223099

9 files changed

Lines changed: 73 additions & 54 deletions

File tree

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
<NetCoreAppMinVersion>8.0</NetCoreAppMinVersion>
7070
<NetCoreAppMinTargetFramework>net$(NetCoreAppMinVersion)</NetCoreAppMinTargetFramework>
7171
<!-- This is the list of TFMs we build our debuggees and tracees as. -->
72-
<SupportedSubProcessTargetFrameworks>net8.0;net9.0;net10.0</SupportedSubProcessTargetFrameworks>
72+
<SupportedSubProcessTargetFrameworks>net8.0;net9.0;net10.0;net11.0</SupportedSubProcessTargetFrameworks>
7373
<!-- This is the list of TFMs we build our unit tests as. -->
7474
<SupportedXUnitTestTargetFrameworks>net8.0</SupportedXUnitTestTargetFrameworks>
7575
</PropertyGroup>

NuGet.config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
<!-- Begin: Package sources from dotnet-runtime -->
1515
<!-- End: Package sources from dotnet-runtime -->
1616
<!--End: Package sources managed by Dependency Flow automation. Do not edit the sources above.-->
17+
<add key="dotnet11" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet11/nuget/v3/index.json" />
18+
<add key="dotnet11-transport" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet11-transport/nuget/v3/index.json" />
1719
<add key="dotnet10" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet10/nuget/v3/index.json" />
1820
<add key="dotnet10-transport" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet10-transport/nuget/v3/index.json" />
1921
<add key="dotnet9" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet9/nuget/v3/index.json" />

eng/Version.Details.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ This file should be imported by eng/Versions.props
2323
<MicrosoftCodeAnalysisAnalyzersPackageVersion>5.0.0-2.25603.103</MicrosoftCodeAnalysisAnalyzersPackageVersion>
2424
<MicrosoftCodeAnalysisCSharpPackageVersion>5.0.0-2.25603.103</MicrosoftCodeAnalysisCSharpPackageVersion>
2525
<MicrosoftCodeAnalysisNetAnalyzersPackageVersion>10.0.102</MicrosoftCodeAnalysisNetAnalyzersPackageVersion>
26-
<MicrosoftNETSdkPackageVersion>10.0.102-servicing.25603.103</MicrosoftNETSdkPackageVersion>
26+
<MicrosoftNETSdkPackageVersion>11.0.100-preview.2.26159.112</MicrosoftNETSdkPackageVersion>
2727
<MicrosoftNETCoreAppRefPackageVersion>10.0.2</MicrosoftNETCoreAppRefPackageVersion>
2828
<MicrosoftNETCorePlatformsPackageVersion>10.0.2-servicing.25603.103</MicrosoftNETCorePlatformsPackageVersion>
2929
<runtimelinuxarm64MicrosoftDotNetCdacTransportPackageVersion>10.0.2-servicing.25603.103</runtimelinuxarm64MicrosoftDotNetCdacTransportPackageVersion>

eng/build.ps1

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ Param(
44
[ValidateSet("Debug","Release")][string][Alias('c')] $configuration = "Debug",
55
[string][Alias('v')] $verbosity = "minimal",
66
[switch][Alias('t')] $test,
7-
[switch] $installruntimes,
87
[switch] $privatebuild,
98
[switch] $ci,
109
[switch][Alias('bl')]$binaryLog,
@@ -68,30 +67,17 @@ if (-not $skipnative) {
6867
}
6968

7069
# Install sdk for building, restore and build managed components.
70+
# Runtime installation and debuggee building is handled by src/tests/dirs.proj targets.
7171
if (-not $skipmanaged) {
72-
Invoke-Expression "& `"$engroot\common\build.ps1`" -configuration $configuration -verbosity $verbosity $bl /p:TargetOS=$os /p:TargetArch=$architecture /p:TestArchitectures=$architecture $remainingargs"
73-
74-
if ($lastExitCode -ne 0) {
75-
exit $lastExitCode
76-
}
77-
}
78-
79-
if ($installruntimes -or $privatebuild) {
8072
$privatebuildtesting = "false"
8173
if ($privatebuild) {
8274
$privatebuildtesting = "true"
8375
}
84-
Remove-Item -Force -Recurse -ErrorAction SilentlyContinue "$reporoot\.dotnet-test"
85-
& "$engroot\common\msbuild.ps1" `
86-
$engroot\InstallRuntimes.proj `
87-
-verbosity $verbosity `
88-
/t:InstallTestRuntimes `
89-
/bl:$logdir\InstallRuntimes.binlog `
90-
/p:PrivateBuildTesting=$privatebuildtesting `
91-
/p:TargetOS=$os `
92-
/p:TargetArch=$architecture `
93-
/p:TestArchitectures=$architecture `
94-
/p:LiveRuntimeDir="$liveRuntimeDir"
76+
Invoke-Expression "& `"$engroot\common\build.ps1`" -configuration $configuration -verbosity $verbosity $bl /p:TargetOS=$os /p:TargetArch=$architecture /p:TestArchitectures=$architecture /p:PrivateBuildTesting=$privatebuildtesting /p:LiveRuntimeDir=`"$liveRuntimeDir`" $remainingargs"
77+
78+
if ($lastExitCode -ne 0) {
79+
exit $lastExitCode
80+
}
9581
}
9682

9783
# Run the xunit tests

eng/build.sh

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ __RuntimeSourceFeed=
2626
__RuntimeSourceFeedKey=
2727
__SkipConfigure=0
2828
__SkipGenerateVersion=0
29-
__InstallRuntimes=0
3029
__PrivateBuild=0
3130
__Test=0
3231
__TestFilter=
@@ -96,10 +95,6 @@ handle_arguments() {
9695
__NativeBuild=0
9796
;;
9897

99-
installruntimes|-installruntimes)
100-
__InstallRuntimes=1
101-
;;
102-
10398
privatebuild|-privatebuild)
10499
__PrivateBuild=1
105100
;;
@@ -230,12 +225,20 @@ fi
230225

231226
if [[ "$__ManagedBuild" == 1 ]]; then
232227

228+
__privateBuildTesting=false
229+
if [[ "$__PrivateBuild" == 1 ]]; then
230+
__privateBuildTesting=true
231+
fi
232+
233233
# __CommonMSBuildArgs contains TargetOS property
234+
# Runtime installation and debuggee building is handled by src/tests/dirs.proj targets.
234235
echo "Commencing managed build for $__BuildType in $__RootBinDir/bin"
235236
"$__RepoRootDir/eng/common/build.sh" \
236237
--configuration "$__BuildType" \
237238
/p:TargetArch="$__TargetArch" \
238239
/p:TargetRid="$__TargetRid" \
240+
/p:PrivateBuildTesting="$__privateBuildTesting" \
241+
/p:LiveRuntimeDir="$__LiveRuntimeDir" \
239242
$__CommonMSBuildArgs \
240243
$__ManagedBuildArgs \
241244
$__UnprocessedBuildArgs
@@ -245,28 +248,6 @@ if [[ "$__ManagedBuild" == 1 ]]; then
245248
fi
246249
fi
247250

248-
#
249-
# Install test runtimes and set up for private runtime build
250-
#
251-
252-
if [[ "$__InstallRuntimes" == 1 || "$__PrivateBuild" == 1 ]]; then
253-
__privateBuildTesting=false
254-
if [[ "$__PrivateBuild" == 1 ]]; then
255-
__privateBuildTesting=true
256-
fi
257-
rm -fr "$__RepoRootDir/.dotnet-test" || true
258-
"$__RepoRootDir/eng/common/msbuild.sh" \
259-
$__RepoRootDir/eng/InstallRuntimes.proj \
260-
/t:InstallTestRuntimes \
261-
/bl:"$__LogsDir/InstallRuntimes.binlog" \
262-
/p:PrivateBuildTesting="$__privateBuildTesting" \
263-
/p:TargetOS="$__TargetOS" \
264-
/p:TargetArch="$__TargetArch" \
265-
/p:TargetRid="$__TargetRid" \
266-
/p:TestArchitectures="$__TargetArch" \
267-
/p:LiveRuntimeDir="$__LiveRuntimeDir"
268-
fi
269-
270251
#
271252
# Run xunit tests
272253
#

eng/installruntimes.cmd

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
@echo off
2-
powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0build.ps1""" -installruntimes -skipmanaged -skipnative %*"
2+
setlocal
3+
4+
set engroot=%~dp0
5+
set reporoot=%engroot%..
6+
7+
powershell -ExecutionPolicy ByPass -NoProfile -command "& ""%engroot%common\msbuild.ps1"" %engroot%InstallRuntimes.proj /t:InstallTestRuntimes %*"
38
exit /b %ErrorLevel%

eng/installruntimes.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ while [[ -h $source ]]; do
1313
done
1414

1515
scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
16-
"$scriptroot/../eng/build.sh" -installruntimes -skipmanaged -skipnative $@
16+
"$scriptroot/common/msbuild.sh" "$scriptroot/InstallRuntimes.proj" /t:InstallTestRuntimes $@
1717

src/tests/Debuggees.proj

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<Project Sdk="Microsoft.Build.Traversal">
2+
3+
<!-- Debuggee and tracee projects, built using the test SDK from artifacts/dotnet-test/ -->
4+
<ItemGroup>
5+
<ProjectReference Include="SOS.UnitTests/Debuggees/**/*.csproj" />
6+
<ProjectReference Include="CommonTestRunner/Debuggees/**/*.csproj" />
7+
<ProjectReference Include="DbgShim.UnitTests/Debuggees/**/*.csproj" />
8+
</ItemGroup>
9+
10+
</Project>

src/tests/dirs.proj

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
<Project Sdk="Microsoft.Build.Traversal">
22
<ItemGroup>
3-
<!-- Debuggees -->
4-
<ProjectReference Include="*/Debuggees/**/*.csproj" />
5-
63
<!-- Tests and Helpers -->
74
<ProjectReference Include="*/*.csproj" />
85

@@ -17,4 +14,42 @@
1714
<!-- Unused -->
1815
<ProjectReference Remove="Grape/Grape.csproj" />
1916
</ItemGroup>
17+
18+
<!--
19+
Install test runtimes and build debuggees using the test SDK.
20+
Debuggees are built separately because they may target TFMs newer
21+
than what the global.json (product) SDK supports.
22+
-->
23+
24+
<PropertyGroup>
25+
<TestDotNetPath>$([MSBuild]::NormalizePath('$(ArtifactsDotnetTestDir)', 'dotnet'))</TestDotNetPath>
26+
</PropertyGroup>
27+
28+
<Target Name="InstallTestRuntimes"
29+
AfterTargets="Build"
30+
Condition="'$(SkipTests)' != 'true'">
31+
<MSBuild Projects="$(RepositoryEngineeringDir)InstallRuntimes.proj"
32+
Targets="InstallTestRuntimes"
33+
Properties="TargetArch=$(TargetArch);TargetOS=$(TargetOS);TestArchitectures=$(TargetArch);PrivateBuildTesting=$(PrivateBuildTesting);LiveRuntimeDir=$(LiveRuntimeDir)" />
34+
</Target>
35+
36+
<Target Name="BuildDebuggees"
37+
AfterTargets="Build"
38+
DependsOnTargets="InstallTestRuntimes"
39+
Condition="'$(SkipTests)' != 'true'">
40+
<PropertyGroup>
41+
<_TestSdkVersionDir>$([MSBuild]::NormalizePath('$(ArtifactsDotnetTestDir)', 'sdk', '$(MicrosoftNETSdkVersion)'))</_TestSdkVersionDir>
42+
</PropertyGroup>
43+
<ItemGroup>
44+
<DebuggeeBuildEnv Include="DOTNET_ROOT=$(ArtifactsDotnetTestDir.TrimEnd('\/'))" />
45+
<DebuggeeBuildEnv Include="DOTNET_MSBUILD_SDK_RESOLVER_CLI_DIR=$(ArtifactsDotnetTestDir.TrimEnd('\/'))" />
46+
<DebuggeeBuildEnv Include="DOTNET_HOST_PATH=$(TestDotNetPath)" />
47+
<DebuggeeBuildEnv Include="DOTNET_INSTALL_DIR=$(ArtifactsDotnetTestDir.TrimEnd('\/'))" />
48+
<!-- Override inherited MSBuild env vars that point to the build SDK -->
49+
<DebuggeeBuildEnv Include="MSBuildSDKsPath=$(_TestSdkVersionDir)$([System.IO.Path]::DirectorySeparatorChar)Sdks" />
50+
<DebuggeeBuildEnv Include="MSBuildExtensionsPath=$(_TestSdkVersionDir)" />
51+
</ItemGroup>
52+
<Exec Command="$(TestDotNetPath) build $(MSBuildThisFileDirectory)Debuggees.proj -c $(Configuration) -bl:$(ArtifactsLogDir)Debuggees.binlog /p:TargetOS=$(TargetOS) /p:TargetArch=$(TargetArch) /p:RepoRoot=$(RepoRoot)"
53+
EnvironmentVariables="@(DebuggeeBuildEnv)" />
54+
</Target>
2055
</Project>

0 commit comments

Comments
 (0)