From e79452f32fb191935eeceeb0683dbc70032e088b Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Mon, 15 Oct 2018 19:14:51 +0200 Subject: [PATCH 1/9] First attempt at building a static Windows binary. #136 --- cake/BuildExternals.cake | 2 +- .../libHarfBuzzSharp_windows/libHarfBuzzSharp.vcxproj | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cake/BuildExternals.cake b/cake/BuildExternals.cake index a0d9e6a249..47ae94b72d 100644 --- a/cake/BuildExternals.cake +++ b/cake/BuildExternals.cake @@ -88,7 +88,7 @@ Task ("externals-windows") $"target_os='win' target_cpu='{skiaArch}' " + $"skia_use_icu=false skia_use_sfntly=false skia_use_piex=true skia_use_dng_sdk=true " + $"skia_use_system_expat=false skia_use_system_libjpeg_turbo=false skia_use_system_libpng=false skia_use_system_libwebp=false skia_use_system_zlib=false " + - $"extra_cflags=[ '-DSKIA_C_DLL', '/MD', '/EHsc', '/Z7' ] " + + $"extra_cflags=[ '-DSKIA_C_DLL', '/MT', '/EHsc', '/Z7' ] " + $"extra_ldflags=[ '/DEBUG:FULL' ]"); // copy libSkiaSharp to output diff --git a/native-builds/libHarfBuzzSharp_windows/libHarfBuzzSharp.vcxproj b/native-builds/libHarfBuzzSharp_windows/libHarfBuzzSharp.vcxproj index c7e1e709a2..c3e5389054 100644 --- a/native-builds/libHarfBuzzSharp_windows/libHarfBuzzSharp.vcxproj +++ b/native-builds/libHarfBuzzSharp_windows/libHarfBuzzSharp.vcxproj @@ -222,6 +222,7 @@ HAVE_UCDN=1;HAVE_CONFIG_H;HB_EXTERN=__declspec (dllexport) extern;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;WIN32;_DEBUG;_WINDOWS;_USRDLL;HARFBUZZ_EXPORTS;%(PreprocessorDefinitions) ..\..\externals\harfbuzz\harfbuzz\src\hb-ucdn;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) 4267;4244 + MultiThreadedDebug Windows @@ -236,6 +237,7 @@ HAVE_UCDN=1;HAVE_CONFIG_H;HB_EXTERN=__declspec (dllexport) extern;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;_DEBUG;_WINDOWS;_USRDLL;HARFBUZZ_EXPORTS;%(PreprocessorDefinitions) ..\..\externals\harfbuzz\harfbuzz\src\hb-ucdn;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) 4267;4244 + MultiThreadedDebug Windows @@ -252,6 +254,7 @@ HAVE_UCDN=1;HAVE_CONFIG_H;HB_EXTERN=__declspec (dllexport) extern;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;WIN32;NDEBUG;_WINDOWS;_USRDLL;HARFBUZZ_EXPORTS;%(PreprocessorDefinitions) ..\..\externals\harfbuzz\harfbuzz\src\hb-ucdn;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) 4267;4244 + MultiThreaded Windows @@ -270,6 +273,7 @@ HAVE_UCDN=1;HAVE_CONFIG_H;HB_EXTERN=__declspec (dllexport) extern;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;NDEBUG;_WINDOWS;_USRDLL;HARFBUZZ_EXPORTS;%(PreprocessorDefinitions) ..\..\externals\harfbuzz\harfbuzz\src\hb-ucdn;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) 4267;4244 + MultiThreaded Windows From 3f69cb0c96061e9222bc0a5deafee1dfbd0d6bf4 Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Fri, 19 Oct 2018 22:05:11 +0200 Subject: [PATCH 2/9] Add support for building a "feature" version --- build.cake | 18 ++++++++++++++---- scripts/pipeline.groovy | 17 +++++++++++++++-- 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/build.cake b/build.cake index f964131fe2..6aae23b37c 100644 --- a/build.cake +++ b/build.cake @@ -51,6 +51,7 @@ DirectoryPath PACKAGE_CACHE_PATH = MakeAbsolute(ROOT_PATH.Combine("externals/pac DirectoryPath PROFILE_PATH = EnvironmentVariable ("USERPROFILE") ?? EnvironmentVariable ("HOME"); DirectoryPath NUGET_PACKAGES = EnvironmentVariable ("NUGET_PACKAGES") ?? PROFILE_PATH.Combine (".nuget/packages"); +var FEATURE_NAME = EnvironmentVariable ("FEATURE_NAME") ?? ""; var BUILD_NUMBER = EnvironmentVariable ("BUILD_NUMBER") ?? ""; if (string.IsNullOrEmpty (BUILD_NUMBER)) { BUILD_NUMBER = "0"; @@ -312,7 +313,7 @@ Task ("nuget-only") } nuspecPlatform.Remove (); } - // copy the src arrtibute and set it for the target + // copy the src attribute and set it for the target file.Add (new XAttribute ("target", file.Attribute ("src").Value)); } }); @@ -359,15 +360,23 @@ Task ("nuget-only") if (id.Contains(".NativeAssets")) { dir = id.Substring(0, id.IndexOf(".NativeAssets")); } + var feature = ""; + if (!string.IsNullOrEmpty (FEATURE_NAME)) { + feature = $"-{FEATURE_NAME}"; + } + var preview = ""; + if (!string.IsNullOrEmpty (BUILD_NUMBER)) { + preview = $"-preview{BUILD_NUMBER}"; + } removePlatforms (xdoc); var outDir = $"./output/{dir}/nuget"; - setVersion (xdoc, ""); + setVersion (xdoc, $"{feature}"); xdoc.Save ($"{outDir}/{id}.nuspec"); - setVersion (xdoc, $"-preview{BUILD_NUMBER}"); + setVersion (xdoc, $"{preview}{feature}"); xdoc.Save ($"{outDir}/{id}.prerelease.nuspec"); // the legal @@ -505,7 +514,8 @@ var envVarsWhitelist = new [] { "path", "psmodulepath", "pwd", "shell", "processor_architecture", "processor_identifier", "node_name", "node_labels", "branch_name", "os", "build_url", "build_number", "number_of_processors", - "node_label", "build_id", "git_sha" + "node_label", "build_id", "git_sha", "git_branch_name", + "feature_name" }; var envVars = EnvironmentVariables (); var max = envVars.Max (v => v.Key.Length) + 2; diff --git a/scripts/pipeline.groovy b/scripts/pipeline.groovy index 917bb4713e..176f0a04c8 100644 --- a/scripts/pipeline.groovy +++ b/scripts/pipeline.groovy @@ -5,6 +5,9 @@ import groovy.transform.Field @Field def branchName = null @Field def commitHash = null @Field def githubStatusSha = null +@Field def featureName = null + +@Field def featureNamePrefix = "feature/" @Field def minimalLinuxPackages = "curl mono-complete msbuild" @Field def nativeLinuxPackages = "python git libfontconfig1-dev" @@ -42,13 +45,23 @@ node("ubuntu-1604-amd64") { isPr = env.ghprbPullId && !env.ghprbPullId.empty branchName = isPr ? "pr" : env.BRANCH_NAME githubStatusSha = isPr ? env.ghprbActualCommit : commitHash + featureName = branchName.startsWith(featureNamePrefix) + ? branchName.substring(featureNamePrefix.length()) + : "" echo "Building SHA1: ${commitHash}..." echo " - PR: ${isPr}" echo " - Branch Name: ${branchName}" echo " - GitHub Status SHA1: ${githubStatusSha}" - - customEnv.each { platform, vars -> vars.push("GIT_SHA=${commitHash}") } + echo " - Feature Name: ${featureName}" + + def newVars = [ + "GIT_SHA=${commitHash}", + "GIT_BRANCH_NAME=${branchName}", + "BUILD_NUMBER=${env.BUILD_NUMBER}", + "FEATURE_NAME=${featureName}", + ] + customEnv.each { platform, vars -> vars += newVars } } } From 13ddc5ab497eb85fd34a83ad611ec2b7a3a049d6 Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Sat, 20 Oct 2018 03:56:35 +0200 Subject: [PATCH 3/9] Update pipeline.groovy --- scripts/pipeline.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/pipeline.groovy b/scripts/pipeline.groovy index 176f0a04c8..fa8bc3c30f 100644 --- a/scripts/pipeline.groovy +++ b/scripts/pipeline.groovy @@ -1,6 +1,6 @@ import groovy.transform.Field -@Field def verbosity = "minimal" +@Field def verbosity = "normal" @Field def isPr = false @Field def branchName = null @Field def commitHash = null From 97f67eb0e52fb2c47063090c2807be4c97dbe652 Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Sat, 20 Oct 2018 13:15:04 +0200 Subject: [PATCH 4/9] Update pipeline.groovy --- scripts/pipeline.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/pipeline.groovy b/scripts/pipeline.groovy index fa8bc3c30f..5688ae9ef7 100644 --- a/scripts/pipeline.groovy +++ b/scripts/pipeline.groovy @@ -61,7 +61,7 @@ node("ubuntu-1604-amd64") { "BUILD_NUMBER=${env.BUILD_NUMBER}", "FEATURE_NAME=${featureName}", ] - customEnv.each { platform, vars -> vars += newVars } + customEnv.each { platform, vars -> vars.addAll(newVars) } } } From 932cb042eedd3bb9d753e18ce469af571780b620 Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Sun, 21 Oct 2018 00:41:01 +0200 Subject: [PATCH 5/9] Update build.cake --- build.cake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.cake b/build.cake index 6aae23b37c..c76d28997d 100644 --- a/build.cake +++ b/build.cake @@ -373,7 +373,7 @@ Task ("nuget-only") var outDir = $"./output/{dir}/nuget"; - setVersion (xdoc, $"{feature}"); + setVersion (xdoc, ""); xdoc.Save ($"{outDir}/{id}.nuspec"); setVersion (xdoc, $"{preview}{feature}"); From c0d37901a9361692d29e9f9c6c58f426bc07afef Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Sun, 21 Oct 2018 13:23:05 +0000 Subject: [PATCH 6/9] Update pipeline.groovy --- scripts/pipeline.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/pipeline.groovy b/scripts/pipeline.groovy index 5688ae9ef7..fcf68ff9db 100644 --- a/scripts/pipeline.groovy +++ b/scripts/pipeline.groovy @@ -255,7 +255,7 @@ def bootstrapper(args, host, pre, additionalPackages) { if (host == "linux") { chroot( chrootName: "${env.NODE_LABEL}-stable", - command: "bash ${pre} ./bootstrapper.sh ${args}", + command: "bash ${customEnv[host].join()} ${pre} ./bootstrapper.sh ${args}", additionalPackages: "${minimalLinuxPackages} ${additionalPackages}") } else if (host == "macos") { sh("bash ${pre} ./bootstrapper.sh ${args}") From fffe7784f7a20b3d64375c737b3bb2d959a9ed63 Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Sun, 21 Oct 2018 13:25:45 +0000 Subject: [PATCH 7/9] Update pipeline.groovy --- scripts/pipeline.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/pipeline.groovy b/scripts/pipeline.groovy index fcf68ff9db..fe1897e9aa 100644 --- a/scripts/pipeline.groovy +++ b/scripts/pipeline.groovy @@ -255,7 +255,7 @@ def bootstrapper(args, host, pre, additionalPackages) { if (host == "linux") { chroot( chrootName: "${env.NODE_LABEL}-stable", - command: "bash ${customEnv[host].join()} ${pre} ./bootstrapper.sh ${args}", + command: "bash ${customEnv[host].join(" ")} ${pre} ./bootstrapper.sh ${args}", additionalPackages: "${minimalLinuxPackages} ${additionalPackages}") } else if (host == "macos") { sh("bash ${pre} ./bootstrapper.sh ${args}") From d1e85b595705c000d2eee85442b1e17300c08409 Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Sun, 21 Oct 2018 13:42:42 +0000 Subject: [PATCH 8/9] Update pipeline.groovy --- scripts/pipeline.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/pipeline.groovy b/scripts/pipeline.groovy index fe1897e9aa..a5e0539db0 100644 --- a/scripts/pipeline.groovy +++ b/scripts/pipeline.groovy @@ -255,7 +255,7 @@ def bootstrapper(args, host, pre, additionalPackages) { if (host == "linux") { chroot( chrootName: "${env.NODE_LABEL}-stable", - command: "bash ${customEnv[host].join(" ")} ${pre} ./bootstrapper.sh ${args}", + command: " ${customEnv[host].join(" ")} bash ${pre} ./bootstrapper.sh ${args}", additionalPackages: "${minimalLinuxPackages} ${additionalPackages}") } else if (host == "macos") { sh("bash ${pre} ./bootstrapper.sh ${args}") From ad2f4ea86a286d65d2d3f6e954643f9979aa3042 Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Mon, 22 Oct 2018 15:51:01 -0400 Subject: [PATCH 9/9] improve the feature "tag" in the nuget version --- build.cake | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/build.cake b/build.cake index c76d28997d..0c733af9cf 100644 --- a/build.cake +++ b/build.cake @@ -360,13 +360,15 @@ Task ("nuget-only") if (id.Contains(".NativeAssets")) { dir = id.Substring(0, id.IndexOf(".NativeAssets")); } - var feature = ""; + + var preview = ""; if (!string.IsNullOrEmpty (FEATURE_NAME)) { - feature = $"-{FEATURE_NAME}"; + preview += $"-{FEATURE_NAME}-featurepreview"; + } else { + preview += $"-preview"; } - var preview = ""; if (!string.IsNullOrEmpty (BUILD_NUMBER)) { - preview = $"-preview{BUILD_NUMBER}"; + preview += $"{BUILD_NUMBER}"; } removePlatforms (xdoc); @@ -376,7 +378,7 @@ Task ("nuget-only") setVersion (xdoc, ""); xdoc.Save ($"{outDir}/{id}.nuspec"); - setVersion (xdoc, $"{preview}{feature}"); + setVersion (xdoc, $"{preview}"); xdoc.Save ($"{outDir}/{id}.prerelease.nuspec"); // the legal