Skip to content

Commit c2ee23a

Browse files
committed
Try fix some stuff
1 parent 8c6b3f0 commit c2ee23a

File tree

1 file changed

+15
-22
lines changed

1 file changed

+15
-22
lines changed

tracer/build/_build/Build.Steps.cs

+15-22
Original file line numberDiff line numberDiff line change
@@ -96,24 +96,9 @@ partial class Build
9696
[LazyPathExecutable(name: "otool")] readonly Lazy<Tool> OTool;
9797
[LazyPathExecutable(name: "lipo")] readonly Lazy<Tool> Lipo;
9898

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);
109100

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);
117102

118103
bool IsArm64 => RuntimeInformation.ProcessArchitecture == Architecture.Arm64;
119104
string UnixArchitectureIdentifier => IsArm64 ? "arm64" : TargetPlatform.ToString();
@@ -343,11 +328,8 @@ TargetPlatform[] ArchitecturesForPlatformForProfiler
343328
.OnlyWhenStatic(() => IsWin)
344329
.Executes(() =>
345330
{
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);
351333

352334
// Can't use dotnet msbuild, as needs to use the VS version of MSBuild
353335
MSBuild(s => s
@@ -2274,4 +2256,15 @@ private void DotnetBuild(
22742256
.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'.
22752257
.CombineWith(projPaths, (settings, projPath) => settings.SetProjectFile(projPath)));
22762258
}
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+
};
22772270
}

0 commit comments

Comments
 (0)