Skip to content

Commit

Permalink
Separate the windows cpu architectures into jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
mattleibow committed Oct 31, 2019
1 parent 7bfb0bf commit 4e7fe1c
Show file tree
Hide file tree
Showing 5 changed files with 127 additions and 24 deletions.
14 changes: 8 additions & 6 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,16 @@ using NuGet.Versioning;

#load "cake/Utils.cake"

var TARGET = Argument ("t", Argument ("target", Argument ("Target", "Default")));
var VERBOSITY = Argument ("v", Argument ("verbosity", Argument ("Verbosity", Verbosity.Normal)));
var SKIP_EXTERNALS = Argument ("skipexternals", Argument ("SkipExternals", "")).ToLower ().Split (',');
var PACK_ALL_PLATFORMS = Argument ("packall", Argument ("PackAll", Argument ("PackAllPlatforms", TARGET.ToLower() == "ci" || TARGET.ToLower() == "nuget-only")));
var TARGET = Argument ("t", Argument ("target", "Default"));
var VERBOSITY = Argument ("v", Argument ("verbosity", Verbosity.Normal));
var BUILD_ARCH = Argument ("buildarch", EnvironmentVariable ("BUILD_ARCH") ?? "").ToLower ().Split (',');
var SKIP_EXTERNALS = Argument ("skipexternals", "").ToLower ().Split (',');
var PACK_ALL_PLATFORMS = Argument ("packall", Argument ("PackAllPlatforms", false));
var PRINT_ALL_ENV_VARS = Argument ("printAllEnvVars", false);
var AZURE_BUILD_ID = Argument ("azureBuildId", "");
var UNSUPPORTED_TESTS = Argument ("unsupportedTests", "");
var ADDITIONAL_GN_ARGS = Argument ("additionalGnArgs", "");
var CONFIGURATION = Argument ("c", Argument ("configuration", Argument ("Configuration", "Release")));
var CONFIGURATION = Argument ("c", Argument ("configuration", "Release"));

var NuGetSources = new [] { MakeAbsolute (Directory ("./output/nugets")).FullPath, "https://api.nuget.org/v3/index.json" };
var NuGetToolPath = Context.Tools.Resolve ("nuget.exe");
Expand Down Expand Up @@ -520,6 +521,7 @@ Information ("Arguments:");
Information (" Target: {0}", TARGET);
Information (" Verbosity: {0}", VERBOSITY);
Information (" Skip externals: {0}", SKIP_EXTERNALS);
Information (" Build architectures: {0}", BUILD_ARCH);
Information (" Print all environment variables: {0}", PRINT_ALL_ENV_VARS);
Information (" Pack all platforms: {0}", PACK_ALL_PLATFORMS);
Information (" Azure build ID: {0}", AZURE_BUILD_ID);
Expand Down Expand Up @@ -561,7 +563,7 @@ var envVarsWhitelist = new [] {
"os", "build_url", "build_number", "number_of_processors",
"node_label", "build_id", "git_sha", "git_branch_name",
"feature_name", "msbuild_exe", "python_exe", "preview_label",
"home", "userprofile", "nuget_packages",
"home", "userprofile", "nuget_packages", "build_arch",
"android_sdk_root", "android_ndk_root",
"android_home", "android_ndk_home", "tizen_studio_home"
};
Expand Down
48 changes: 40 additions & 8 deletions cake/BuildExternals.cake
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ Task ("externals-windows")
// libSkiaSharp

var buildArch = new Action<string, string, string> ((arch, skiaArch, dir) => {
if (!ShouldBuildArch (arch)) {
Warning ($"Skipping architecture: {arch}.");
return;
}

// generate native skia build files
GnNinja ($"win/{arch}", "SkiaSharp",
$"is_official_build=true skia_enable_tools=false " +
Expand All @@ -115,6 +120,11 @@ Task ("externals-windows")
// libHarfBuzzSharp

var buildHarfBuzzArch = new Action<string, string> ((arch, dir) => {
if (!ShouldBuildArch (arch)) {
Warning ($"Skipping architecture: {arch}.");
return;
}

// build libHarfBuzzSharp
RunMSBuild ("native-builds/libHarfBuzzSharp_windows/libHarfBuzzSharp.sln", platformTarget: arch);

Expand All @@ -141,6 +151,11 @@ Task ("externals-uwp")
// libSkiaSharp

var buildArch = new Action<string, string, string> ((arch, skiaArch, dir) => {
if (!ShouldBuildArch (arch)) {
Warning ($"Skipping architecture: {arch}.");
return;
}

// generate native skia build files
GnNinja ($"winrt/{arch}", "SkiaSharp",
$"is_official_build=true skia_enable_tools=false " +
Expand All @@ -167,6 +182,11 @@ Task ("externals-uwp")
// libHarfBuzzSharp

var buildHarfBuzzArch = new Action<string, string> ((arch, dir) => {
if (!ShouldBuildArch (arch)) {
Warning ($"Skipping architecture: {arch}.");
return;
}

// build libHarfBuzzSharp
RunMSBuild ("native-builds/libHarfBuzzSharp_uwp/libHarfBuzzSharp.sln", platformTarget: arch);

Expand All @@ -185,6 +205,11 @@ Task ("externals-uwp")
// SkiaSharp.Views.Interop.UWP

var buildInteropArch = new Action<string, string> ((arch, dir) => {
if (!ShouldBuildArch (arch)) {
Warning ($"Skipping architecture: {arch}.");
return;
}

// build SkiaSharp.Views.Interop.UWP
RunMSBuild ("source/SkiaSharp.Views.Interop.UWP.sln", platformTarget: arch);

Expand All @@ -198,6 +223,7 @@ Task ("externals-uwp")
buildInteropArch ("Win32", "x86");
buildInteropArch ("x64", "x64");
buildInteropArch ("ARM", "arm");
buildInteropArch ("ARM64", "arm64");

// copy ANGLE externals
EnsureDirectoryExists ("./output/native/uwp/arm/");
Expand Down Expand Up @@ -580,8 +606,6 @@ Task ("externals-linux")
.WithCriteria (IsRunningOnLinux ())
.Does (() =>
{
var arches = EnvironmentVariable ("BUILD_ARCH") ?? (Environment.Is64BitOperatingSystem ? "x64" : "x86"); // x64, x86, ARM
var BUILD_ARCH = arches.Split (',').Select (a => a.Trim ()).ToArray ();
var SUPPORT_GPU = (EnvironmentVariable ("SUPPORT_GPU") ?? "1") == "1"; // 1 == true, 0 == false

var CC = EnvironmentVariable ("CC");
Expand All @@ -595,6 +619,8 @@ Task ("externals-linux")
if (!string.IsNullOrEmpty (AR))
CUSTOM_COMPILERS += $"ar='{AR}' ";

// libSkiaSharp

var buildArch = new Action<string> ((arch) => {
var soname = GetVersion ("libSkiaSharp", "soname");

Expand All @@ -618,6 +644,10 @@ Task ("externals-linux")
CopyFile (libSkiaSharp, $"{outDir}/libSkiaSharp.so");
});

buildArch ("x64");

// libHarfBuzzSharp

var buildHarfBuzzArch = new Action<string> ((arch) => {
// build libHarfBuzzSharp
// RunProcess ("make", new ProcessSettings {
Expand All @@ -636,10 +666,7 @@ Task ("externals-linux")
CopyFile (so, $"output/native/linux/{arch}/libHarfBuzzSharp.so");
});

foreach (var arch in BUILD_ARCH) {
buildArch (arch);
buildHarfBuzzArch (arch);
}
buildHarfBuzzArch ("x64");
});

Task ("externals-tizen")
Expand All @@ -651,6 +678,8 @@ Task ("externals-tizen")
var bat = IsRunningOnWindows () ? ".bat" : "";
var tizen = TIZEN_STUDIO_HOME.CombineWithFilePath ($"tools/ide/bin/tizen{bat}").FullPath;

// libSkiaSharp

var buildArch = new Action<string, string> ((arch, skiaArch) => {
// generate native skia build files
GnNinja ($"tizen/{arch}", "skia",
Expand All @@ -675,6 +704,11 @@ Task ("externals-tizen")
CopyFile (libSkiaSharp, $"{outDir}/libSkiaSharp.so");
});

buildArch ("armel", "arm");
buildArch ("i386", "x86");

// libHarfBuzzSharp

var buildHarfBuzzArch = new Action<string, string> ((arch, skiaArch) => {
// build libHarfBuzzSharp
RunProcess(tizen, new ProcessSettings {
Expand All @@ -689,8 +723,6 @@ Task ("externals-tizen")
CopyFile (so, $"{outDir}/libHarfBuzzSharp.so");
});

buildArch ("armel", "arm");
buildArch ("i386", "x86");
buildHarfBuzzArch ("armel", "arm");
buildHarfBuzzArch ("i386", "x86");
});
Expand Down
35 changes: 34 additions & 1 deletion cake/Utils.cake
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,37 @@ bool ShouldBuildExternal (string platform)
return false;

return true;
}
}

bool ShouldBuildArch (string arch)
{
arch = arch?.ToLower() ?? "";

if (BUILD_ARCH.Contains ("all"))
return true;

switch (arch) {
case "win32":
case "i386":
arch = "x86";
break;
case "x86_64":
arch = "x64";
break;
case "armeabi-v7a":
case "armel":
case "armv7":
case "armv7k":
arch = "arm";
break;
case "arm64_32":
case "arm64-v8a":
arch = "arm64";
break;
}

if (BUILD_ARCH.Contains (arch))
return true;

return false;
}
2 changes: 1 addition & 1 deletion externals/skia
52 changes: 44 additions & 8 deletions scripts/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,48 @@ stages:
vmImage: $(VM_IMAGE_WINDOWS)
target: externals-tizen
condition: false # TODO: TIZEN INSTALL BUGS
- template: azure-templates-bootstrapper.yml # Build Native UWP (Windows)
- template: azure-templates-bootstrapper.yml # Build Native UWP|x86 (Windows)
parameters:
name: native_uwp_windows
displayName: Build Native UWP (Windows)
name: native_uwp_x86_windows
displayName: Build Native UWP|x86 (Windows)
vmImage: $(VM_IMAGE_WINDOWS)
target: externals-uwp
- template: azure-templates-bootstrapper.yml # Build Native Win32 (Windows)
additionalArgs: --buildarch=x86
- template: azure-templates-bootstrapper.yml # Build Native UWP|x64 (Windows)
parameters:
name: native_win32_windows
displayName: Build Native Win32 (Windows)
name: native_uwp_x64_windows
displayName: Build Native UWP|x64 (Windows)
vmImage: $(VM_IMAGE_WINDOWS)
target: externals-uwp
additionalArgs: --buildarch=x64
- template: azure-templates-bootstrapper.yml # Build Native UWP|arm (Windows)
parameters:
name: native_uwp_arm_windows
displayName: Build Native UWP|arm (Windows)
vmImage: $(VM_IMAGE_WINDOWS)
target: externals-uwp
additionalArgs: --buildarch=arm
- template: azure-templates-bootstrapper.yml # Build Native UWP|arm64 (Windows)
parameters:
name: native_uwp_arm64_windows
displayName: Build Native UWP|arm64 (Windows)
vmImage: $(VM_IMAGE_WINDOWS)
target: externals-uwp
additionalArgs: --buildarch=arm64
- template: azure-templates-bootstrapper.yml # Build Native Win32|x86 (Windows)
parameters:
name: native_win32_x86_windows
displayName: Build Native Win32|x86 (Windows)
vmImage: $(VM_IMAGE_WINDOWS)
target: externals-windows
additionalArgs: --buildarch=x86
- template: azure-templates-bootstrapper.yml # Build Native Win32|x64 (Windows)
parameters:
name: native_win32_x64_windows
displayName: Build Native Win32|x64 (Windows)
vmImage: $(VM_IMAGE_WINDOWS)
target: externals-windows
additionalArgs: --buildarch=x64
# NATIVE JOBS - MAC
- template: azure-templates-bootstrapper.yml # Build Native Android (macOS)
parameters:
Expand Down Expand Up @@ -136,8 +166,12 @@ stages:
- native_android_windows
# - native_tizen_windows
- native_tizen_linux
- native_uwp_windows
- native_win32_windows
- native_uwp_x86_windows
- native_uwp_x64_windows
- native_uwp_arm_windows
- native_uwp_arm64_windows
- native_win32_x86_windows
- native_win32_x64_windows
- template: azure-templates-bootstrapper.yml # Build Managed (macOS)
parameters:
name: managed_macos
Expand Down Expand Up @@ -183,6 +217,7 @@ stages:
displayName: Package NuGets [No Dependencies]
vmImage: $(VM_IMAGE_WINDOWS)
target: nuget-only
additionalArgs: --packall=true
shouldPublish: false
requiredArtifacts:
- managed_nodependencies_linux
Expand Down Expand Up @@ -215,6 +250,7 @@ stages:
displayName: Package NuGets
vmImage: $(VM_IMAGE_WINDOWS)
target: nuget-only
additionalArgs: --packall=true
shouldPublish: false
requiredArtifacts:
- managed_linux
Expand Down

0 comments on commit 4e7fe1c

Please sign in to comment.