From 826f2e3fa129173d3f12500cf24b16c5b9cbc5c5 Mon Sep 17 00:00:00 2001 From: Christoph Ruegg Date: Tue, 3 Jan 2017 14:25:20 +0100 Subject: [PATCH] Build: separate logic from configuration --- MathNet.Numerics.sln | 1 + build.fsx | 411 ++++++-------------------------------- build/build-framework.fsx | 342 +++++++++++++++++++++++++++++++ 3 files changed, 409 insertions(+), 345 deletions(-) create mode 100644 build/build-framework.fsx diff --git a/MathNet.Numerics.sln b/MathNet.Numerics.sln index 60becc8c..49fdaa22 100644 --- a/MathNet.Numerics.sln +++ b/MathNet.Numerics.sln @@ -27,6 +27,7 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{A4A66FA9-C00C-4D5C-A776-27516EA0C536}" ProjectSection(SolutionItems) = preProject docs\tools\build-docs.fsx = docs\tools\build-docs.fsx + build\build-framework.fsx = build\build-framework.fsx build.fsx = build.fsx build\MathNet.Numerics.Extension.nuspec = build\MathNet.Numerics.Extension.nuspec build\MathNet.Numerics.nuspec = build\MathNet.Numerics.nuspec diff --git a/build.fsx b/build.fsx index eabf793b..b64b9f0a 100644 --- a/build.fsx +++ b/build.fsx @@ -20,16 +20,11 @@ open Fake open Fake.DocuHelper -open Fake.AssemblyInfoFile -open Fake.ReleaseNotesHelper -open Fake.StringHelper -open Fake.Testing.NUnit3 open System open System.IO -Environment.CurrentDirectory <- __SOURCE_DIRECTORY__ -let header = ReadFile(__SOURCE_DIRECTORY__ "build.fsx") |> Seq.take 10 |> Seq.map (fun s -> s.Substring(2)) |> toLines -trace header +#load "build/build-framework.fsx" +open BuildFramework // -------------------------------------------------------------------------------------- @@ -38,65 +33,22 @@ trace header // VERSION OVERVIEW -let release = LoadReleaseNotes "RELEASENOTES.md" -let buildPart = "0" -let assemblyVersion = release.AssemblyVersion + "." + buildPart -let packageVersion = release.NugetVersion -let releaseNotes = release.Notes |> List.map (fun l -> l.Replace("*","").Replace("`","")) |> toLines -trace (sprintf " Math.NET Numerics v%s" packageVersion) - -let mklRelease = LoadReleaseNotes "RELEASENOTES-MKL.md" -let mklBuildPart = "0" -let mklAssemblyVersion = mklRelease.AssemblyVersion + "." + mklBuildPart -let mklPackageVersion = mklRelease.NugetVersion -let mklReleaseNotes = mklRelease.Notes |> List.map (fun l -> l.Replace("*","").Replace("`","")) |> toLines -trace (sprintf " Math.NET Numerics MKL Provider v%s" mklPackageVersion) - -let cudaRelease = LoadReleaseNotes "RELEASENOTES-CUDA.md" -let cudaBuildPart = "0" -let cudaAssemblyVersion = cudaRelease.AssemblyVersion + "." + cudaBuildPart -let cudaPackageVersion = cudaRelease.NugetVersion -let cudaReleaseNotes = cudaRelease.Notes |> List.map (fun l -> l.Replace("*","").Replace("`","")) |> toLines -trace (sprintf " Math.NET Numerics CUDA Provider v%s" cudaPackageVersion) - -let openBlasRelease = LoadReleaseNotes "RELEASENOTES-OpenBLAS.md" -let openBlasBuildPart = "0" -let openBlasAssemblyVersion = openBlasRelease.AssemblyVersion + "." + openBlasBuildPart -let openBlasPackageVersion = openBlasRelease.NugetVersion -let openBlasReleaseNotes = openBlasRelease.Notes |> List.map (fun l -> l.Replace("*","").Replace("`","")) |> toLines -trace (sprintf " Math.NET Numerics OpenBLAS Provider v%s" openBlasPackageVersion) - -let dataRelease = LoadReleaseNotes "RELEASENOTES-Data.md" -let dataBuildPart = "0" -let dataAssemblyVersion = dataRelease.AssemblyVersion + "." + dataBuildPart -let dataPackageVersion = dataRelease.NugetVersion -let dataReleaseNotes = dataRelease.Notes |> List.map (fun l -> l.Replace("*","").Replace("`","")) |> toLines -trace (sprintf " Math.NET Numerics Data Extensions v%s" dataPackageVersion) +let numericsRelease = release "RELEASENOTES.md" +let mklRelease = release "RELEASENOTES-MKL.md" +let cudaRelease = release "RELEASENOTES-CUDA.md" +let openBlasRelease = release "RELEASENOTES-OpenBLAS.md" +let dataRelease = release "RELEASENOTES-Data.md" + +trace (sprintf " Math.NET Numerics v%s" numericsRelease.PackageVersion) +trace (sprintf " Math.NET Numerics MKL Provider v%s" mklRelease.PackageVersion) +trace (sprintf " Math.NET Numerics CUDA Provider v%s" cudaRelease.PackageVersion) +trace (sprintf " Math.NET Numerics OpenBLAS Provider v%s" openBlasRelease.PackageVersion) +trace (sprintf " Math.NET Numerics Data Extensions v%s" dataRelease.PackageVersion) trace "" // CORE PACKAGES -type Package = - { Id: string - Version: string - Title: string - Summary: string - Description: string - ReleaseNotes: string - Tags: string - Authors: string list - Dependencies: NugetFrameworkDependencies list - Files: (string * string option * string option) list } - -type Bundle = - { Id: string - Version: string - Title: string - ReleaseNotesFile: string - FsLoader: bool - Packages: Package list } - let summary = "Math.NET Numerics, providing methods and algorithms for numerical computations in science, engineering and every day use." let description = "Math.NET Numerics is the numerical foundation of the Math.NET project, aiming to provide methods and algorithms for numerical computations in science, engineering and every day use. " let support = "Supports .Net 4.0, .Net 3.5 and Mono on Windows, Linux and Mac; Silverlight 5, WindowsPhone/SL 8, WindowsPhone 8.1 and Windows 8 with PCL portable profiles 7, 47, 78, 259 and 328; Android/iOS with Xamarin." @@ -104,24 +56,16 @@ let supportFsharp = "Supports F# 3.0 on .Net 4.0, .Net 3.5 and Mono on Windows, let supportSigned = "Supports .Net 4.0." let tags = "math numeric statistics probability integration interpolation regression solve fit linear algebra matrix fft" -let libnet35 = "lib/net35" -let libnet40 = "lib/net40" -let libnet45 = "lib/net45" -let libpcl7 = "lib/portable-net45+netcore45+MonoAndroid1+MonoTouch1" -let libpcl47 = "lib/portable-net45+sl5+netcore45+MonoAndroid1+MonoTouch1" -let libpcl78 = "lib/portable-net45+netcore45+wp8+MonoAndroid1+MonoTouch1" -let libpcl259 = "lib/portable-net45+netcore45+wpa81+wp8+MonoAndroid1+MonoTouch1" -let libpcl328 = "lib/portable-net4+sl5+netcore45+wpa81+wp8+MonoAndroid1+MonoTouch1" - let numericsPack = { Id = "MathNet.Numerics" - Version = packageVersion + Version = numericsRelease.PackageVersion Title = "Math.NET Numerics" Summary = summary Description = description + support - ReleaseNotes = releaseNotes + ReleaseNotes = numericsRelease.ReleaseNotes Tags = tags Authors = [ "Christoph Ruegg"; "Marcus Cuda"; "Jurgen Van Gael" ] + FsLoader = false Dependencies = [ { FrameworkVersion="net35" Dependencies=[ "TaskParallelLibrary", GetPackageVersion "./packages/" "TaskParallelLibrary" ] } @@ -144,9 +88,10 @@ let fsharpPack = Summary = "F# Modules for " + summary Description = description + supportFsharp Tags = "fsharp F# " + tags + FsLoader = true Dependencies = [ { FrameworkVersion="" - Dependencies=[ "MathNet.Numerics", RequireExactly packageVersion + Dependencies=[ "MathNet.Numerics", RequireExactly numericsRelease.PackageVersion "FSharp.Core", GetPackageVersion "./packages/" "FSharp.Core" ] } ] Files = [ @"..\..\out\lib\Net35\MathNet.Numerics.FSharp.*", Some libnet35, None; @@ -175,7 +120,7 @@ let fsharpSignedPack = Tags = fsharpPack.Tags + " signed" Dependencies = [ { FrameworkVersion="" - Dependencies=[ "MathNet.Numerics.Signed", RequireExactly packageVersion + Dependencies=[ "MathNet.Numerics.Signed", RequireExactly numericsRelease.PackageVersion "FSharp.Core", GetPackageVersion "./packages/" "FSharp.Core" ] } ] Files = [ @"..\..\out\lib-signed\Net40\MathNet.Numerics.FSharp.*", Some libnet40, None; @@ -185,18 +130,16 @@ let fsharpSignedPack = let coreBundle = { Id = numericsPack.Id - Version = packageVersion + Version = numericsRelease.PackageVersion Title = numericsPack.Title ReleaseNotesFile = "RELEASENOTES.md" - FsLoader = true Packages = [ numericsPack; fsharpPack ] } let coreSignedBundle = { Id = numericsSignedPack.Id - Version = packageVersion + Version = numericsRelease.PackageVersion Title = numericsSignedPack.Title ReleaseNotesFile = "RELEASENOTES.md" - FsLoader = true Packages = [ numericsSignedPack; fsharpSignedPack ] } @@ -204,13 +147,14 @@ let coreSignedBundle = let mklWinPack = { Id = "MathNet.Numerics.MKL.Win" - Version = mklPackageVersion + Version = mklRelease.PackageVersion Title = "Math.NET Numerics - MKL Native Provider for Windows (x64 and x86)" Summary = "" Description = "Intel MKL native libraries for Math.NET Numerics on Windows." - ReleaseNotes = mklReleaseNotes + ReleaseNotes = mklRelease.ReleaseNotes Tags = "math numeric statistics probability integration interpolation linear algebra matrix fft native mkl" Authors = [ "Christoph Ruegg"; "Marcus Cuda"; "Jurgen Van Gael" ] + FsLoader = false Dependencies = [] Files = [ @"..\..\build\NativeProvider.targets", Some "build\MathNet.Numerics.MKL.Win.targets", None; @@ -239,13 +183,14 @@ let mklWin64Pack = let mklLinuxPack = { Id = "MathNet.Numerics.MKL.Linux" - Version = mklPackageVersion + Version = mklRelease.PackageVersion Title = "Math.NET Numerics - MKL Native Provider for Linux (x64 and x86)" Summary = "" Description = "Intel MKL native libraries for Math.NET Numerics on Linux." - ReleaseNotes = mklReleaseNotes + ReleaseNotes = mklRelease.ReleaseNotes Tags = "math numeric statistics probability integration interpolation linear algebra matrix fft native mkl" Authors = [ "Christoph Ruegg"; "Marcus Cuda"; "Jurgen Van Gael" ] + FsLoader = false Dependencies = [] Files = [ @"..\..\build\NativeProvider.targets", Some "build\MathNet.Numerics.MKL.Linux.targets", None; @@ -274,18 +219,16 @@ let mklLinux64Pack = let mklWinBundle = { Id = "MathNet.Numerics.MKL.Win" - Version = mklPackageVersion + Version = mklRelease.PackageVersion Title = "Math.NET Numerics MKL Native Provider for Windows" ReleaseNotesFile = "RELEASENOTES-MKL.md" - FsLoader = false Packages = [ mklWinPack; mklWin32Pack; mklWin64Pack ] } let mklLinuxBundle = { Id = "MathNet.Numerics.MKL.Linux" - Version = mklPackageVersion + Version = mklRelease.PackageVersion Title = "Math.NET Numerics MKL Native Provider for Linux" ReleaseNotesFile = "RELEASENOTES-MKL.md" - FsLoader = false Packages = [ mklLinuxPack; mklLinux32Pack; mklLinux64Pack ] } @@ -293,13 +236,14 @@ let mklLinuxBundle = let cudaWinPack = { Id = "MathNet.Numerics.CUDA.Win" - Version = cudaPackageVersion + Version = cudaRelease.PackageVersion Title = "Math.NET Numerics - CUDA Native Provider for Windows (x64)" Summary = "" Description = "Nvidia CUDA native libraries for Math.NET Numerics." - ReleaseNotes = cudaReleaseNotes + ReleaseNotes = cudaRelease.ReleaseNotes Tags = "math numeric statistics probability integration interpolation linear algebra matrix fft native cuda gpu" Authors = [ "Matthew A Johnson"; "Christoph Ruegg" ] + FsLoader = false Dependencies = [] Files = [ @"..\..\build\NativeProvider.targets", Some "build\MathNet.Numerics.CUDA.Win.targets", None; @@ -310,10 +254,9 @@ let cudaWinPack = let cudaWinBundle = { Id = "MathNet.Numerics.CUDA.Win" - Version = cudaPackageVersion + Version = cudaRelease.PackageVersion Title = "Math.NET Numerics CUDA Native Provider for Windows" ReleaseNotesFile = "RELEASENOTES-CUDA.md" - FsLoader = false Packages = [ cudaWinPack ] } @@ -321,13 +264,14 @@ let cudaWinBundle = let openBlasWinPack = { Id = "MathNet.Numerics.OpenBLAS.Win" - Version = openBlasPackageVersion + Version = openBlasRelease.PackageVersion Title = "Math.NET Numerics - OpenBLAS Native Provider for Windows (x64 and x86)" Summary = "" Description = "OpenBLAS native libraries for Math.NET Numerics." - ReleaseNotes = openBlasReleaseNotes + ReleaseNotes = openBlasRelease.ReleaseNotes Tags = "math numeric statistics probability integration interpolation linear algebra matrix fft native openblas" Authors = [ "Kuan Bartel"; "Christoph Ruegg"; "Marcus Cuda" ] + FsLoader = false Dependencies = [] Files = [ @"..\..\build\NativeProvider.targets", Some "build\MathNet.Numerics.OpenBLAS.Win.targets", None; @@ -344,10 +288,9 @@ let openBlasWinPack = let openBlasWinBundle = { Id = "MathNet.Numerics.OpenBLAS.Win" - Version = openBlasPackageVersion + Version = openBlasRelease.PackageVersion Title = "Math.NET Numerics OpenBLAS Native Provider for Windows" ReleaseNotesFile = "RELEASENOTES-OpenBLAS.md" - FsLoader = false Packages = [ openBlasWinPack ] } @@ -355,13 +298,14 @@ let openBlasWinBundle = let dataTextPack = { Id = "MathNet.Numerics.Data.Text" - Version = dataPackageVersion + Version = dataRelease.PackageVersion Title = "Math.NET Numerics - Text Data I/O Extensions" Summary = "" Description = "Text Data Input/Output Extensions for Math.NET Numerics, the numerical foundation of the Math.NET project, aiming to provide methods and algorithms for numerical computations in science, engineering and every day use." - ReleaseNotes = dataReleaseNotes + ReleaseNotes = dataRelease.ReleaseNotes Tags = "math numeric data text csv tsv json xml" Authors = [ "Christoph Ruegg"; "Marcus Cuda" ] + FsLoader = false Dependencies = [ { FrameworkVersion="" Dependencies=[ "MathNet.Numerics", GetPackageVersion "./packages/data/" "MathNet.Numerics" ] } ] @@ -371,13 +315,14 @@ let dataTextPack = let dataMatlabPack = { Id = "MathNet.Numerics.Data.Matlab" - Version = dataPackageVersion + Version = dataRelease.PackageVersion Title = "Math.NET Numerics - MATLAB Data I/O Extensions" Summary = "" Description = "MathWorks MATLAB Data Input/Output Extensions for Math.NET Numerics, the numerical foundation of the Math.NET project, aiming to provide methods and algorithms for numerical computations in science, engineering and every day use." - ReleaseNotes = dataReleaseNotes + ReleaseNotes = dataRelease.ReleaseNotes Tags = "math numeric data matlab" Authors = [ "Christoph Ruegg"; "Marcus Cuda" ] + FsLoader = false Dependencies = [ { FrameworkVersion="" Dependencies=[ "MathNet.Numerics", GetPackageVersion "./packages/data/" "MathNet.Numerics" ] } ] @@ -387,10 +332,9 @@ let dataMatlabPack = let dataBundle = { Id = "MathNet.Numerics.Data" - Version = dataPackageVersion + Version = dataRelease.PackageVersion Title = "Math.NET Numerics Data Extensions" ReleaseNotesFile = "RELEASENOTES-Data.md" - FsLoader = false Packages = [ dataTextPack; dataMatlabPack ] } @@ -412,30 +356,15 @@ Target "Clean" (fun _ -> CleanDirs [ "out/Data" ]) // Data Extensions Target "ApplyVersion" (fun _ -> - let patchAssemblyInfo path assemblyVersion packageVersion = - BulkReplaceAssemblyInfoVersions path (fun f -> - { f with - AssemblyVersion = assemblyVersion - AssemblyFileVersion = assemblyVersion - AssemblyInformationalVersion = packageVersion }) - patchAssemblyInfo "src/Numerics" assemblyVersion packageVersion - patchAssemblyInfo "src/FSharp" assemblyVersion packageVersion - patchAssemblyInfo "src/UnitTests" assemblyVersion packageVersion - patchAssemblyInfo "src/FSharpUnitTests" assemblyVersion packageVersion - patchAssemblyInfo "src/Data" dataAssemblyVersion dataPackageVersion - patchAssemblyInfo "src/DataUnitTests" dataAssemblyVersion dataPackageVersion - ReplaceInFile - (regex_replace @"\d+\.\d+\.\d+\.\d+" mklAssemblyVersion - >> regex_replace @"\d+,\d+,\d+,\d+" (replace "." "," mklAssemblyVersion)) - "src/NativeProviders/MKL/resource.rc" - ReplaceInFile - (regex_replace @"\d+\.\d+\.\d+\.\d+" cudaAssemblyVersion - >> regex_replace @"\d+,\d+,\d+,\d+" (replace "." "," cudaAssemblyVersion)) - "src/NativeProviders/CUDA/resource.rc" - ReplaceInFile - (regex_replace @"\d+\.\d+\.\d+\.\d+" openBlasAssemblyVersion - >> regex_replace @"\d+,\d+,\d+,\d+" (replace "." "," openBlasAssemblyVersion)) - "src/NativeProviders/OpenBLAS/resource.rc") + patchVersionInAssemblyInfo "src/Numerics" numericsRelease + patchVersionInAssemblyInfo "src/FSharp" numericsRelease + patchVersionInAssemblyInfo "src/UnitTests" numericsRelease + patchVersionInAssemblyInfo "src/FSharpUnitTests" numericsRelease + patchVersionInAssemblyInfo "src/Data" dataRelease + patchVersionInAssemblyInfo "src/DataUnitTests" dataRelease + patchVersionInResource "src/NativeProviders/MKL/resource.rc" mklRelease + patchVersionInResource "src/NativeProviders/CUDA/resource.rc" cudaRelease + patchVersionInResource "src/NativeProviders/OpenBLAS/resource.rc" openBlasRelease) Target "Prepare" DoNothing "Start" @@ -447,13 +376,7 @@ Target "Prepare" DoNothing // -------------------------------------------------------------------------------------- // BUILD // -------------------------------------------------------------------------------------- - -let buildConfig config subject = MSBuild "" (if hasBuildParam "incremental" then "Build" else "Rebuild") [ "Configuration", config ] subject |> ignore -let build subject = buildConfig "Release" subject -let buildSigned subject = buildConfig "Release-Signed" subject -let buildConfig32 config subject = MSBuild "" (if hasBuildParam "incremental" then "Build" else "Rebuild") [("Configuration", config); ("Platform","Win32")] subject |> ignore -let buildConfig64 config subject = MSBuild "" (if hasBuildParam "incremental" then "Build" else "Rebuild") [("Configuration", config); ("Platform","x64")] subject |> ignore - + Target "BuildMain" (fun _ -> build !! "MathNet.Numerics.sln") Target "BuildNet35" (fun _ -> build !! "MathNet.Numerics.Net35Only.sln") Target "BuildAll" (fun _ -> build !! "MathNet.Numerics.All.sln") @@ -491,23 +414,6 @@ Target "DataBuild" (fun _ -> build !! "MathNet.Numerics.Data.sln") // TEST // -------------------------------------------------------------------------------------- -let test target = - let quick p = if hasBuildParam "quick" then { p with Where="cat!=LongRunning" } else p - NUnit3 (fun p -> - { p with - ShadowCopy = false - Labels = LabelsLevel.Off - TimeOut = TimeSpan.FromMinutes 60. } |> quick) target - -let test32 target = - let quick p = if hasBuildParam "quick" then { p with Where="cat!=LongRunning" } else p - NUnit3 (fun p -> - { p with - Force32bit = true - ShadowCopy = false - Labels = LabelsLevel.Off - TimeOut = TimeSpan.FromMinutes 60. } |> quick) target - Target "Test" (fun _ -> test !! "out/test/**/*UnitTests*.dll") "Build" ?=> "Test" @@ -540,60 +446,8 @@ Target "DataTest" (fun _ -> test !! "out/Data/test/**/*UnitTests*.dll") // PACKAGES // -------------------------------------------------------------------------------------- -let provideLicense path = - ReadFileAsString "LICENSE.md" - |> ConvertTextToWindowsLineBreaks - |> ReplaceFile (path "license.txt") - -let provideReadme title releasenotes path = - String.concat Environment.NewLine [header; " " + title; ""; ReadFileAsString releasenotes] - |> ConvertTextToWindowsLineBreaks - |> ReplaceFile (path "readme.txt") - -let provideFsLoader includes path = - // inspired by FsLab/tpetricek - let fullScript = ReadFile "src/FSharp/MathNet.Numerics.fsx" |> Array.ofSeq - let startIndex = fullScript |> Seq.findIndex (fun s -> s.Contains "***MathNet.Numerics.fsx***") - let extraScript = fullScript .[startIndex + 1 ..] |> List.ofSeq - let assemblies = [ "MathNet.Numerics.dll"; "MathNet.Numerics.FSharp.dll" ] - let nowarn = ["#nowarn \"211\""] - let references = [ for assembly in assemblies -> sprintf "#r \"%s\"" assembly ] - ReplaceFile (path "MathNet.Numerics.fsx") (nowarn @ includes @ references @ extraScript |> toLines) - -let provideFsIfSharpLoader path = - let fullScript = ReadFile "src/FSharp/MathNet.Numerics.IfSharp.fsx" |> Array.ofSeq - let startIndex = fullScript |> Seq.findIndex (fun s -> s.Contains "***MathNet.Numerics.IfSharp.fsx***") - ReplaceFile (path "MathNet.Numerics.IfSharp.fsx") (fullScript .[startIndex + 1 ..] |> toLines) - -let provideZipExtraFiles path (bundle:Bundle) = - provideLicense path - provideReadme (sprintf "%s v%s" bundle.Title bundle.Version) bundle.ReleaseNotesFile path - if bundle.FsLoader then - let includes = [ for root in [ ""; "../"; "../../" ] -> sprintf "#I \"%sNet40\"" root ] - provideFsLoader includes path - provideFsIfSharpLoader path - -let provideNuGetExtraFiles path (bundle:Bundle) (pack:Package) = - provideLicense path - provideReadme (sprintf "%s v%s" pack.Title pack.Version) bundle.ReleaseNotesFile path - if pack = fsharpPack || pack = fsharpSignedPack then - let includes = [ for root in [ ""; "../"; "../../"; "../../../" ] do - for package in bundle.Packages do - yield sprintf "#I \"%spackages/%s/lib/net40/\"" root package.Id - yield sprintf "#I \"%spackages/%s.%s/lib/net40/\"" root package.Id package.Version ] - provideFsLoader includes path - provideFsIfSharpLoader path - // ZIP -let zip zipDir filesDir filesFilter bundle = - CleanDir "obj/Zip" - let workPath = "obj/Zip/" + bundle.Id - CopyDir workPath filesDir filesFilter - provideZipExtraFiles workPath bundle - Zip "obj/Zip/" (zipDir sprintf "%s-%s.zip" bundle.Id bundle.Version) !! (workPath + "/**/*.*") - CleanDir "obj/Zip" - Target "Zip" (fun _ -> CleanDir "out/packages/Zip" if not (hasBuildParam "signed") || hasBuildParam "release" then @@ -629,46 +483,6 @@ Target "DataZip" (fun _ -> // NUGET -let updateNuspec (pack:Package) outPath symbols updateFiles spec = - { spec with ToolPath = "packages/build/NuGet.CommandLine/tools/NuGet.exe" - OutputPath = outPath - WorkingDir = "obj/NuGet" - Version = pack.Version - ReleaseNotes = pack.ReleaseNotes - Project = pack.Id - Title = pack.Title - Summary = pack.Summary - Description = pack.Description - Tags = pack.Tags - Authors = pack.Authors - DependenciesByFramework = pack.Dependencies - SymbolPackage = symbols - Files = updateFiles pack.Files - Publish = false } - -let nugetPack bundle outPath = - CleanDir "obj/NuGet" - for pack in bundle.Packages do - provideNuGetExtraFiles "obj/NuGet" bundle pack - let withLicenseReadme f = [ "license.txt", None, None; "readme.txt", None, None; ] @ f - let withoutSymbolsSources f = - List.choose (function | (_, Some (target:string), _) when target.StartsWith("src") -> None - | (s, t, None) -> Some (s, t, Some ("**/*.pdb")) - | (s, t, Some e) -> Some (s, t, Some (e + ";**/*.pdb"))) f - // first pass - generates symbol + normal package. NuGet does drop the symbols from the normal package, but unfortunately not the sources. - NuGet (updateNuspec pack outPath NugetSymbolPackage.Nuspec withLicenseReadme) "build/MathNet.Numerics.nuspec" - // second pass - generate only normal package, again, but this time explicitly drop the sources (and the debug symbols) - NuGet (updateNuspec pack outPath NugetSymbolPackage.None (withLicenseReadme >> withoutSymbolsSources)) "build/MathNet.Numerics.nuspec" - CleanDir "obj/NuGet" - -let nugetPackExtension bundle outPath = - CleanDir "obj/NuGet" - for pack in bundle.Packages do - provideNuGetExtraFiles "obj/NuGet" bundle pack - let withLicenseReadme f = [ "license.txt", None, None; "readme.txt", None, None; ] @ f - NuGet (updateNuspec pack outPath NugetSymbolPackage.None withLicenseReadme) "build/MathNet.Numerics.Extension.nuspec" - CleanDir "obj/NuGet" - Target "NuGet" (fun _ -> CleanDir "out/packages/NuGet" if hasBuildParam "signed" || hasBuildParam "release" then @@ -720,63 +534,16 @@ let releaseNotesDocs = [ "RELEASENOTES.md", "ReleaseNotes.md", "Release Notes" "RELEASENOTES-Data.md", "ReleaseNotes-Data.md", "Data Extensions Release Notes" "RELEASENOTES-MKL.md", "ReleaseNotes-MKL.md", "MKL Native Provider Release Notes" - "RELEASENOTES-CUDA.md", "ReleaseNotes-CUDA.md", "CUDA Native Provider Release Notes" "RELEASENOTES-OpenBLAS.md", "ReleaseNotes-OpenBLAS.md", "OpenBLAS Native Provider Release Notes" ] -let provideDocExtraFiles() = - for (fileName, docName) in extraDocs do CopyFile ("docs/content" docName) fileName - for (fileName, docName, title) in releaseNotesDocs do - String.concat Environment.NewLine - [ "# " + title - "[Math.NET Numerics](ReleaseNotes.html) | [Data Extensions](ReleaseNotes-Data.html) | [MKL Native Provider](ReleaseNotes-MKL.html) | [OpenBLAS Native Provider](ReleaseNotes-OpenBLAS.html)" - "" - ReadFileAsString fileName ] - |> ReplaceFile ("docs/content" docName) - -let buildDocumentationTarget fsiargs target = - trace (sprintf "Building documentation (%s), this could take some time, please wait..." target) - let fakePath = "packages" "build" "FAKE" "tools" "FAKE.exe" - let fakeStartInfo script workingDirectory args fsiargs environmentVars = - (fun (info: System.Diagnostics.ProcessStartInfo) -> - info.FileName <- System.IO.Path.GetFullPath fakePath - info.Arguments <- sprintf "%s --fsiargs -d:FAKE %s \"%s\"" args fsiargs script - info.WorkingDirectory <- workingDirectory - let setVar k v = - info.EnvironmentVariables.[k] <- v - for (k, v) in environmentVars do - setVar k v - setVar "MSBuild" msBuildExe - setVar "GIT" Git.CommandHelper.gitPath - setVar "FSI" fsiPath) - let executeFAKEWithOutput workingDirectory script fsiargs envArgs = - let exitCode = - ExecProcessWithLambdas - (fakeStartInfo script workingDirectory "" fsiargs envArgs) - TimeSpan.MaxValue false ignore ignore - System.Threading.Thread.Sleep 1000 - exitCode - let exit = executeFAKEWithOutput "docs/tools" "build-docs.fsx" fsiargs ["target", target] - if exit <> 0 then - failwith "Generating documentation failed" - () - -let generateDocs fail local = - let args = if local then "" else "--define:RELEASE" - try - buildDocumentationTarget args "Default" - traceImportant "Documentation generated" - with - | e when not fail -> - failwith "Generating documentation failed" - Target "Docs" (fun _ -> - provideDocExtraFiles () + provideDocExtraFiles extraDocs releaseNotesDocs generateDocs true false) Target "DocsDev" (fun _ -> - provideDocExtraFiles () + provideDocExtraFiles extraDocs releaseNotesDocs generateDocs true true) Target "DocsWatch" (fun _ -> - provideDocExtraFiles () + provideDocExtraFiles extraDocs releaseNotesDocs use watcher = new FileSystemWatcher(DirectoryInfo("docs/content").FullName, "*.*") watcher.EnableRaisingEvents <- true watcher.Changed.Add(fun e -> generateDocs false true) @@ -819,61 +586,15 @@ Target "Api" (fun _ -> // Requires permissions; intended only for maintainers // -------------------------------------------------------------------------------------- -let publishReleaseTag title prefix version notes = - // inspired by Deedle/tpetricek - let tagName = prefix + "v" + version - let tagMessage = String.concat Environment.NewLine [title + " v" + version; ""; notes ] - let cmd = sprintf """tag -a %s -m "%s" """ tagName tagMessage - Git.CommandHelper.runSimpleGitCommand "." cmd |> printfn "%s" - let _, remotes, _ = Git.CommandHelper.runGitCommand "." "remote -v" - let main = remotes |> Seq.find (fun s -> s.Contains("(push)") && s.Contains("mathnet/mathnet-numerics")) - let remoteName = main.Split('\t').[0] - Git.Branches.pushTag "." remoteName tagName - -Target "PublishTag" (fun _ -> publishReleaseTag "Math.NET Numerics" "" packageVersion releaseNotes) -Target "MklPublishTag" (fun _ -> publishReleaseTag "Math.NET Numerics MKL Provider" "mkl-" mklPackageVersion mklReleaseNotes) -Target "CudaPublishTag" (fun _ -> publishReleaseTag "Math.NET Numerics CUDA Provider" "cuda-" cudaPackageVersion cudaReleaseNotes) -Target "OpenBlasPublishTag" (fun _ -> publishReleaseTag "Math.NET Numerics OpenBLAS Provider" "openblas-" openBlasPackageVersion openBlasReleaseNotes) -Target "DataPublishTag" (fun _ -> publishReleaseTag "Math.NET Numerics Data Extensions" "data-" dataPackageVersion dataReleaseNotes) - -Target "PublishMirrors" (fun _ -> - let repo = "../mirror-numerics" - Git.CommandHelper.runSimpleGitCommand repo "remote update" |> printfn "%s" - Git.CommandHelper.runSimpleGitCommand repo "push mirrors" |> printfn "%s") - -Target "PublishDocs" (fun _ -> - let repo = "../mathnet-websites" - Git.Branches.pull repo "origin" "master" - CopyRecursive "out/docs" "../mathnet-websites/numerics" true |> printfn "%A" - Git.Staging.StageAll repo - Git.Commit.Commit repo (sprintf "Numerics: %s docs update" packageVersion) - Git.Branches.pushBranch repo "origin" "master") - -Target "PublishApi" (fun _ -> - let repo = "../mathnet-websites" - Git.Branches.pull repo "origin" "master" - CleanDir "../mathnet-websites/numerics/api" - CopyRecursive "out/api" "../mathnet-websites/numerics/api" true |> printfn "%A" - Git.Staging.StageAll repo - Git.Commit.Commit repo (sprintf "Numerics: %s api update" packageVersion) - Git.Branches.pushBranch repo "origin" "master") - -let publishNuGet packageFiles = - // TODO: Migrate to NuGet helper once it supports direct (non-integrated) operations - let rec impl trials file = - trace ("NuGet Push: " + System.IO.Path.GetFileName(file) + ".") - try - let args = sprintf "push \"%s\"" (FullName file) - let result = - ExecProcess (fun info -> - info.FileName <- "packages/build/NuGet.CommandLine/tools/NuGet.exe" - info.WorkingDirectory <- FullName "obj/NuGet" - info.Arguments <- args) (TimeSpan.FromMinutes 10.) - if result <> 0 then failwith "Error during NuGet push." - with exn -> - if trials > 0 then impl (trials-1) file - else () - Seq.iter (impl 3) packageFiles +Target "PublishTag" (fun _ -> publishReleaseTag "Math.NET Numerics" "" numericsRelease) +Target "MklPublishTag" (fun _ -> publishReleaseTag "Math.NET Numerics MKL Provider" "mkl-" mklRelease) +Target "CudaPublishTag" (fun _ -> publishReleaseTag "Math.NET Numerics CUDA Provider" "cuda-" cudaRelease) +Target "OpenBlasPublishTag" (fun _ -> publishReleaseTag "Math.NET Numerics OpenBLAS Provider" "openblas-" openBlasRelease) +Target "DataPublishTag" (fun _ -> publishReleaseTag "Math.NET Numerics Data Extensions" "data-" dataRelease) + +Target "PublishMirrors" (fun _ -> publishMirrors()) +Target "PublishDocs" (fun _ -> publishDocs numericsRelease) +Target "PublishApi" (fun _ -> publishApi numericsRelease) Target "PublishNuGet" (fun _ -> !! "out/packages/NuGet/*.nupkg" -- "out/packages/NuGet/*.symbols.nupkg" |> publishNuGet) Target "MklPublishNuGet" (fun _ -> !! "out/MKL/packages/NuGet/*.nupkg" |> publishNuGet) diff --git a/build/build-framework.fsx b/build/build-framework.fsx new file mode 100644 index 00000000..139dd3e0 --- /dev/null +++ b/build/build-framework.fsx @@ -0,0 +1,342 @@ +// __ __ _ _ _ _ ______ _______ +// | \/ | | | | | | \ | | ____|__ __| +// | \ / | __ _| |_| |__ | \| | |__ | | +// | |\/| |/ _` | __| '_ \ | . ` | __| | | +// | | | | (_| | |_| | | |_| |\ | |____ | | +// |_| |_|\__,_|\__|_| |_(_)_| \_|______| |_| +// +// Math.NET Numerics - https://numerics.mathdotnet.com +// Copyright (c) Math.NET - Open Source MIT/X11 License +// +// Build Framework using FAKE (http://fsharp.github.io/FAKE) +// + +module BuildFramework + +#I "../packages/build/FAKE/tools" +#r "../packages/build/FAKE/tools/FakeLib.dll" + +open Fake +open Fake.DocuHelper +open Fake.AssemblyInfoFile +open Fake.ReleaseNotesHelper +open Fake.StringHelper +open Fake.Testing.NUnit3 +open System +open System.IO + +Environment.CurrentDirectory <- Path.Combine (__SOURCE_DIRECTORY__ + "/../") +trace Environment.CurrentDirectory + +let header = ReadFile(__SOURCE_DIRECTORY__ __SOURCE_FILE__) |> Seq.take 10 |> Seq.map (fun s -> s.Substring(2)) |> toLines +trace header + +type BundleRelease = + { ReleaseNotesFile: string + AssemblyVersion: string + PackageVersion: string + ReleaseNotes: string } + +type Package = + { Id: string + Version: string + Title: string + Summary: string + Description: string + ReleaseNotes: string + Tags: string + FsLoader: bool + Authors: string list + Dependencies: NugetFrameworkDependencies list + Files: (string * string option * string option) list } + +type Bundle = + { Id: string + Version: string + Title: string + ReleaseNotesFile: string + Packages: Package list } + +let release releaseNotesFile : BundleRelease = + let info = LoadReleaseNotes releaseNotesFile + let buildPart = "0" + let assemblyVersion = info.AssemblyVersion + "." + buildPart + let packageVersion = info.NugetVersion + let notes = info.Notes |> List.map (fun l -> l.Replace("*","").Replace("`","")) |> toLines + { ReleaseNotesFile = releaseNotesFile + AssemblyVersion = assemblyVersion + PackageVersion = packageVersion + ReleaseNotes = notes } + + +// -------------------------------------------------------------------------------------- +// TARGET FRAMEWORKS +// -------------------------------------------------------------------------------------- + +let libnet35 = "lib/net35" +let libnet40 = "lib/net40" +let libnet45 = "lib/net45" +let libpcl7 = "lib/portable-net45+netcore45+MonoAndroid1+MonoTouch1" +let libpcl47 = "lib/portable-net45+sl5+netcore45+MonoAndroid1+MonoTouch1" +let libpcl78 = "lib/portable-net45+netcore45+wp8+MonoAndroid1+MonoTouch1" +let libpcl259 = "lib/portable-net45+netcore45+wpa81+wp8+MonoAndroid1+MonoTouch1" +let libpcl328 = "lib/portable-net4+sl5+netcore45+wpa81+wp8+MonoAndroid1+MonoTouch1" + + +// -------------------------------------------------------------------------------------- +// PREPARE +// -------------------------------------------------------------------------------------- + +let patchVersionInAssemblyInfo path (release:BundleRelease) = + BulkReplaceAssemblyInfoVersions path (fun f -> + { f with + AssemblyVersion = release.AssemblyVersion + AssemblyFileVersion = release.AssemblyVersion + AssemblyInformationalVersion = release.PackageVersion }) + +let patchVersionInResource path (release:BundleRelease) = + ReplaceInFile + (regex_replace @"\d+\.\d+\.\d+\.\d+" release.AssemblyVersion + >> regex_replace @"\d+,\d+,\d+,\d+" (replace "." "," release.AssemblyVersion)) + path + + +// -------------------------------------------------------------------------------------- +// BUILD +// -------------------------------------------------------------------------------------- + +let buildConfig config subject = MSBuild "" (if hasBuildParam "incremental" then "Build" else "Rebuild") [ "Configuration", config ] subject |> ignore +let build subject = buildConfig "Release" subject +let buildSigned subject = buildConfig "Release-Signed" subject +let buildConfig32 config subject = MSBuild "" (if hasBuildParam "incremental" then "Build" else "Rebuild") [("Configuration", config); ("Platform","Win32")] subject |> ignore +let buildConfig64 config subject = MSBuild "" (if hasBuildParam "incremental" then "Build" else "Rebuild") [("Configuration", config); ("Platform","x64")] subject |> ignore + + +// -------------------------------------------------------------------------------------- +// TEST +// -------------------------------------------------------------------------------------- + +let test target = + let quick p = if hasBuildParam "quick" then { p with Where="cat!=LongRunning" } else p + NUnit3 (fun p -> + { p with + ShadowCopy = false + Labels = LabelsLevel.Off + TimeOut = TimeSpan.FromMinutes 60. } |> quick) target + +let test32 target = + let quick p = if hasBuildParam "quick" then { p with Where="cat!=LongRunning" } else p + NUnit3 (fun p -> + { p with + Force32bit = true + ShadowCopy = false + Labels = LabelsLevel.Off + TimeOut = TimeSpan.FromMinutes 60. } |> quick) target + + +// -------------------------------------------------------------------------------------- +// PACKAGES +// -------------------------------------------------------------------------------------- + +let provideLicense path = + ReadFileAsString "LICENSE.md" + |> ConvertTextToWindowsLineBreaks + |> ReplaceFile (path "license.txt") + +let provideReadme title releasenotes path = + String.concat Environment.NewLine [header; " " + title; ""; ReadFileAsString releasenotes] + |> ConvertTextToWindowsLineBreaks + |> ReplaceFile (path "readme.txt") + +let provideFsLoader includes path = + // inspired by FsLab/tpetricek + let fullScript = ReadFile "src/FSharp/MathNet.Numerics.fsx" |> Array.ofSeq + let startIndex = fullScript |> Seq.findIndex (fun s -> s.Contains "***MathNet.Numerics.fsx***") + let extraScript = fullScript .[startIndex + 1 ..] |> List.ofSeq + let assemblies = [ "MathNet.Numerics.dll"; "MathNet.Numerics.FSharp.dll" ] + let nowarn = ["#nowarn \"211\""] + let references = [ for assembly in assemblies -> sprintf "#r \"%s\"" assembly ] + ReplaceFile (path "MathNet.Numerics.fsx") (nowarn @ includes @ references @ extraScript |> toLines) + +let provideFsIfSharpLoader path = + let fullScript = ReadFile "src/FSharp/MathNet.Numerics.IfSharp.fsx" |> Array.ofSeq + let startIndex = fullScript |> Seq.findIndex (fun s -> s.Contains "***MathNet.Numerics.IfSharp.fsx***") + ReplaceFile (path "MathNet.Numerics.IfSharp.fsx") (fullScript .[startIndex + 1 ..] |> toLines) + +let provideZipExtraFiles path (bundle:Bundle) = + provideLicense path + provideReadme (sprintf "%s v%s" bundle.Title bundle.Version) bundle.ReleaseNotesFile path + if bundle.Packages |> List.exists (fun p -> p.FsLoader) then + let includes = [ for root in [ ""; "../"; "../../" ] -> sprintf "#I \"%sNet40\"" root ] + provideFsLoader includes path + provideFsIfSharpLoader path + +let provideNuGetExtraFiles path (bundle:Bundle) (pack:Package) = + provideLicense path + provideReadme (sprintf "%s v%s" pack.Title pack.Version) bundle.ReleaseNotesFile path + if pack.FsLoader then + let includes = [ for root in [ ""; "../"; "../../"; "../../../" ] do + for package in bundle.Packages do + yield sprintf "#I \"%spackages/%s/lib/net40/\"" root package.Id + yield sprintf "#I \"%spackages/%s.%s/lib/net40/\"" root package.Id package.Version ] + provideFsLoader includes path + provideFsIfSharpLoader path + +// ZIP + +let zip zipDir filesDir filesFilter (bundle:Bundle) = + CleanDir "obj/Zip" + let workPath = "obj/Zip/" + bundle.Id + CopyDir workPath filesDir filesFilter + provideZipExtraFiles workPath bundle + Zip "obj/Zip/" (zipDir sprintf "%s-%s.zip" bundle.Id bundle.Version) !! (workPath + "/**/*.*") + CleanDir "obj/Zip" + +// NUGET + +let updateNuspec (pack:Package) outPath symbols updateFiles spec = + { spec with ToolPath = "packages/build/NuGet.CommandLine/tools/NuGet.exe" + OutputPath = outPath + WorkingDir = "obj/NuGet" + Version = pack.Version + ReleaseNotes = pack.ReleaseNotes + Project = pack.Id + Title = pack.Title + Summary = pack.Summary + Description = pack.Description + Tags = pack.Tags + Authors = pack.Authors + DependenciesByFramework = pack.Dependencies + SymbolPackage = symbols + Files = updateFiles pack.Files + Publish = false } + +let nugetPack bundle outPath = + CleanDir "obj/NuGet" + for pack in bundle.Packages do + provideNuGetExtraFiles "obj/NuGet" bundle pack + let withLicenseReadme f = [ "license.txt", None, None; "readme.txt", None, None; ] @ f + let withoutSymbolsSources f = + List.choose (function | (_, Some (target:string), _) when target.StartsWith("src") -> None + | (s, t, None) -> Some (s, t, Some ("**/*.pdb")) + | (s, t, Some e) -> Some (s, t, Some (e + ";**/*.pdb"))) f + // first pass - generates symbol + normal package. NuGet does drop the symbols from the normal package, but unfortunately not the sources. + NuGet (updateNuspec pack outPath NugetSymbolPackage.Nuspec withLicenseReadme) "build/MathNet.Numerics.nuspec" + // second pass - generate only normal package, again, but this time explicitly drop the sources (and the debug symbols) + NuGet (updateNuspec pack outPath NugetSymbolPackage.None (withLicenseReadme >> withoutSymbolsSources)) "build/MathNet.Numerics.nuspec" + CleanDir "obj/NuGet" + +let nugetPackExtension bundle outPath = + CleanDir "obj/NuGet" + for pack in bundle.Packages do + provideNuGetExtraFiles "obj/NuGet" bundle pack + let withLicenseReadme f = [ "license.txt", None, None; "readme.txt", None, None; ] @ f + NuGet (updateNuspec pack outPath NugetSymbolPackage.None withLicenseReadme) "build/MathNet.Numerics.Extension.nuspec" + CleanDir "obj/NuGet" + + +// -------------------------------------------------------------------------------------- +// Documentation +// -------------------------------------------------------------------------------------- + +let provideDocExtraFiles extraDocs releaseNotesDocs = + for (fileName, docName) in extraDocs do CopyFile ("docs/content" docName) fileName + for (fileName, docName, title) in releaseNotesDocs do + String.concat Environment.NewLine + [ "# " + title + "[Math.NET Numerics](ReleaseNotes.html) | [Data Extensions](ReleaseNotes-Data.html) | [MKL Native Provider](ReleaseNotes-MKL.html) | [OpenBLAS Native Provider](ReleaseNotes-OpenBLAS.html)" + "" + ReadFileAsString fileName ] + |> ReplaceFile ("docs/content" docName) + +let buildDocumentationTarget fsiargs target = + trace (sprintf "Building documentation (%s), this could take some time, please wait..." target) + let fakePath = "packages" "build" "FAKE" "tools" "FAKE.exe" + let fakeStartInfo script workingDirectory args fsiargs environmentVars = + (fun (info: System.Diagnostics.ProcessStartInfo) -> + info.FileName <- System.IO.Path.GetFullPath fakePath + info.Arguments <- sprintf "%s --fsiargs -d:FAKE %s \"%s\"" args fsiargs script + info.WorkingDirectory <- workingDirectory + let setVar k v = + info.EnvironmentVariables.[k] <- v + for (k, v) in environmentVars do + setVar k v + setVar "MSBuild" msBuildExe + setVar "GIT" Git.CommandHelper.gitPath + setVar "FSI" fsiPath) + let executeFAKEWithOutput workingDirectory script fsiargs envArgs = + let exitCode = + ExecProcessWithLambdas + (fakeStartInfo script workingDirectory "" fsiargs envArgs) + TimeSpan.MaxValue false ignore ignore + System.Threading.Thread.Sleep 1000 + exitCode + let exit = executeFAKEWithOutput "docs/tools" "build-docs.fsx" fsiargs ["target", target] + if exit <> 0 then + failwith "Generating documentation failed" + () + +let generateDocs fail local = + let args = if local then "" else "--define:RELEASE" + try + buildDocumentationTarget args "Default" + traceImportant "Documentation generated" + with + | e when not fail -> + failwith "Generating documentation failed" + + +// -------------------------------------------------------------------------------------- +// Publishing +// Requires permissions; intended only for maintainers +// -------------------------------------------------------------------------------------- + +let publishReleaseTag title prefix (release:BundleRelease) = + // inspired by Deedle/tpetricek + let tagName = prefix + "v" + release.PackageVersion + let tagMessage = String.concat Environment.NewLine [title + " v" + release.PackageVersion; ""; release.ReleaseNotes ] + let cmd = sprintf """tag -a %s -m "%s" """ tagName tagMessage + Git.CommandHelper.runSimpleGitCommand "." cmd |> printfn "%s" + let _, remotes, _ = Git.CommandHelper.runGitCommand "." "remote -v" + let main = remotes |> Seq.find (fun s -> s.Contains("(push)") && s.Contains("mathnet/mathnet-numerics")) + let remoteName = main.Split('\t').[0] + Git.Branches.pushTag "." remoteName tagName + +let publishNuGet packageFiles = + // TODO: Migrate to NuGet helper once it supports direct (non-integrated) operations + let rec impl trials file = + trace ("NuGet Push: " + System.IO.Path.GetFileName(file) + ".") + try + let args = sprintf "push \"%s\"" (FullName file) + let result = + ExecProcess (fun info -> + info.FileName <- "packages/build/NuGet.CommandLine/tools/NuGet.exe" + info.WorkingDirectory <- FullName "obj/NuGet" + info.Arguments <- args) (TimeSpan.FromMinutes 10.) + if result <> 0 then failwith "Error during NuGet push." + with exn -> + if trials > 0 then impl (trials-1) file + else () + Seq.iter (impl 3) packageFiles + +let publishMirrors () = + let repo = "../mirror-numerics" + Git.CommandHelper.runSimpleGitCommand repo "remote update" |> printfn "%s" + Git.CommandHelper.runSimpleGitCommand repo "push mirrors" |> printfn "%s" + +let publishDocs (release:BundleRelease) = + let repo = "../mathnet-websites" + Git.Branches.pull repo "origin" "master" + CopyRecursive "out/docs" "../mathnet-websites/numerics" true |> printfn "%A" + Git.Staging.StageAll repo + Git.Commit.Commit repo (sprintf "Numerics: %s docs update" release.PackageVersion) + Git.Branches.pushBranch repo "origin" "master" + +let publishApi (release:BundleRelease) = + let repo = "../mathnet-websites" + Git.Branches.pull repo "origin" "master" + CleanDir "../mathnet-websites/numerics/api" + CopyRecursive "out/api" "../mathnet-websites/numerics/api" true |> printfn "%A" + Git.Staging.StageAll repo + Git.Commit.Commit repo (sprintf "Numerics: %s api update" release.PackageVersion) + Git.Branches.pushBranch repo "origin" "master"