зеркало из https://github.com/mono/SkiaSharp.git
Support building SkiaSharp without fontconfig (#821)
This commit is contained in:
Родитель
87bd5c6d01
Коммит
5da3cfd412
15
VERSIONS.txt
15
VERSIONS.txt
|
@ -25,10 +25,11 @@ HarfBuzzSharp assembly 1.0.0.0
|
|||
HarfBuzzSharp file 2.3.1.0
|
||||
|
||||
# nuget versions
|
||||
SkiaSharp nuget 1.68.1
|
||||
SkiaSharp.NativeAssets.Linux nuget 1.68.1
|
||||
SkiaSharp.Views nuget 1.68.1
|
||||
SkiaSharp.Views.Forms nuget 1.68.1
|
||||
SkiaSharp.HarfBuzz nuget 1.68.1
|
||||
HarfBuzzSharp nuget 2.3.1
|
||||
HarfBuzzSharp.NativeAssets.Linux nuget 2.3.1
|
||||
SkiaSharp nuget 1.68.1
|
||||
SkiaSharp.NativeAssets.Linux nuget 1.68.1
|
||||
SkiaSharp.NativeAssets.Linux.NoDependencies nuget 1.68.1
|
||||
SkiaSharp.Views nuget 1.68.1
|
||||
SkiaSharp.Views.Forms nuget 1.68.1
|
||||
SkiaSharp.HarfBuzz nuget 1.68.1
|
||||
HarfBuzzSharp nuget 2.3.1
|
||||
HarfBuzzSharp.NativeAssets.Linux nuget 2.3.1
|
||||
|
|
11
build.cake
11
build.cake
|
@ -29,6 +29,8 @@ var SKIP_EXTERNALS = Argument ("skipexternals", Argument ("SkipExternals", "")).
|
|||
var PACK_ALL_PLATFORMS = Argument ("packall", Argument ("PackAll", Argument ("PackAllPlatforms", TARGET.ToLower() == "ci" || TARGET.ToLower() == "nuget-only")));
|
||||
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 NuGetSources = new [] { MakeAbsolute (Directory ("./output/nugets")).FullPath, "https://api.nuget.org/v3/index.json" };
|
||||
var NuGetToolPath = Context.Tools.Resolve ("nuget.exe");
|
||||
|
@ -331,8 +333,9 @@ Task ("nuget-only")
|
|||
if (id != null && version != null) {
|
||||
var v = GetVersion (id.Value);
|
||||
if (!string.IsNullOrEmpty (v)) {
|
||||
version.Value = v + suffix;
|
||||
version.Value = v;
|
||||
}
|
||||
version.Value += suffix;
|
||||
}
|
||||
|
||||
// <dependency>
|
||||
|
@ -361,8 +364,8 @@ Task ("nuget-only")
|
|||
var metadata = xdoc.Root.Element ("metadata");
|
||||
var id = metadata.Element ("id").Value;
|
||||
var dir = id;
|
||||
if (id.Contains(".NativeAssets")) {
|
||||
dir = id.Substring(0, id.IndexOf(".NativeAssets"));
|
||||
if (id.Contains(".NativeAssets.")) {
|
||||
dir = id.Substring(0, id.IndexOf(".NativeAssets."));
|
||||
}
|
||||
|
||||
var preview = "";
|
||||
|
@ -529,6 +532,8 @@ Information (" Skip externals: {0}", SKIP_EXTERNALS);
|
|||
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);
|
||||
Information (" Unsupported Tests: {0}", UNSUPPORTED_TESTS);
|
||||
Information (" Additional GN Arguments: {0}", ADDITIONAL_GN_ARGS);
|
||||
Information ("");
|
||||
|
||||
Information ("Tool Paths:");
|
||||
|
|
|
@ -5,6 +5,10 @@ void GnNinja (DirectoryPath outDir, string target, string skiaArgs)
|
|||
var quote = IsRunningOnWindows () ? "\"" : "'";
|
||||
var innerQuote = IsRunningOnWindows () ? "\\\"" : "\"";
|
||||
|
||||
if (!string.IsNullOrEmpty(ADDITIONAL_GN_ARGS)) {
|
||||
skiaArgs += " " + ADDITIONAL_GN_ARGS;
|
||||
}
|
||||
|
||||
// generate native skia build files
|
||||
RunProcess (SKIA_PATH.CombineWithFilePath($"bin/gn{exe}"), new ProcessSettings {
|
||||
Arguments = $"gen out/{outDir} --args={quote}{skiaArgs.Replace("'", innerQuote)}{quote}",
|
||||
|
|
|
@ -65,7 +65,7 @@ var RunProcess = new Action<FilePath, ProcessSettings> ((process, settings) =>
|
|||
}
|
||||
});
|
||||
|
||||
var RunTests = new Action<FilePath, bool> ((testAssembly, is32) =>
|
||||
void RunTests (FilePath testAssembly, bool is32)
|
||||
{
|
||||
var dir = testAssembly.GetDirectory ();
|
||||
var settings = new XUnit2Settings {
|
||||
|
@ -77,20 +77,43 @@ var RunTests = new Action<FilePath, bool> ((testAssembly, is32) =>
|
|||
WorkingDirectory = dir,
|
||||
ArgumentCustomization = args => args.Append ("-verbose"),
|
||||
};
|
||||
var traits = CreateTraitsDictionary(UNSUPPORTED_TESTS);
|
||||
foreach (var trait in traits) {
|
||||
settings.ExcludeTrait(trait.Name, trait.Value);
|
||||
}
|
||||
XUnit2 (new [] { testAssembly }, settings);
|
||||
});
|
||||
}
|
||||
|
||||
var RunNetCoreTests = new Action<FilePath> ((testAssembly) =>
|
||||
void RunNetCoreTests (FilePath testAssembly)
|
||||
{
|
||||
var dir = testAssembly.GetDirectory ();
|
||||
DotNetCoreTest(testAssembly.GetFilename().ToString(), new DotNetCoreTestSettings {
|
||||
var settings = new DotNetCoreTestSettings {
|
||||
Configuration = "Release",
|
||||
NoRestore = true,
|
||||
TestAdapterPath = ".",
|
||||
Logger = "xunit",
|
||||
WorkingDirectory = dir,
|
||||
});
|
||||
});
|
||||
};
|
||||
var traits = CreateTraitsDictionary(UNSUPPORTED_TESTS);
|
||||
var filter = string.Join("&", traits.Select(t => $"{t.Name}!={t.Value}"));
|
||||
if (!string.IsNullOrEmpty(filter)) {
|
||||
settings.Filter = filter;
|
||||
}
|
||||
DotNetCoreTest(testAssembly.GetFilename().ToString(), settings);
|
||||
}
|
||||
|
||||
IEnumerable<(string Name, string Value)> CreateTraitsDictionary (string args)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(args)) {
|
||||
var traits = args.Split(';');
|
||||
foreach (var trait in traits) {
|
||||
var kv = trait.Split('=');
|
||||
if (kv.Length != 2)
|
||||
continue;
|
||||
yield return (kv[0], kv[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var DecompressArchive = new Action<FilePath, DirectoryPath> ((archive, outputDir) => {
|
||||
using (var stream = System.IO.File.OpenRead (archive.FullPath))
|
||||
|
|
|
@ -1,5 +1,2 @@
|
|||
angle/
|
||||
package_cache/
|
||||
|
||||
# HACK: https://github.com/mono/api-doc-tools/pull/401
|
||||
Windows.winmd
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<package>
|
||||
<metadata>
|
||||
|
||||
<!-- package -->
|
||||
<id>SkiaSharp.NativeAssets.Linux.NoDependencies</id>
|
||||
<title>SkiaSharp - Native Assets for Linux (no dependencies)</title>
|
||||
<version>1.0.0</version>
|
||||
<description>
|
||||
SkiaSharp is a cross-platform 2D graphics API for .NET platforms based on Google's Skia Graphics Library.
|
||||
It provides a comprehensive 2D API that can be used across mobile, server and desktop models to render images.
|
||||
|
||||
This variation of the Linux native assets includes the build of libSkiaSharp.so that does not have any dependencies on third-party libraries.
|
||||
|
||||
The complete dependency list is:
|
||||
- libpthread.so.0
|
||||
- libdl.so.2
|
||||
- libm.so.6
|
||||
- libc.so.6
|
||||
- ld-linux-x86-64.so.2
|
||||
|
||||
The excluded dependencies are:
|
||||
- Fontconfig
|
||||
</description>
|
||||
<summary>
|
||||
SkiaSharp is a cross-platform 2D graphics API for .NET platforms that can be used across mobile, server and desktop models to render images.
|
||||
</summary>
|
||||
<releaseNotes>
|
||||
Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release notes.
|
||||
</releaseNotes>
|
||||
<projectUrl>https://go.microsoft.com/fwlink/?linkid=868515</projectUrl>
|
||||
<iconUrl>https://go.microsoft.com/fwlink/?linkid=868516</iconUrl>
|
||||
<tags>xamarin graphics ios android linux windows uwp tvos watchos macos tizen cross-platform skiasharp</tags>
|
||||
|
||||
<!-- legal -->
|
||||
<licenseUrl>https://go.microsoft.com/fwlink/?linkid=868514</licenseUrl>
|
||||
<authors>Microsoft</authors>
|
||||
<owners>Microsoft</owners>
|
||||
<requireLicenseAcceptance>true</requireLicenseAcceptance>
|
||||
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
|
||||
|
||||
<dependencies>
|
||||
<dependency id="SkiaSharp" version="1.0.0" />
|
||||
</dependencies>
|
||||
|
||||
</metadata>
|
||||
<files>
|
||||
|
||||
<!-- the build bits -->
|
||||
<file src="build/net45/SkiaSharp.targets" />
|
||||
|
||||
<!-- libSkiaSharp.dll and other native files -->
|
||||
<file platform="linux" src="runtimes/linux-x64/native/libSkiaSharp.so" />
|
||||
|
||||
<!-- legal -->
|
||||
<file src="LICENSE.txt" />
|
||||
<file src="THIRD-PARTY-NOTICES.txt" />
|
||||
|
||||
</files>
|
||||
</package>
|
|
@ -89,32 +89,19 @@ jobs:
|
|||
target: externals-watchos
|
||||
|
||||
# NATIVE JOBS - LINUX
|
||||
- job: native_linux_linux
|
||||
displayName: Build Native Linux (Linux)
|
||||
pool:
|
||||
vmImage: ubuntu-16.04
|
||||
container: ubuntu:14.04
|
||||
steps:
|
||||
- checkout: self
|
||||
submodules: recursive
|
||||
- bash: |
|
||||
sudo apt update
|
||||
sudo apt install -y apt-transport-https
|
||||
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
|
||||
echo "deb https://download.mono-project.com/repo/ubuntu stable-trusty main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
|
||||
sudo apt update
|
||||
sudo apt install -y $NATIVE_LINUX_PACKAGES
|
||||
displayName: Install any package dependencies
|
||||
- bash: ./bootstrapper.sh -t externals-linux -v $VERBOSITY
|
||||
displayName: Run the bootstrapper for externals-linux
|
||||
env:
|
||||
CC: clang-3.8
|
||||
CXX: clang++-3.8
|
||||
- task: PublishPipelineArtifact@0
|
||||
displayName: Publish the native_linux_linux artifacts
|
||||
inputs:
|
||||
artifactName: native_linux_linux
|
||||
targetPath: 'output'
|
||||
- template: azure-templates-native-linux.yml
|
||||
parameters:
|
||||
name: native_linux_linux
|
||||
displayName: Build Native Linux (Linux)
|
||||
packages: $(NATIVE_LINUX_PACKAGES)
|
||||
target: externals-linux
|
||||
- template: azure-templates-native-linux.yml
|
||||
parameters:
|
||||
name: native_linux_nodependencies_linux
|
||||
displayName: Build Native Linux [No Dependencies] (Linux)
|
||||
packages: $(NATIVE_LINUX_PACKAGES)
|
||||
target: externals-linux
|
||||
additionalArgs: --additionalGnArgs="skia_use_fontconfig=false"
|
||||
- template: azure-templates-bootstrapper.yml
|
||||
parameters:
|
||||
name: native_tizen_linux
|
||||
|
@ -159,8 +146,45 @@ jobs:
|
|||
dependsOn:
|
||||
- native_linux_linux
|
||||
- native_tizen_linux
|
||||
- template: azure-templates-bootstrapper.yml
|
||||
parameters:
|
||||
name: managed_nodependencies_linux
|
||||
displayName: Build Managed [No Dependencies] (Linux)
|
||||
vmImage: ubuntu-16.04
|
||||
packages: $(MANAGED_LINUX_PACKAGES)
|
||||
target: libs-only
|
||||
dependsOn:
|
||||
- native_linux_nodependencies_linux
|
||||
- native_tizen_linux
|
||||
|
||||
# PACKAGING JOBS
|
||||
- template: azure-templates-bootstrapper.yml
|
||||
parameters:
|
||||
name: package_nodependencies_windows
|
||||
displayName: Package NuGets [No Dependencies]
|
||||
vmImage: vs2017-win2016
|
||||
target: nuget-only
|
||||
dependsOn:
|
||||
- managed_nodependencies_linux
|
||||
- managed_macos
|
||||
- managed_windows
|
||||
postBuildSteps:
|
||||
- powershell: |
|
||||
$platforms = Get-ChildItem -Path ./output/native/*
|
||||
$platforms | Where-Object { $_.Name -NotMatch "linux" } | ForEach-Object { Remove-Item -Path $_ -Recurse -Force }
|
||||
$nupkgs = Get-ChildItem -Path ./output/nugets/*
|
||||
$nupkgs | Where-Object { $_.Name -NotMatch "NoDependencies" } | ForEach-Object { Remove-Item -Path $_ -Recurse -Force }
|
||||
displayName: Remove all unrelated files
|
||||
- task: PublishPipelineArtifact@0
|
||||
displayName: Publish the native-nodependencies artifacts
|
||||
inputs:
|
||||
artifactName: native-nodependencies
|
||||
targetPath: 'output/native'
|
||||
- task: PublishPipelineArtifact@0
|
||||
displayName: Publish the nuget-nodependencies artifacts
|
||||
inputs:
|
||||
artifactName: nuget-nodependencies
|
||||
targetPath: 'output/nugets'
|
||||
- template: azure-templates-bootstrapper.yml
|
||||
parameters:
|
||||
name: package_windows
|
||||
|
@ -171,25 +195,50 @@ jobs:
|
|||
- managed_linux
|
||||
- managed_macos
|
||||
- managed_windows
|
||||
preBuildSteps:
|
||||
- powershell: |
|
||||
if ($env:GIT_BRANCH_NAME.StartsWith($env:FEATURE_NAME_PREFIX)) {
|
||||
$feature = $env:GIT_BRANCH_NAME.Substring($env:FEATURE_NAME_PREFIX.Length)
|
||||
Write-Host "##vso[task.setvariable variable=FEATURE_NAME]$feature"
|
||||
}
|
||||
postBuildSteps:
|
||||
- task: PublishBuildArtifacts@1
|
||||
- task: PublishPipelineArtifact@0
|
||||
displayName: Publish the native-default artifacts
|
||||
inputs:
|
||||
artifactName: native
|
||||
pathToPublish: 'output/native'
|
||||
- task: PublishBuildArtifacts@1
|
||||
artifactName: native-default
|
||||
targetPath: 'output/native'
|
||||
- task: PublishPipelineArtifact@0
|
||||
displayName: Publish the nuget-default artifacts
|
||||
inputs:
|
||||
artifactName: nuget
|
||||
pathToPublish: 'output/nugets'
|
||||
artifactName: nuget-default
|
||||
targetPath: 'output/nugets'
|
||||
- job: package
|
||||
displayName: Combine Packaged NuGets
|
||||
dependsOn:
|
||||
- package_nodependencies_windows
|
||||
- package_windows
|
||||
pool:
|
||||
vmImage: vs2017-win2016
|
||||
steps:
|
||||
- checkout: none
|
||||
- task: DownloadPipelineArtifact@0
|
||||
displayName: Download the nuget-nodependencies artifacts
|
||||
inputs:
|
||||
artifactName: nuget-nodependencies
|
||||
targetPath: 'output/nugets'
|
||||
- task: DownloadPipelineArtifact@0
|
||||
displayName: Download the nuget-default artifacts
|
||||
inputs:
|
||||
artifactName: nuget-default
|
||||
targetPath: 'output/nugets'
|
||||
- task: PublishBuildArtifacts@1
|
||||
displayName: Publish the nuget artifacts
|
||||
inputs:
|
||||
artifactName: nuget
|
||||
pathToPublish: 'output/nugets'
|
||||
- task: PublishPipelineArtifact@0
|
||||
displayName: Publish the package artifacts
|
||||
inputs:
|
||||
artifactName: package
|
||||
targetPath: 'output'
|
||||
- ${{ if eq(variables['System.TeamProject'], 'devdiv') }}:
|
||||
- job: signing
|
||||
displayName: Signing NuGets
|
||||
dependsOn: package_windows
|
||||
displayName: Sign NuGets
|
||||
dependsOn: package
|
||||
pool:
|
||||
name: VSEng-XamarinCustom
|
||||
demands:
|
||||
|
@ -201,6 +250,7 @@ jobs:
|
|||
parameters:
|
||||
targetFolder: 'output/signed'
|
||||
- task: PublishPipelineArtifact@0
|
||||
displayName: Publish the nuget-signed artifacts
|
||||
inputs:
|
||||
artifactName: nuget-signed
|
||||
targetPath: 'output/signed'
|
||||
|
@ -216,6 +266,8 @@ jobs:
|
|||
- package_windows
|
||||
postBuildSteps:
|
||||
- task: PublishTestResults@2
|
||||
displayName: Publish the test results
|
||||
condition: always()
|
||||
inputs:
|
||||
testResultsFormat: xUnit
|
||||
testResultsFiles: 'output/tests/**/*.xml'
|
||||
|
@ -229,6 +281,8 @@ jobs:
|
|||
- package_windows
|
||||
postBuildSteps:
|
||||
- task: PublishTestResults@2
|
||||
displayName: Publish the test results
|
||||
condition: always()
|
||||
inputs:
|
||||
testResultsFormat: xUnit
|
||||
testResultsFiles: 'output/tests/**/*.xml'
|
||||
|
@ -243,50 +297,69 @@ jobs:
|
|||
- package_windows
|
||||
postBuildSteps:
|
||||
- task: PublishTestResults@2
|
||||
displayName: Publish the test results
|
||||
condition: always()
|
||||
inputs:
|
||||
testResultsFormat: xUnit
|
||||
testResultsFiles: 'output/tests/**/*.xml'
|
||||
- template: azure-templates-bootstrapper.yml
|
||||
parameters:
|
||||
name: tests_nodependencies_linux
|
||||
displayName: Tests [No Dependencies] (Linux)
|
||||
vmImage: ubuntu-16.04
|
||||
packages: $(MANAGED_LINUX_PACKAGES)
|
||||
target: tests
|
||||
additionalArgs: --skipExternals="all" --unsupportedTests="Feature=MatchCharacter"
|
||||
dependsOn:
|
||||
- native_linux_nodependencies_linux
|
||||
- native_tizen_linux
|
||||
postBuildSteps:
|
||||
- task: PublishTestResults@2
|
||||
displayName: Publish the test results
|
||||
condition: always()
|
||||
inputs:
|
||||
testResultsFormat: xUnit
|
||||
testResultsFiles: 'output/tests/**/*.xml'
|
||||
|
||||
# SAMPLES JOBS
|
||||
- ${{ if eq(variables['System.TeamProject'], 'devdiv') }}:
|
||||
- template: azure-templates-bootstrapper.yml
|
||||
parameters:
|
||||
name: samples_windows
|
||||
displayName: Build Samples (Windows)
|
||||
vmImage: vs2017-win2016
|
||||
target: samples
|
||||
dependsOn:
|
||||
- managed_windows
|
||||
- template: azure-templates-bootstrapper.yml
|
||||
parameters:
|
||||
name: samples_macos
|
||||
displayName: Build Samples (macOS)
|
||||
vmImage: macos-10.13
|
||||
target: samples
|
||||
dependsOn:
|
||||
- managed_macos
|
||||
preBuildSteps:
|
||||
- task: InstallAppleCertificate@2
|
||||
inputs:
|
||||
certSecureFile: 'SkiaSharp iOS Certificate.p12'
|
||||
- task: InstallAppleCertificate@2
|
||||
inputs:
|
||||
certSecureFile: 'SkiaSharp Mac Certificate.p12'
|
||||
- task: InstallAppleProvisioningProfile@1
|
||||
inputs:
|
||||
provProfileSecureFile: 'SkiaSharp iOS Provisioning.mobileprovision'
|
||||
- task: InstallAppleProvisioningProfile@1
|
||||
inputs:
|
||||
provProfileSecureFile: 'SkiaSharp Mac Provisioning.provisionprofile'
|
||||
- task: InstallAppleProvisioningProfile@1
|
||||
inputs:
|
||||
provProfileSecureFile: 'SkiaSharp tvOS Provisioning.mobileprovision'
|
||||
- template: azure-templates-bootstrapper.yml
|
||||
parameters:
|
||||
name: samples_linux
|
||||
displayName: Build Samples (Linux)
|
||||
vmImage: ubuntu-16.04
|
||||
packages: $(MANAGED_LINUX_PACKAGES)
|
||||
target: samples
|
||||
dependsOn:
|
||||
- managed_linux
|
||||
- template: azure-templates-bootstrapper.yml
|
||||
parameters:
|
||||
name: samples_windows
|
||||
displayName: Build Samples (Windows)
|
||||
vmImage: vs2017-win2016
|
||||
target: samples
|
||||
dependsOn:
|
||||
- managed_windows
|
||||
- template: azure-templates-bootstrapper.yml
|
||||
parameters:
|
||||
name: samples_macos
|
||||
displayName: Build Samples (macOS)
|
||||
vmImage: macos-10.13
|
||||
target: samples
|
||||
dependsOn:
|
||||
- managed_macos
|
||||
preBuildSteps:
|
||||
- task: InstallAppleCertificate@2
|
||||
inputs:
|
||||
certSecureFile: 'SkiaSharp iOS Certificate.p12'
|
||||
- task: InstallAppleCertificate@2
|
||||
inputs:
|
||||
certSecureFile: 'SkiaSharp Mac Certificate.p12'
|
||||
- task: InstallAppleProvisioningProfile@1
|
||||
inputs:
|
||||
provProfileSecureFile: 'SkiaSharp iOS Provisioning.mobileprovision'
|
||||
- task: InstallAppleProvisioningProfile@1
|
||||
inputs:
|
||||
provProfileSecureFile: 'SkiaSharp Mac Provisioning.provisionprofile'
|
||||
- task: InstallAppleProvisioningProfile@1
|
||||
inputs:
|
||||
provProfileSecureFile: 'SkiaSharp tvOS Provisioning.mobileprovision'
|
||||
- template: azure-templates-bootstrapper.yml
|
||||
parameters:
|
||||
name: samples_linux
|
||||
displayName: Build Samples (Linux)
|
||||
vmImage: ubuntu-16.04
|
||||
packages: $(MANAGED_LINUX_PACKAGES)
|
||||
target: samples
|
||||
dependsOn:
|
||||
- managed_linux
|
||||
|
|
|
@ -8,6 +8,7 @@ parameters:
|
|||
demands: [] # the demands
|
||||
preBuildSteps: [] # any steps to run before the build
|
||||
postBuildSteps: [] # any additional steps to run after the build
|
||||
additionalArgs: '' # any additional arguments to pass to the bootstrapper
|
||||
|
||||
jobs:
|
||||
- job: ${{ parameters.name }}
|
||||
|
@ -20,6 +21,12 @@ jobs:
|
|||
steps:
|
||||
- checkout: self
|
||||
submodules: recursive
|
||||
- powershell: |
|
||||
if ($env:GIT_BRANCH_NAME.StartsWith($env:FEATURE_NAME_PREFIX)) {
|
||||
$feature = $env:GIT_BRANCH_NAME.Substring($env:FEATURE_NAME_PREFIX.Length)
|
||||
Write-Host "##vso[task.setvariable variable=FEATURE_NAME]$feature"
|
||||
}
|
||||
displayName: Determine the feature name, if any
|
||||
# install any packages on linux
|
||||
- ${{ if endsWith(parameters.name, '_linux') }}:
|
||||
- bash: |
|
||||
|
@ -61,13 +68,13 @@ jobs:
|
|||
- ${{ parameters.preBuildSteps }}
|
||||
# build
|
||||
- ${{ if endsWith(parameters.name, '_windows') }}:
|
||||
- powershell: .\bootstrapper.ps1 -t ${{ parameters.target }} -v $env:VERBOSITY
|
||||
- powershell: .\bootstrapper.ps1 -t ${{ parameters.target }} -v $env:VERBOSITY ${{ parameters.additionalArgs }}
|
||||
displayName: Run the bootstrapper for ${{ parameters.target }}
|
||||
env:
|
||||
ANDROID_NDK_HOME: $(USERPROFILE)/android-ndk
|
||||
TIZEN_STUDIO_HOME: $(USERPROFILE)/tizen-studio
|
||||
- ${{ if not(endsWith(parameters.name, '_windows')) }}:
|
||||
- bash: ./bootstrapper.sh -t ${{ parameters.target }} -v $VERBOSITY
|
||||
- bash: ./bootstrapper.sh -t ${{ parameters.target }} -v $VERBOSITY ${{ parameters.additionalArgs }}
|
||||
displayName: Run the bootstrapper for ${{ parameters.target }}
|
||||
env:
|
||||
ANDROID_NDK_HOME: $(HOME)/android-ndk
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
parameters:
|
||||
name: '' # in the form type_platform_host
|
||||
displayName: '' # the human name
|
||||
packages: '' # any additional packages
|
||||
target: '' # the bootstrapper target
|
||||
preBuildSteps: [] # any steps to run before the build
|
||||
postBuildSteps: [] # any additional steps to run after the build
|
||||
additionalArgs: '' # any additional arguments to pass to the bootstrapper
|
||||
|
||||
jobs:
|
||||
- job: ${{ parameters.name }}
|
||||
displayName: ${{ parameters.displayName }}
|
||||
timeoutInMinutes: 120
|
||||
pool:
|
||||
vmImage: ubuntu-16.04
|
||||
container: ubuntu:14.04
|
||||
steps:
|
||||
- checkout: self
|
||||
submodules: recursive
|
||||
# install any packages
|
||||
- bash: |
|
||||
sudo apt update
|
||||
sudo apt install -y apt-transport-https
|
||||
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
|
||||
echo "deb https://download.mono-project.com/repo/ubuntu stable-trusty main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
|
||||
sudo apt update
|
||||
sudo apt install -y ${{ parameters.packages }}
|
||||
displayName: Install any package dependencies
|
||||
# pre-build steps
|
||||
- ${{ parameters.preBuildSteps }}
|
||||
# build
|
||||
- bash: ./bootstrapper.sh -t ${{ parameters.target }} -v $VERBOSITY ${{ parameters.additionalArgs }}
|
||||
displayName: Run the bootstrapper for ${{ parameters.target }}
|
||||
env:
|
||||
CC: clang-3.8
|
||||
CXX: clang++-3.8
|
||||
- bash: |
|
||||
find output/native/linux -type f -name "*.so" -print0 | xargs -0 ldd -v
|
||||
displayName: List the dependencies for the native binaries
|
||||
# post-build steps
|
||||
- ${{ parameters.postBuildSteps }}
|
||||
# publish artifacts
|
||||
- task: PublishPipelineArtifact@0
|
||||
displayName: Publish the ${{ parameters.name }} artifacts
|
||||
inputs:
|
||||
artifactName: ${{ parameters.name }}
|
||||
targetPath: 'output'
|
|
@ -83,6 +83,7 @@
|
|||
<ItemGroup>
|
||||
<PackageReference Include="xunit" Version="2.4.0" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
|
||||
<PackageReference Include="xunit.categories" Version="2.0.4" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\binding\HarfBuzzSharp.Desktop\HarfBuzzSharp.Desktop.csproj">
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
<PackageReference Include="xunit" Version="2.4.0" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
|
||||
<PackageReference Include="XunitXml.TestLogger" Version="2.1.26" />
|
||||
<PackageReference Include="xunit.categories" Version="2.0.4" />
|
||||
<PackageReference Include="SkiaSharp" Version="1.68.1" />
|
||||
<PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="1.68.1" />
|
||||
<PackageReference Include="HarfBuzzSharp" Version="2.3.1" />
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Xunit;
|
||||
using Xunit.Categories;
|
||||
|
||||
namespace SkiaSharp.Tests
|
||||
{
|
||||
public class GRContextTest : SKTest
|
||||
{
|
||||
[Trait(Category, GpuCategory)]
|
||||
[Category(GpuCategory)]
|
||||
[SkippableFact]
|
||||
public void CreateDefaultContextIsValid()
|
||||
{
|
||||
|
@ -19,7 +20,7 @@ namespace SkiaSharp.Tests
|
|||
}
|
||||
}
|
||||
|
||||
[Trait(Category, GpuCategory)]
|
||||
[Category(GpuCategory)]
|
||||
[SkippableFact]
|
||||
public void CreateSpecificContextIsValid()
|
||||
{
|
||||
|
@ -36,7 +37,7 @@ namespace SkiaSharp.Tests
|
|||
}
|
||||
}
|
||||
|
||||
[Trait(Category, GpuCategory)]
|
||||
[Category(GpuCategory)]
|
||||
[SkippableFact]
|
||||
public void GpuSurfaceIsCreated()
|
||||
{
|
||||
|
|
|
@ -2,12 +2,13 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using Xunit;
|
||||
using Xunit.Categories;
|
||||
|
||||
namespace SkiaSharp.Tests
|
||||
{
|
||||
public class GRGlInterfaceTest : SKTest
|
||||
{
|
||||
[Trait(Category, GpuCategory)]
|
||||
[Category(GpuCategory)]
|
||||
[SkippableFact]
|
||||
public void CreateDefaultInterfaceIsValid()
|
||||
{
|
||||
|
@ -21,7 +22,7 @@ namespace SkiaSharp.Tests
|
|||
}
|
||||
}
|
||||
|
||||
[Trait(Category, GpuCategory)]
|
||||
[Category(GpuCategory)]
|
||||
[SkippableFact]
|
||||
public void AssembleInterfaceIsValid()
|
||||
{
|
||||
|
|
|
@ -3,12 +3,13 @@ using System.IO;
|
|||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
using Xunit;
|
||||
using Xunit.Categories;
|
||||
|
||||
namespace SkiaSharp.Tests
|
||||
{
|
||||
public class SKCanvasTest : SKTest
|
||||
{
|
||||
[Trait(Category, GpuCategory)]
|
||||
[Category(GpuCategory)]
|
||||
[SkippableFact]
|
||||
public void CanvasCanRestoreOnGpu()
|
||||
{
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using Xunit;
|
||||
using Xunit.Categories;
|
||||
using System.IO;
|
||||
|
||||
namespace SkiaSharp.Tests
|
||||
|
@ -7,6 +8,7 @@ namespace SkiaSharp.Tests
|
|||
public class SKFontManagerTest : SKTest
|
||||
{
|
||||
[SkippableFact]
|
||||
[Feature(MatchCharacterFeature)]
|
||||
public void TestFontManagerMatchCharacter()
|
||||
{
|
||||
var fonts = SKFontManager.Default;
|
||||
|
@ -14,6 +16,7 @@ namespace SkiaSharp.Tests
|
|||
var emojiChar = StringUtilities.GetUnicodeCharacterCode(emoji, SKTextEncoding.Utf32);
|
||||
using (var typeface = fonts.MatchCharacter(emojiChar))
|
||||
{
|
||||
Assert.NotNull(typeface);
|
||||
if (IsLinux)
|
||||
Assert.Equal("Symbola", typeface.FamilyName);
|
||||
else if (IsMac)
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
using Xunit;
|
||||
using Xunit.Categories;
|
||||
|
||||
namespace SkiaSharp.Tests
|
||||
{
|
||||
|
@ -251,23 +252,42 @@ namespace SkiaSharp.Tests
|
|||
}
|
||||
|
||||
[SkippableFact]
|
||||
[Feature(MatchCharacterFeature)]
|
||||
public void UnicodeGlyphsReturnsTheCorrectNumberOfCharacters()
|
||||
{
|
||||
const string text = "🚀";
|
||||
var emojiChar = StringUtilities.GetUnicodeCharacterCode(text, SKTextEncoding.Utf32);
|
||||
|
||||
var typeface = SKFontManager.Default.MatchCharacter(emojiChar);
|
||||
Assert.NotNull(typeface);
|
||||
|
||||
var paint = new SKPaint();
|
||||
paint.TextEncoding = SKTextEncoding.Utf32;
|
||||
paint.Typeface = SKFontManager.Default.MatchCharacter(emojiChar);
|
||||
paint.Typeface = typeface;
|
||||
|
||||
Assert.Equal(1, paint.CountGlyphs(text));
|
||||
Assert.Single(paint.GetGlyphs(text));
|
||||
Assert.NotEqual(0, paint.GetGlyphs(text)[0]);
|
||||
}
|
||||
|
||||
[SkippableFact]
|
||||
public void ContainsTextIsCorrect()
|
||||
{
|
||||
const string text = "A";
|
||||
|
||||
var paint = new SKPaint();
|
||||
paint.TextEncoding = SKTextEncoding.Utf32;
|
||||
paint.Typeface = SKTypeface.Default;
|
||||
|
||||
Assert.True(paint.ContainsGlyphs(text));
|
||||
}
|
||||
|
||||
[SkippableFact]
|
||||
[Feature(MatchCharacterFeature)]
|
||||
public void ContainsUnicodeTextIsCorrect()
|
||||
{
|
||||
const string text = "🚀";
|
||||
var emojiChar = StringUtilities.GetUnicodeCharacterCode(text, SKTextEncoding.Utf32);
|
||||
|
||||
var paint = new SKPaint();
|
||||
paint.TextEncoding = SKTextEncoding.Utf32;
|
||||
|
@ -278,8 +298,9 @@ namespace SkiaSharp.Tests
|
|||
Assert.False(paint.ContainsGlyphs(text));
|
||||
|
||||
// find a font with the character
|
||||
var emojiChar = StringUtilities.GetUnicodeCharacterCode(text, SKTextEncoding.Utf32);
|
||||
paint.Typeface = SKFontManager.Default.MatchCharacter(emojiChar);
|
||||
var typeface = SKFontManager.Default.MatchCharacter(emojiChar);
|
||||
Assert.NotNull(typeface);
|
||||
paint.Typeface = typeface;
|
||||
|
||||
Assert.True(paint.ContainsGlyphs(text));
|
||||
}
|
||||
|
@ -324,10 +345,7 @@ namespace SkiaSharp.Tests
|
|||
Assert.Equal(width8, width16);
|
||||
Assert.Equal(width8, width32);
|
||||
|
||||
Assert.NotEqual(0, bounds8.Left);
|
||||
Assert.NotEqual(0, bounds8.Top);
|
||||
Assert.NotEqual(0, bounds8.Width);
|
||||
Assert.NotEqual(0, bounds8.Height);
|
||||
Assert.NotEqual(SKRect.Empty, bounds8);
|
||||
Assert.Equal(bounds8, bounds16);
|
||||
Assert.Equal(bounds8, bounds32);
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using Xunit;
|
||||
using Xunit.Categories;
|
||||
|
||||
#if SYSTEM_DRAWING
|
||||
using System.Drawing;
|
||||
|
@ -253,7 +254,7 @@ namespace SkiaSharp.Tests
|
|||
}
|
||||
|
||||
[Obsolete]
|
||||
[Trait(Category, GpuCategory)]
|
||||
[Category(GpuCategory)]
|
||||
[SkippableFact]
|
||||
public void CanConvertFromPointerToDescToTextureWithNewInfo()
|
||||
{
|
||||
|
@ -296,7 +297,7 @@ namespace SkiaSharp.Tests
|
|||
}
|
||||
|
||||
[Obsolete]
|
||||
[Trait(Category, GpuCategory)]
|
||||
[Category(GpuCategory)]
|
||||
[SkippableFact]
|
||||
public void CanConvertFromPointerToDescToTexture()
|
||||
{
|
||||
|
@ -337,7 +338,7 @@ namespace SkiaSharp.Tests
|
|||
Assert.Equal(GRPixelConfig.Rgba8888.ToGlSizedFormat(), newInfo.Format);
|
||||
}
|
||||
|
||||
[Trait(Category, GpuCategory)]
|
||||
[Category(GpuCategory)]
|
||||
[SkippableFact]
|
||||
public void GpuBackendSurfaceIsCreated()
|
||||
{
|
||||
|
@ -352,7 +353,7 @@ namespace SkiaSharp.Tests
|
|||
});
|
||||
}
|
||||
|
||||
[Trait(Category, GpuCategory)]
|
||||
[Category(GpuCategory)]
|
||||
[SkippableFact]
|
||||
[Obsolete]
|
||||
public void GpuTextureSurfaceIsCreatedWithDesc()
|
||||
|
@ -368,7 +369,7 @@ namespace SkiaSharp.Tests
|
|||
});
|
||||
}
|
||||
|
||||
[Trait(Category, GpuCategory)]
|
||||
[Category(GpuCategory)]
|
||||
[SkippableFact]
|
||||
[Obsolete]
|
||||
public void GpuTextureSurfaceCanBeReadWithDesc()
|
||||
|
@ -397,7 +398,7 @@ namespace SkiaSharp.Tests
|
|||
});
|
||||
}
|
||||
|
||||
[Trait(Category, GpuCategory)]
|
||||
[Category(GpuCategory)]
|
||||
[SkippableFact]
|
||||
[Obsolete]
|
||||
public void GpuTextureSurfaceIsCreatedWithOldDesc()
|
||||
|
@ -413,7 +414,7 @@ namespace SkiaSharp.Tests
|
|||
});
|
||||
}
|
||||
|
||||
[Trait(Category, GpuCategory)]
|
||||
[Category(GpuCategory)]
|
||||
[SkippableFact]
|
||||
[Obsolete]
|
||||
public void GpuTextureSurfaceCanBeReadWithOldDesc()
|
||||
|
@ -442,7 +443,7 @@ namespace SkiaSharp.Tests
|
|||
});
|
||||
}
|
||||
|
||||
[Trait(Category, GpuCategory)]
|
||||
[Category(GpuCategory)]
|
||||
[SkippableFact]
|
||||
public void GpuTextureSurfaceIsCreated()
|
||||
{
|
||||
|
@ -457,7 +458,7 @@ namespace SkiaSharp.Tests
|
|||
});
|
||||
}
|
||||
|
||||
[Trait(Category, GpuCategory)]
|
||||
[Category(GpuCategory)]
|
||||
[SkippableFact]
|
||||
public void GpuTextureSurfaceCanBeRead()
|
||||
{
|
||||
|
|
|
@ -9,14 +9,15 @@ namespace SkiaSharp.Tests
|
|||
{
|
||||
public abstract class SKTest
|
||||
{
|
||||
protected const string Category = nameof(Category);
|
||||
protected const string GpuCategory = "GPU";
|
||||
protected const string MatchCharacterFeature = "MatchCharacter";
|
||||
|
||||
protected static bool IsLinux;
|
||||
protected static bool IsMac;
|
||||
protected static bool IsUnix;
|
||||
protected static bool IsWindows;
|
||||
|
||||
protected static readonly string[] UnicodeFontFamilies;
|
||||
protected static readonly string DefaultFontFamily;
|
||||
protected static readonly string PathToAssembly;
|
||||
protected static readonly string PathToFonts;
|
||||
|
@ -67,6 +68,10 @@ namespace SkiaSharp.Tests
|
|||
|
||||
// set the test fields
|
||||
DefaultFontFamily = IsLinux ? "DejaVu Sans" : "Arial";
|
||||
UnicodeFontFamilies =
|
||||
IsLinux ? new[] { "Symbola" } :
|
||||
IsMac ? new[] { "Apple Color Emoji" } :
|
||||
new[] { "Segoe UI Emoji", "Segoe UI Symbol" };
|
||||
}
|
||||
|
||||
protected static void SaveBitmap(SKBitmap bmp, string filename = "output.png")
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using Xunit;
|
||||
using Xunit.Categories;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Linq;
|
||||
|
@ -191,12 +192,14 @@ namespace SkiaSharp.Tests
|
|||
}
|
||||
|
||||
[SkippableFact]
|
||||
[Feature(MatchCharacterFeature)]
|
||||
public void UnicodeGlyphsReturnsTheCorrectNumberOfCharacters()
|
||||
{
|
||||
const string text = "🚀";
|
||||
var emojiChar = StringUtilities.GetUnicodeCharacterCode(text, SKTextEncoding.Utf32);
|
||||
|
||||
var typeface = SKFontManager.Default.MatchCharacter(emojiChar);
|
||||
Assert.NotNull(typeface);
|
||||
|
||||
Assert.True(typeface.CountGlyphs(text) > 0);
|
||||
Assert.True(typeface.CountGlyphs(text, SKEncoding.Utf32) > 0);
|
||||
|
|
Загрузка…
Ссылка в новой задаче