@@ -96,24 +96,9 @@ partial class Build
96
96
[ LazyPathExecutable ( name : "otool" ) ] readonly Lazy < Tool > OTool ;
97
97
[ LazyPathExecutable ( name : "lipo" ) ] readonly Lazy < Tool > Lipo ;
98
98
99
- TargetPlatform [ ] ArchitecturesForPlatformForTracer
100
- => ( TargetPlatform , PlatformRequirement ) switch
101
- {
102
- ( _, PlatformRequirement . Single ) => new [ ] { TargetPlatform } ,
103
- ( TargetPlatform . x64 , PlatformRequirement . ForceWindowsArm64 ) => new [ ] { TargetPlatform . x64 , TargetPlatform . x86 , TargetPlatform . arm64ec } ,
104
- ( TargetPlatform . x64 , PlatformRequirement . Default ) => new [ ] { TargetPlatform . x64 , TargetPlatform . x86 } ,
105
- ( TargetPlatform . arm64 , _ ) => new [ ] { TargetPlatform . x64 , TargetPlatform . x86 , TargetPlatform . arm64ec } ,
106
- ( TargetPlatform . x86 , _ ) => new [ ] { TargetPlatform . x86 } ,
107
- _ => new [ ] { TargetPlatform } ,
108
- } ;
99
+ TargetPlatform [ ] ArchitecturesForPlatformForTracer => Architectures ( supportsWindowsArm64 : true ) ;
109
100
110
- TargetPlatform [ ] ArchitecturesForPlatformForProfiler
111
- => TargetPlatform switch
112
- {
113
- TargetPlatform . x64 => new [ ] { TargetPlatform . x64 , TargetPlatform . x86 } ,
114
- TargetPlatform . x86 => new [ ] { TargetPlatform . x86 } ,
115
- _ => new [ ] { TargetPlatform } ,
116
- } ;
101
+ TargetPlatform [ ] ArchitecturesForPlatformForProfiler => Architectures ( supportsWindowsArm64 : false ) ;
117
102
118
103
bool IsArm64 => RuntimeInformation . ProcessArchitecture == Architecture . Arm64 ;
119
104
string UnixArchitectureIdentifier => IsArm64 ? "arm64" : TargetPlatform . ToString ( ) ;
@@ -343,11 +328,8 @@ TargetPlatform[] ArchitecturesForPlatformForProfiler
343
328
. OnlyWhenStatic ( ( ) => IsWin )
344
329
. Executes ( ( ) =>
345
330
{
346
- // If we're building for x64, build for x86 too
347
- var platforms =
348
- Equals ( TargetPlatform , MSBuildTargetPlatform . x64 )
349
- ? new [ ] { MSBuildTargetPlatform . x64 , MSBuildTargetPlatform . x86 }
350
- : new [ ] { MSBuildTargetPlatform . x86 } ;
331
+ // Tests don't support arm64 on Windows
332
+ var platforms = Architectures ( supportsWindowsArm64 : false ) ;
351
333
352
334
// Can't use dotnet msbuild, as needs to use the VS version of MSBuild
353
335
MSBuild ( s => s
@@ -2274,4 +2256,15 @@ private void DotnetBuild(
2274
2256
. SetProcessArgumentConfigurator ( arg => arg . Add ( "/nowarn:NU1701" ) ) //nowarn:NU1701 - Package 'x' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'.
2275
2257
. CombineWith ( projPaths , ( settings , projPath ) => settings . SetProjectFile ( projPath ) ) ) ;
2276
2258
}
2259
+
2260
+ TargetPlatform [ ] Architectures ( bool supportsWindowsArm64 )
2261
+ => ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) , TargetPlatform , PlatformRequirement , supportsArm64 : supportsWindowsArm64 ) switch
2262
+ {
2263
+ ( true , TargetPlatform . arm64 or TargetPlatform . arm64ec , PlatformRequirement . Single , false ) => throw new Exception ( $ "Requested { TargetPlatform } platform build on Windows, but ARM64 is not supported") ,
2264
+ ( _, _, PlatformRequirement . Single , _) => new [ ] { TargetPlatform } ,
2265
+ ( true , TargetPlatform . x64 , PlatformRequirement . ForceWindowsArm64 , true ) => new [ ] { TargetPlatform . x64 , TargetPlatform . x86 , TargetPlatform . arm64ec } ,
2266
+ ( _, TargetPlatform . x64 , PlatformRequirement . ForceWindowsArm64 or PlatformRequirement . Default , _) => new [ ] { TargetPlatform . x64 , TargetPlatform . x86 } ,
2267
+ ( false , TargetPlatform . arm64 , _ , _ ) => new [ ] { TargetPlatform . x64 , TargetPlatform . x86 , TargetPlatform . arm64ec } ,
2268
+ _ => new [ ] { TargetPlatform } ,
2269
+ } ;
2277
2270
}
0 commit comments