Skip to content

Commit

Permalink
Use Python 3.x and Clang 12.x (#1959)
Browse files Browse the repository at this point in the history
* Update to Python 3.x to generate the build scripts and other related things
* Update to Clang 12.x to work with Visual Studio 2022
* Update all Windows builds to use Visual Studio 2022
* Update the required .net tools
* Streamline the pipeline a bit more
* Extracted all the tool install yaml into scripts so they can be better edited and tracked
  • Loading branch information
mattleibow authored Mar 2, 2022
1 parent f4f689e commit 2f218de
Show file tree
Hide file tree
Showing 36 changed files with 454 additions and 177 deletions.
20 changes: 19 additions & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,28 @@
"isRoot": true,
"tools": {
"cake.tool": {
"version": "1.2.0",
"version": "2.1.0",
"commands": [
"dotnet-cake"
]
},
"nano-api-scan": {
"version": "1.0.1",
"commands": [
"nano-api-scan"
]
},
"dotnet-reportgenerator-globaltool": {
"version": "5.0.4",
"commands": [
"reportgenerator"
]
},
"microsoft.dotnet.xharness.cli": {
"version": "1.0.0-prerelease.22124.1",
"commands": [
"xharness"
]
}
}
}
2 changes: 1 addition & 1 deletion binding/HarfBuzzSharp.Android/HarfBuzzSharp.Android.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="MSBuild.Sdk.Extras/3.0.44">
<PropertyGroup>
<TargetFramework>monoandroid9.0</TargetFramework>
<TargetFramework>monoandroid10.0</TargetFramework>
<RootNamespace>HarfBuzzSharp</RootNamespace>
<AssemblyName>HarfBuzzSharp</AssemblyName>
<PackagingGroup>HarfBuzzSharp</PackagingGroup>
Expand Down
2 changes: 1 addition & 1 deletion binding/SkiaSharp.Android/SkiaSharp.Android.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="MSBuild.Sdk.Extras/3.0.44">
<PropertyGroup>
<TargetFramework>monoandroid9.0</TargetFramework>
<TargetFramework>monoandroid10.0</TargetFramework>
<RootNamespace>SkiaSharp</RootNamespace>
<AssemblyName>SkiaSharp</AssemblyName>
<PackagingGroup>SkiaSharp</PackagingGroup>
Expand Down
13 changes: 6 additions & 7 deletions cake/UtilsManaged.cake
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,12 @@ void RunNetCorePublish(FilePath testProject, DirectoryPath output)
void RunCodeCoverage(string testResultsGlob, DirectoryPath output)
{
try {
RunProcess("reportgenerator", new ProcessSettings {
Arguments =
$"-reports:{testResultsGlob} " +
$"-targetdir:{output} " +
$"-reporttypes:HtmlInline_AzurePipelines;Cobertura " +
$"-assemblyfilters:-*.Tests"
});
DotNetTool(
$"reportgenerator" +
$" -reports:{testResultsGlob}" +
$" -targetdir:{output}" +
$" -reporttypes:HtmlInline_AzurePipelines;Cobertura" +
$" -assemblyfilters:-*.Tests");
} catch (Exception ex) {
Error("Make sure to install the 'dotnet-reportgenerator-globaltool' .NET Core global tool.");
Error(ex);
Expand Down
6 changes: 6 additions & 0 deletions cake/externals.cake
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ foreach (var cake in GetFiles("native/*/build.cake"))
Task("externals-osx")
.IsDependentOn("externals-macos");

Task("externals-nano")
.IsDependentOn("externals-nanoserver");

Task("externals-catalyst")
.IsDependentOn("externals-maccatalyst");

Expand Down Expand Up @@ -79,6 +82,9 @@ bool ShouldBuildExternal(string platform)
case "win":
platform = "windows";
break;
case "nano":
platform = "nanoserver";
break;
}

if (SKIP_EXTERNALS.Contains(platform))
Expand Down
2 changes: 1 addition & 1 deletion cake/native-shared.cake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#load "shared.cake"

var PYTHON_EXE = Argument("python", EnvironmentVariable("PYTHON_EXE") ?? "python");
var PYTHON_EXE = Argument("python", EnvironmentVariable("PYTHON_EXE") ?? "python3");

if (!string.IsNullOrEmpty(PYTHON_EXE) && FileExists(PYTHON_EXE)) {
var dir = MakeAbsolute((FilePath)PYTHON_EXE).GetDirectory();
Expand Down
2 changes: 1 addition & 1 deletion cake/shared.cake
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void RunCake(FilePath cake, string target = null, Dictionary<string, string> arg
cmd += $@" --{arg.Key}=""{arg.Value}""";
}

DotNetCoreTool(cmd);
DotNetTool(cmd);
}

void RunProcess(FilePath process, string args = "")
Expand Down
4 changes: 2 additions & 2 deletions cake/xharness-android.cake
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ DirectoryPath ROOT_PATH = MakeAbsolute(Directory(".."));

// required
FilePath PROJECT = Argument("project", EnvironmentVariable("ANDROID_TEST_PROJECT") ?? "");
string TEST_DEVICE = Argument("device", EnvironmentVariable("ANDROID_TEST_DEVICE") ?? "android-emulator-32_30");
string TEST_DEVICE = Argument("device", EnvironmentVariable("ANDROID_TEST_DEVICE") ?? "android-emulator-64_30");
string DEVICE_NAME = Argument("skin", EnvironmentVariable("ANDROID_TEST_SKIN") ?? "Nexus 5X");

// optional
Expand Down Expand Up @@ -179,7 +179,7 @@ Task("Default")
CleanDirectories(TEST_RESULTS);
RunProcess("xharness", "android test " +
DotNetTool("xharness android test " +
$"--app=\"{TEST_APP}\" " +
$"--package-name=\"{TEST_APP_PACKAGE_NAME}\" " +
$"--instrumentation=\"{TEST_APP_INSTRUMENTATION}\" " +
Expand Down
2 changes: 1 addition & 1 deletion cake/xharness-ios.cake
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Task("Default")
CleanDirectories(TEST_RESULTS);
try {
RunProcess("xharness", "apple test " +
DotNetTool("xharness apple test " +
$"--app=\"{TEST_APP}\" " +
$"--targets=\"{TEST_DEVICE}\" " +
$"--output-directory=\"{TEST_RESULTS}\" " +
Expand Down
2 changes: 1 addition & 1 deletion externals/depot_tools
Submodule depot_tools updated from 441343 to 42cf2a
4 changes: 2 additions & 2 deletions native/nanoserver/build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Task("libSkiaSharp")
{ "arch", "x64" },
});
RunProcess("nano-api-scan", OUTPUT_PATH.CombineWithFilePath("nanoserver/x64/libSkiaSharp.dll").FullPath);
DotNetTool("nano-api-scan " + OUTPUT_PATH.CombineWithFilePath("nanoserver/x64/libSkiaSharp.dll").FullPath);
});

Task("libHarfBuzzSharp")
Expand All @@ -30,7 +30,7 @@ Task("libHarfBuzzSharp")
CopyFileToDirectory(srcDir.CombineWithFilePath("libHarfBuzzSharp.dll"), outDir);
CopyFileToDirectory(srcDir.CombineWithFilePath("libHarfBuzzSharp.pdb"), outDir);
RunProcess("nano-api-scan", OUTPUT_PATH.CombineWithFilePath("nanoserver/x64/libHarfBuzzSharp.dll").FullPath);
DotNetTool("nano-api-scan " + OUTPUT_PATH.CombineWithFilePath("nanoserver/x64/libHarfBuzzSharp.dll").FullPath);
});

Task("Default")
Expand Down
4 changes: 0 additions & 4 deletions nuget.config
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,5 @@
<add key="dotnet-public" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json" />
<add key="dotnet6" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json" />
<add key="dotnet-eng" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" />
<add key="darc-pub-dotnet-aspnetcore" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-aspnetcore-7c57ecbd-3/nuget/v3/index.json" />
<add key="darc-pub-dotnet-runtime" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-runtime-4822e3c3-5/nuget/v3/index.json" />
<add key="darc-pub-dotnet-windowsdesktop" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-windowsdesktop-59fea7da-4/nuget/v3/index.json" />
<add key="darc-pub-dotnet-emsdk" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-emsdk-1ec2e17f-4/nuget/v3/index.json" />
</packageSources>
</configuration>
2 changes: 1 addition & 1 deletion scripts/Docker/alpine/amd64/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM amd64/alpine:3.9
# Arguments:
# DOTNET_SDK_VERSION - the version of dotnet for the Cake script [ 3.1.412 | * ]

RUN apk add --no-cache bash curl wget python git build-base ninja fontconfig-dev libintl
RUN apk add --no-cache bash curl wget python python3 git build-base ninja fontconfig-dev libintl
RUN apk add --no-cache samurai --repository http://dl-cdn.alpinelinux.org/alpine/edge/main
RUN apk add --no-cache clang gn --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing

Expand Down
6 changes: 3 additions & 3 deletions scripts/Docker/debian9/amd64/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ FROM amd64/debian:9

# Arguments:
# DOTNET_SDK_VERSION - the version of dotnet for the Cake script [ 3.1.412 | * ]
# CLANG_VERSION - the version of clang/llvm tools [ 10 | * ]
# CLANG_VERSION - the version of clang/llvm tools [ 12 | * ]
# TOOLCHAIN_VERSION - the version of the GCC toolchain [ 6 | * ]

ARG CLANG_VERSION=10
ARG CLANG_VERSION=12
ARG TOOLCHAIN_VERSION=6
RUN apt-get update \
&& apt-get install -y apt-transport-https curl wget python git make dirmngr gnupg \
&& apt-get install -y apt-transport-https curl wget python python3 git make dirmngr gnupg \
&& curl -L https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - \
&& echo "deb http://apt.llvm.org/stretch/ llvm-toolchain-stretch-${CLANG_VERSION} main" | tee /etc/apt/sources.list.d/llvm.list \
&& apt-get update \
Expand Down
6 changes: 3 additions & 3 deletions scripts/Docker/debian9/clang-cross/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM amd64/debian:9

# Arguments:
# DOTNET_SDK_VERSION - the version of dotnet for the Cake script [ 3.1.412 | * ]
# CLANG_VERSION - the version of clang/llvm tools [ 10 | * ]
# CLANG_VERSION - the version of clang/llvm tools [ 12 | * ]
# TOOLCHAIN_VERSION - the version of the GCC toolchain [ 6 | * ]
# TOOLCHAIN_ARCH - the architecture of the GCC toolchain [ arm-linux-gnueabihf | aarch64-linux-gnu]
# TOOLCHAIN_ARCH_SHORT - the short form architecture of the GCC toolchain [ armhf | arm64 ]
Expand All @@ -14,9 +14,9 @@ FROM amd64/debian:9
# --build-arg TOOLCHAIN_ARCH=aarch64-linux-gnu --build-arg TOOLCHAIN_ARCH_SHORT=arm64

# pre-requisites for building (python, git)
ARG CLANG_VERSION=10
ARG CLANG_VERSION=12
RUN apt-get update \
&& apt-get install -y apt-transport-https curl wget python git make dirmngr gnupg \
&& apt-get install -y apt-transport-https curl wget python python3 git make dirmngr gnupg \
&& curl -L https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - \
&& echo "deb http://apt.llvm.org/stretch/ llvm-toolchain-stretch-${CLANG_VERSION} main" | tee /etc/apt/sources.list.d/llvm.list \
&& apt-get update \
Expand Down
Loading

0 comments on commit 2f218de

Please sign in to comment.