Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .azure-pipelines/ultimate-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,35 @@ stages:
displayName: Upload working directory after the managed build
artifact: build-windows-working-directory

- stage: build_windows_tracer_arm64x
dependsOn: [merge_commit_id]
variables:
targetShaId: $[ stageDependencies.merge_commit_id.fetch.outputs['set_sha.sha']]
targetBranch: $[ stageDependencies.merge_commit_id.fetch.outputs['set_sha.branch']]
jobs:
- template: steps/update-github-status-jobs.yml
parameters:
jobs: [build]

- job: build
timeoutInMinutes: 60 #default value
pool:
name: azure-windows-scale-set # This VMSS has the Arm64 tools installed
steps:
- template: steps/clone-repo.yml
parameters:
targetShaId: $(targetShaId)
targetBranch: $(targetBranch)
- template: steps/install-latest-dotnet-sdk.yml

- script: tracer\build.cmd BuildTracerHome BuildNativeLoader -targetPlatform "arm64ec" -PlatformRequirement Single
displayName: Build arm64ec tracer home
retryCountOnTaskFailure: 1

- publish: $(monitoringHome)
displayName: Upload Windows tracer home directory
artifact: windows-tracer-home-arm64ec

- stage: build_windows_profiler
dependsOn: [merge_commit_id]
variables:
Expand Down Expand Up @@ -4737,6 +4766,7 @@ stages:
)
dependsOn:
- merge_commit_id
- build_windows_tracer_arm64x
- unit_tests_linux
- unit_tests_macos
- unit_tests_windows
Expand Down
31 changes: 11 additions & 20 deletions tracer/build/_build/Build.Profiler.Steps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,7 @@ partial class Build
.SetPackagesDirectory(nugetPackageRestoreDirectory));

// If we're building for x64, build for x86 too
var platforms =
Equals(TargetPlatform, MSBuildTargetPlatform.x64)
? new[] { MSBuildTargetPlatform.x64, MSBuildTargetPlatform.x86 }
: new[] { MSBuildTargetPlatform.x86 };
var platforms = ArchitecturesForPlatformForProfiler;

// Can't use dotnet msbuild, as needs to use the VS version of MSBuild
// Build native profiler assets
Expand Down Expand Up @@ -89,7 +86,7 @@ partial class Build
.After(CompileProfilerNativeSrcAndTestLinux)
.Executes(() =>
{
RunProfilerUnitTests(Configuration.Release, MSBuildTargetPlatform.x64, SanitizerKind.None);
RunProfilerUnitTests(Configuration.Release, TargetPlatform.x64, SanitizerKind.None);
});

Target CompileProfilerNativeTestsWindows => _ => _
Expand All @@ -99,10 +96,7 @@ partial class Build
.Executes(() =>
{
// If we're building for x64, build for x86 too
var platforms =
Equals(TargetPlatform, MSBuildTargetPlatform.x64)
? new[] { MSBuildTargetPlatform.x64, MSBuildTargetPlatform.x86 }
: new[] { MSBuildTargetPlatform.x86 };
var platforms = ArchitecturesForPlatformForProfiler;

var testProjects = ProfilerDirectory.GlobFiles("test/**/*.vcxproj");
NuGetTasks.NuGetRestore(s => s
Expand Down Expand Up @@ -453,7 +447,7 @@ void RunCppCheck(string projectName, MSBuildTargetPlatform platform)
.OnlyWhenStatic(() => IsLinux)
.Executes(() =>
{
RunProfilerUnitTests(Configuration.Release, MSBuildTargetPlatform.x64, SanitizerKind.Asan);
RunProfilerUnitTests(Configuration.Release, TargetPlatform.x64, SanitizerKind.Asan);
});

Target CompileProfilerWithAsanWindows => _ => _
Expand Down Expand Up @@ -495,7 +489,7 @@ void RunCppCheck(string projectName, MSBuildTargetPlatform platform)
.OnlyWhenStatic(() => IsWin)
.Executes(() =>
{
foreach (var platform in new[] { MSBuildTargetPlatform.x64, MSBuildTargetPlatform.x86 })
foreach (var platform in ArchitecturesForPlatformForProfiler)
{
RunProfilerUnitTests(Configuration.Release, platform);
}
Expand All @@ -512,10 +506,7 @@ void RunCppCheck(string projectName, MSBuildTargetPlatform platform)
.Triggers(CheckTestResultForProfilerWithSanitizer)
.Executes(() =>
{
var platforms =
IsWin
? new[] { MSBuildTargetPlatform.x64, MSBuildTargetPlatform.x86 }
: new[] { MSBuildTargetPlatform.x64 };
var platforms = ArchitecturesForPlatformForProfiler;

var sampleApp = ProfilerSamplesSolution.GetProject("Samples.Computer01");

Expand Down Expand Up @@ -596,7 +587,7 @@ void RunCppCheck(string projectName, MSBuildTargetPlatform platform)
.OnlyWhenStatic(() => IsLinux)
.Executes(() =>
{
RunProfilerUnitTests(Configuration.Release, MSBuildTargetPlatform.x64, SanitizerKind.Ubsan);
RunProfilerUnitTests(Configuration.Release, TargetPlatform.x64, SanitizerKind.Ubsan);
});

Target RunSampleWithProfilerUbsan => _ => _
Expand All @@ -609,7 +600,7 @@ void RunCppCheck(string projectName, MSBuildTargetPlatform platform)
.Triggers(CheckTestResultForProfilerWithSanitizer)
.Executes(() =>
{
RunSampleWithSanitizer(MSBuildTargetPlatform.x64, SanitizerKind.Ubsan);
RunSampleWithSanitizer(TargetPlatform.x64, SanitizerKind.Ubsan);
});

enum SanitizerKind
Expand All @@ -619,7 +610,7 @@ enum SanitizerKind
Ubsan
};

void RunSampleWithSanitizer(MSBuildTargetPlatform platform, SanitizerKind sanitizer)
void RunSampleWithSanitizer(TargetPlatform platform, SanitizerKind sanitizer)
{
var envVars = new Dictionary<string, string>()
{
Expand Down Expand Up @@ -671,7 +662,7 @@ void RunSampleWithSanitizer(MSBuildTargetPlatform platform, SanitizerKind saniti

DotNet($"{sampleAppDll} --scenario 1 --timeout 120", platform, environmentVariables: envVars);

static IReadOnlyCollection<Output> DotNet(string arguments, MSBuildTargetPlatform platform, string workingDirectory = null, IReadOnlyDictionary<string, string> environmentVariables = null, int? timeout = null, bool? logOutput = null, bool? logInvocation = null, bool? logTimestamp = null, string logFile = null, Func<string, string> outputFilter = null)
static IReadOnlyCollection<Output> DotNet(string arguments, TargetPlatform platform, string workingDirectory = null, IReadOnlyDictionary<string, string> environmentVariables = null, int? timeout = null, bool? logOutput = null, bool? logInvocation = null, bool? logTimestamp = null, string logFile = null, Func<string, string> outputFilter = null)
{
var dotnetPath = DotNetSettingsExtensions.GetDotNetPath(platform);

Expand All @@ -682,7 +673,7 @@ static IReadOnlyCollection<Output> DotNet(string arguments, MSBuildTargetPlatfor
}
}

void RunProfilerUnitTests(Configuration configuration, MSBuildTargetPlatform platform, SanitizerKind sanitizer = SanitizerKind.None)
void RunProfilerUnitTests(Configuration configuration, TargetPlatform platform, SanitizerKind sanitizer = SanitizerKind.None)
{
var intermediateDirPath =
IsWin
Expand Down
7 changes: 2 additions & 5 deletions tracer/build/_build/Build.Shared.Steps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,8 @@ partial class Build
.OnlyWhenStatic(() => IsWin)
.Executes(() =>
{
// If we're building for x64, build for x86 too
var platforms =
Equals(TargetPlatform, MSBuildTargetPlatform.x64)
? new[] { MSBuildTargetPlatform.x64, MSBuildTargetPlatform.x86 }
: new[] { MSBuildTargetPlatform.x86 };
var platforms = ArchitecturesForPlatformForTracer
.Where(x => x != TargetPlatform.arm64ec); // Doesn't support arm64 yet

// Can't use dotnet msbuild, as needs to use the VS version of MSBuild
// Build native profiler assets
Expand Down
65 changes: 16 additions & 49 deletions tracer/build/_build/Build.Steps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,50 +96,9 @@ partial class Build
[LazyPathExecutable(name: "otool")] readonly Lazy<Tool> OTool;
[LazyPathExecutable(name: "lipo")] readonly Lazy<Tool> Lipo;

IEnumerable<MSBuildTargetPlatform> ArchitecturesForPlatformForTracer
{
get
{
if (TargetPlatform == MSBuildTargetPlatform.x64)
{
if (ForceARM64BuildInWindows)
{
return new[] { MSBuildTargetPlatform.x64, MSBuildTargetPlatform.x86, ARM64ECTargetPlatform };
}
else
{
return new[] { MSBuildTargetPlatform.x64, MSBuildTargetPlatform.x86 };
}
}
else if (TargetPlatform == ARM64TargetPlatform)
{
return new[] { MSBuildTargetPlatform.x64, MSBuildTargetPlatform.x86, ARM64ECTargetPlatform };
}
else if (TargetPlatform == MSBuildTargetPlatform.x86)
{
return new[] { MSBuildTargetPlatform.x86 };
}
TargetPlatform[] ArchitecturesForPlatformForTracer => Architectures(supportsWindowsArm64: true);

return new[] { TargetPlatform };
}
}

IEnumerable<MSBuildTargetPlatform> ArchitecturesForPlatformForProfiler
{
get
{
if (TargetPlatform == MSBuildTargetPlatform.x64)
{
return new[] { MSBuildTargetPlatform.x64, MSBuildTargetPlatform.x86 };
}
else if (TargetPlatform == MSBuildTargetPlatform.x86)
{
return new[] { MSBuildTargetPlatform.x86 };
}

return new[] { TargetPlatform };
}
}
TargetPlatform[] ArchitecturesForPlatformForProfiler => Architectures(supportsWindowsArm64: false);

bool IsArm64 => RuntimeInformation.ProcessArchitecture == Architecture.Arm64;
string UnixArchitectureIdentifier => IsArm64 ? "arm64" : TargetPlatform.ToString();
Expand Down Expand Up @@ -369,11 +328,8 @@ IEnumerable<MSBuildTargetPlatform> ArchitecturesForPlatformForProfiler
.OnlyWhenStatic(() => IsWin)
.Executes(() =>
{
// If we're building for x64, build for x86 too
var platforms =
Equals(TargetPlatform, MSBuildTargetPlatform.x64)
? new[] { MSBuildTargetPlatform.x64, MSBuildTargetPlatform.x86 }
: new[] { MSBuildTargetPlatform.x86 };
// Tests don't support arm64 on Windows
var platforms = Architectures(supportsWindowsArm64: false);

// Can't use dotnet msbuild, as needs to use the VS version of MSBuild
MSBuild(s => s
Expand Down Expand Up @@ -1678,7 +1634,7 @@ var name when multiPackageProjects.Contains(name) => false,
true => $"(Category!=LinuxUnsupported)&(Category!=Lambda)&(Category!=AzureFunctions){dockerFilter}{armFilter}",
};

var targetPlatform = IsArm64 ? (MSBuildTargetPlatform) "arm64" : TargetPlatform;
var targetPlatform = IsArm64 ? TargetPlatform.arm64 : TargetPlatform;

try
{
Expand Down Expand Up @@ -2300,4 +2256,15 @@ private void DotnetBuild(
.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'.
.CombineWith(projPaths, (settings, projPath) => settings.SetProjectFile(projPath)));
}

TargetPlatform[] Architectures(bool supportsWindowsArm64)
=> (RuntimeInformation.IsOSPlatform(OSPlatform.Windows), TargetPlatform, PlatformRequirement, supportsArm64: supportsWindowsArm64) switch
{
(true, TargetPlatform.arm64 or TargetPlatform.arm64ec, PlatformRequirement.Single, false) => throw new Exception($"Requested {TargetPlatform} platform build on Windows, but ARM64 is not supported"),
(_, _, PlatformRequirement.Single, _) => new[] { TargetPlatform },
(true, TargetPlatform.x64, PlatformRequirement.ForceWindowsArm64, true) => new[] { TargetPlatform.x64, TargetPlatform.x86, TargetPlatform.arm64ec },
(_, TargetPlatform.x64, PlatformRequirement.ForceWindowsArm64 or PlatformRequirement.Default, _) => new[] { TargetPlatform.x64, TargetPlatform.x86},
(false, TargetPlatform.arm64, _, _) => new[] { TargetPlatform.x64, TargetPlatform.x86, TargetPlatform.arm64ec },
_ => new[] { TargetPlatform },
};
}
21 changes: 0 additions & 21 deletions tracer/build/_build/Build.Utilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ partial class Build
[Parameter("Additional environment variables, in the format KEY1=Value1 Key2=Value2 to use when running the IIS Sample")]
readonly string[] ExtraEnvVars;

[Parameter("Force ARM64 build in Windows")]
readonly bool ForceARM64BuildInWindows;

[LazyLocalExecutable(@"C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\gacutil.exe")]
readonly Lazy<Tool> GacUtil;
[LazyLocalExecutable(@"C:\Program Files\IIS Express\iisexpress.exe")]
Expand Down Expand Up @@ -353,22 +350,4 @@ private void ReplaceReceivedFilesInSnapshots()
MoveFile(source, dest, FileExistsPolicy.Overwrite, createDirectories: true);
}
}

private static MSBuildTargetPlatform GetDefaultTargetPlatform()
{
if (RuntimeInformation.ProcessArchitecture == Architecture.Arm64)
{
return ARM64TargetPlatform;
}

if (RuntimeInformation.OSArchitecture == Architecture.X86)
{
return MSBuildTargetPlatform.x86;
}

return MSBuildTargetPlatform.x64;
}

private static MSBuildTargetPlatform ARM64TargetPlatform = (MSBuildTargetPlatform)"ARM64";
private static MSBuildTargetPlatform ARM64ECTargetPlatform = (MSBuildTargetPlatform)"ARM64EC";
}
14 changes: 12 additions & 2 deletions tracer/build/_build/Build.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using Nuke.Common;
using Nuke.Common.CI;
using Nuke.Common.IO;
Expand Down Expand Up @@ -31,7 +32,15 @@ partial class Build : NukeBuild
readonly Configuration BuildConfiguration = Configuration.Release;

[Parameter("Platform to build - x86, x64, ARM64. Defaults to the current platform.")]
readonly MSBuildTargetPlatform TargetPlatform = GetDefaultTargetPlatform();
readonly TargetPlatform TargetPlatform = (RuntimeInformation.ProcessArchitecture, RuntimeInformation.OSArchitecture) switch
{
(Architecture.Arm64, _) => TargetPlatform.arm64,
(_, Architecture.X86) => TargetPlatform.x86,
_ => TargetPlatform.x64,
};

[Parameter("Whether to build dependent platforms, e.g. x86 or ARM64EC on an x64 machine.")]
readonly PlatformRequirement PlatformRequirement = PlatformRequirement.Default;

[Parameter("The TargetFramework to execute when running or building a sample app, or linux integration tests")]
readonly TargetFramework Framework;
Expand Down Expand Up @@ -92,7 +101,8 @@ partial class Build : NukeBuild
.Executes(() =>
{
Logger.Info($"Configuration: {BuildConfiguration}");
Logger.Info($"Platform: {TargetPlatform}");
Logger.Info($"TargetPlatform: {TargetPlatform}");
Logger.Info($"PlatformRequirement: {PlatformRequirement}");
Logger.Info($"Framework: {Framework}");
Logger.Info($"TestAllPackageVersions: {TestAllPackageVersions}");
Logger.Info($"MonitoringHomeDirectory: {MonitoringHomeDirectory}");
Expand Down
Loading