From ad36ed7111cf86bb5c24799aafdf65e4cd7c498a Mon Sep 17 00:00:00 2001 From: Christoph Ruegg Date: Sat, 24 Feb 2018 10:47:11 +0100 Subject: [PATCH] Build: prevent rebuild in pack command to ensure NuGet assemblies are really code-signed --- build/build-framework.fsx | 47 +++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/build/build-framework.fsx b/build/build-framework.fsx index 515752ac..9d0770cd 100644 --- a/build/build-framework.fsx +++ b/build/build-framework.fsx @@ -24,8 +24,9 @@ open Fake.Testing.NUnit3 open System open System.IO -Environment.CurrentDirectory <- Path.Combine (__SOURCE_DIRECTORY__ + "/../") -trace Environment.CurrentDirectory +let rootDir = Path.GetFullPath (Path.Combine (__SOURCE_DIRECTORY__ + "/../")) +Environment.CurrentDirectory <- rootDir +trace rootDir let header = ReadFile(__SOURCE_DIRECTORY__ __SOURCE_FILE__) |> Seq.take 10 |> Seq.map (fun s -> s.Substring(2)) |> toLines @@ -73,6 +74,7 @@ let traceHeader (releases:Release list) = trace ([ " "; release.Title.PadRight titleLength; " v"; release.PackageVersion ] |> String.concat "") trace "" + // -------------------------------------------------------------------------------------- // TARGET FRAMEWORKS // -------------------------------------------------------------------------------------- @@ -90,6 +92,27 @@ let libpcl259 = "lib/portable-net45+netcore45+wpa81+wp8+MonoAndroid1+MonoTouch1" let libpcl328 = "lib/portable-net4+sl5+netcore45+wpa81+wp8+MonoAndroid1+MonoTouch1" +// -------------------------------------------------------------------------------------- +// .Net SDK +// -------------------------------------------------------------------------------------- + +let msbuild targets configuration project = + MSBuildHelper.build (fun p -> + { p with + NoLogo = true + NodeReuse = true + Targets = targets + Properties = [ "Configuration", configuration ] + RestorePackagesFlag = false + Verbosity = Some MSBuildVerbosity.Minimal + }) project + +let dotnet workingDir command = + DotNetCli.RunCommand + (fun c -> { c with WorkingDir = workingDir}) + command + + // -------------------------------------------------------------------------------------- // PREPARE // -------------------------------------------------------------------------------------- @@ -128,25 +151,15 @@ let patchVersionInProjectFile path (release:Release) = >> regex_replace_singleline """\.*\""" (sprintf """%s""" release.ReleaseNotes)) path + // -------------------------------------------------------------------------------------- // BUILD // -------------------------------------------------------------------------------------- -let msbuild targets configuration project = - MSBuildHelper.build (fun p -> - { p with - NoLogo = true - NodeReuse = true - Targets = targets - Properties = [ "Configuration", configuration ] - RestorePackagesFlag = false - Verbosity = Some MSBuildVerbosity.Minimal - }) project - let clean project = msbuild [ "Clean" ] "Release" project let restore project = msbuild [ "Restore" ] "Release" project let build project = msbuild [ (if hasBuildParam "incremental" then "Build" else "Rebuild") ] "Release" project -let pack project = msbuild [ "Pack" ] "Release" project +let pack project = dotnet rootDir (sprintf "pack %s --configuration Release --no-restore --no-build" project) //let buildConfig config subject = MSBuild "" (if hasBuildParam "incremental" then "Build" else "Rebuild") [ "Configuration", config ] subject |> ignore //let build subject = buildConfig "Release" subject @@ -160,11 +173,7 @@ let buildConfig64 config subject = MSBuild "" (if hasBuildParam "incremental" th // -------------------------------------------------------------------------------------- let test testsDir testsProj framework = - DotNetCli.RunCommand - (fun c -> { c with WorkingDir = testsDir}) - (sprintf "run -p %s --configuration Release --framework %s --no-restore --no-build" - testsProj - framework) + dotnet testsDir (sprintf "run -p %s --configuration Release --framework %s --no-restore --no-build" testsProj framework) // --------------------------------------------------------------------------------------