Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure that the assemblies are in fact signed #1268

Merged
merged 7 commits into from
May 2, 2020
Merged
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
36 changes: 18 additions & 18 deletions VERSIONS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,26 @@ HarfBuzz soname 0.20601.0

# SkiaSharp.dll
SkiaSharp assembly 1.68.0.0
SkiaSharp file 1.68.2.0
SkiaSharp file 1.68.2.1
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bump the versions... Pity to do it so soon.


# HarfBuzzSharp.dll
HarfBuzzSharp assembly 1.0.0.0
HarfBuzzSharp file 2.6.1.2
HarfBuzzSharp file 2.6.1.3

# nuget versions
SkiaSharp nuget 1.68.2
SkiaSharp.NativeAssets.Linux nuget 1.68.2
SkiaSharp.NativeAssets.Linux.NoDependencies nuget 1.68.2
SkiaSharp.NativeAssets.NanoServer nuget 1.68.2
SkiaSharp.Views nuget 1.68.2
SkiaSharp.Views.Desktop.Common nuget 1.68.2
SkiaSharp.Views.Gtk2 nuget 1.68.2
SkiaSharp.Views.Gtk3 nuget 1.68.2
SkiaSharp.Views.WindowsForms nuget 1.68.2
SkiaSharp.Views.WPF nuget 1.68.2
SkiaSharp.Views.Forms nuget 1.68.2
SkiaSharp.Views.Forms.WPF nuget 1.68.2
SkiaSharp.Views.Forms.GTK nuget 1.68.2
SkiaSharp.HarfBuzz nuget 1.68.2
HarfBuzzSharp nuget 2.6.1.2
HarfBuzzSharp.NativeAssets.Linux nuget 2.6.1.2
SkiaSharp nuget 1.68.2.1
SkiaSharp.NativeAssets.Linux nuget 1.68.2.1
SkiaSharp.NativeAssets.Linux.NoDependencies nuget 1.68.2.1
SkiaSharp.NativeAssets.NanoServer nuget 1.68.2.1
SkiaSharp.Views nuget 1.68.2.1
SkiaSharp.Views.Desktop.Common nuget 1.68.2.1
SkiaSharp.Views.Gtk2 nuget 1.68.2.1
SkiaSharp.Views.Gtk3 nuget 1.68.2.1
SkiaSharp.Views.WindowsForms nuget 1.68.2.1
SkiaSharp.Views.WPF nuget 1.68.2.1
SkiaSharp.Views.Forms nuget 1.68.2.1
SkiaSharp.Views.Forms.WPF nuget 1.68.2.1
SkiaSharp.Views.Forms.GTK nuget 1.68.2.1
SkiaSharp.HarfBuzz nuget 1.68.2.1
HarfBuzzSharp nuget 2.6.1.3
HarfBuzzSharp.NativeAssets.Linux nuget 2.6.1.3
10 changes: 7 additions & 3 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ Task ("libs")
platform = ".Linux";
}
}
RunMSBuild ($"./source/SkiaSharpSource{platform}.sln");
RunMSBuild ($"./source/SkiaSharpSource{platform}.sln",
bl: $"./output/binlogs/libs{platform}.binlog");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Get those binlogs.


// assemble the mdoc docs
EnsureDirectoryExists ("./output/docs/mdoc/");
Expand All @@ -142,7 +143,9 @@ Task ("tests")

void RunDesktopTest (string arch)
{
RunMSBuild ("./tests/SkiaSharp.Desktop.Tests/SkiaSharp.Desktop.Tests.sln", platform: arch == "AnyCPU" ? "Any CPU" : arch);
RunMSBuild ("./tests/SkiaSharp.Desktop.Tests/SkiaSharp.Desktop.Tests.sln",
platform: arch == "AnyCPU" ? "Any CPU" : arch,
bl: $"./output/binlogs/tests-desktop.{arch}.binlog");
try {
RunTests ($"./tests/SkiaSharp.Desktop.Tests/bin/{arch}/{CONFIGURATION}/SkiaSharp.Tests.dll", arch == "x86");
} catch {
Expand All @@ -164,7 +167,8 @@ Task ("tests")
}

// .NET Core
RunMSBuild ("./tests/SkiaSharp.NetCore.Tests/SkiaSharp.NetCore.Tests.sln");
RunMSBuild ("./tests/SkiaSharp.NetCore.Tests/SkiaSharp.NetCore.Tests.sln",
bl: $"./output/binlogs/tests-netcore.binlog");
try {
RunNetCoreTests ("./tests/SkiaSharp.NetCore.Tests/SkiaSharp.NetCore.Tests.csproj");
} catch {
Expand Down
1 change: 1 addition & 0 deletions cake/UpdateDocs.cake
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ Task ("docs-api-diff")

// pretty version
var diffDir = "./output/api-diff";
EnsureDirectoryExists (diffDir);
CleanDirectories (diffDir);

Information ($"Creating comparer...");
Expand Down
10 changes: 9 additions & 1 deletion cake/msbuild.cake
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ void RunMSBuild(
string platform = "Any CPU",
string platformTarget = null,
bool restore = true,
bool restoreOnly = false)
bool restoreOnly = false,
string bl = null)
{
var nugetSources = new [] { OUTPUT_NUGETS_PATH.FullPath, "https://api.nuget.org/v3/index.json" };

Expand All @@ -17,6 +18,13 @@ void RunMSBuild(
c.Verbosity = VERBOSITY;
c.MaxCpuCount = 0;

if (!string.IsNullOrEmpty(bl)) {
c.BinaryLogger = new MSBuildBinaryLogSettings {
Enabled = true,
FileName = bl,
};
}

if (!string.IsNullOrEmpty(MSBUILD_EXE)) {
c.ToolPath = MSBUILD_EXE;
} else if (IsRunningOnWindows() && !string.IsNullOrEmpty(VS_INSTALL)) {
Expand Down
2 changes: 1 addition & 1 deletion scripts/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pr:
- patch/*

variables:
SKIASHARP_VERSION: 1.68.2
SKIASHARP_VERSION: 1.68.2.1
FEATURE_NAME_PREFIX: 'feature/'
VERBOSITY: normal
GIT_SHA: $(Build.SourceVersion)
Expand Down
29 changes: 22 additions & 7 deletions source/SkiaSharp.Build.targets
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
<Project>

<PropertyGroup>
<_ManagedExeLauncher Condition=" '$(OS)' != 'Windows_NT' And Exists ('/Library/Frameworks/Mono.framework/Versions/Current/bin/mono') ">/Library/Frameworks/Mono.framework/Versions/Current/bin/mono</_ManagedExeLauncher>
<_ManagedExeLauncher Condition=" '$(OS)' != 'Windows_NT' And Exists ('/usr/local/bin/mono') ">/usr/local/bin/mono</_ManagedExeLauncher>
<_ManagedExeLauncher Condition=" '$(OS)' != 'Windows_NT' And Exists ('/usr/bin/mono') ">/usr/bin/mono</_ManagedExeLauncher>
<_ManagedExeLauncher Condition=" '$(OS)' != 'Windows_NT' And '$(_ManagedExeLauncher)' == '' ">mono</_ManagedExeLauncher>
<_ManagedExeLauncher Condition=" '$(OS)' != 'Windows_NT' and Exists('/Library/Frameworks/Mono.framework/Versions/Current/bin/mono') ">/Library/Frameworks/Mono.framework/Versions/Current/bin/mono</_ManagedExeLauncher>
<_ManagedExeLauncher Condition=" '$(OS)' != 'Windows_NT' and Exists('/usr/local/bin/mono') ">/usr/local/bin/mono</_ManagedExeLauncher>
<_ManagedExeLauncher Condition=" '$(OS)' != 'Windows_NT' and Exists('/usr/bin/mono') ">/usr/bin/mono</_ManagedExeLauncher>
<_ManagedExeLauncher Condition=" '$(OS)' != 'Windows_NT' and '$(_ManagedExeLauncher)' == '' ">mono</_ManagedExeLauncher>

<PublicSign Condition=" '$(PublicSign)' == '' and '$(SignAssembly)' == 'true' and '$(OS)' != 'Windows_NT' ">true</PublicSign>
<_SnExePath Condition=" '$(OS)' == 'Windows_NT' and '$(_SnExePath)' == '' and Exists('$(SDK40ToolsPath)sn.exe') ">$(SDK40ToolsPath)sn.exe</_SnExePath>
<_SnExePath Condition=" '$(OS)' == 'Windows_NT' and '$(_SnExePath)' == '' and Exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\sn.exe') ">$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\sn.exe</_SnExePath>
<_SnExePath Condition=" '$(_SnExePath)' == '' ">sn</_SnExePath>
Comment on lines +9 to +11
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Find the location of sn.exe


<PublicSign Condition=" '$(PublicSign)' == '' and '$(SignAssembly)' == 'true' ">true</PublicSign>
<KeyFileName Condition=" '$(KeyFileName)' == '' ">mono.snk</KeyFileName>
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)..\$(KeyFileName)</AssemblyOriginatorKeyFile>

Expand Down Expand Up @@ -90,8 +94,19 @@
Sign the assembly using sn.
===================================================================================================================
-->
<Target Name="_SignAssembly" AfterTargets="CoreCompile" Condition=" '$(IsWindows)' != 'true' and '$(SignAssembly)' == 'true' ">
<Exec Command="sn -q -R @(IntermediateAssembly -> '&quot;%(Identity)&quot;') &quot;$(AssemblyOriginatorKeyFile)&quot;" />
<Target Name="_SignAssembly" AfterTargets="CoreCompile" DependsOnTargets="_RedirectMovedTypes" Condition=" '$(SignAssembly)' == 'true' ">
<Exec Command="&quot;$(_SnExePath)&quot; -q -R @(IntermediateAssembly -> '&quot;%(Identity)&quot;') &quot;$(AssemblyOriginatorKeyFile)&quot;" />
</Target>

<!--
===================================================================================================================
_SignAssemblyVerify

Verify that the output assembly is signed correctly for release.
===================================================================================================================
-->
<Target Name="_SignAssemblyVerify" AfterTargets="Build" Condition=" '$(SignAssembly)' == 'true' and '$(Configuration)' == 'Release' and '$(TargetPath)' != '' ">
<Exec Command="&quot;$(_SnExePath)&quot; -vf &quot;$(TargetPath)&quot;" />
</Target>
Comment on lines +108 to 110
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERIFY!

this does slow down the build loop by a few ms, but better safe than sorry!


<!--
Expand Down