|
|
@ -19,8 +19,6 @@ module BuildFramework |
|
|
open FSharp.Core |
|
|
open FSharp.Core |
|
|
open Fake |
|
|
open Fake |
|
|
open Fake.ReleaseNotesHelper |
|
|
open Fake.ReleaseNotesHelper |
|
|
open Fake.StringHelper |
|
|
|
|
|
open Fake.Testing.NUnit3 |
|
|
|
|
|
open System |
|
|
open System |
|
|
open System.IO |
|
|
open System.IO |
|
|
|
|
|
|
|
|
@ -93,7 +91,8 @@ let dotnetSN workingDir command = |
|
|
let header = ReadFile(__SOURCE_DIRECTORY__ </> __SOURCE_FILE__) |> Seq.take 10 |> Seq.map (fun s -> s.Substring(2)) |> toLines |
|
|
let header = ReadFile(__SOURCE_DIRECTORY__ </> __SOURCE_FILE__) |> Seq.take 10 |> Seq.map (fun s -> s.Substring(2)) |> toLines |
|
|
|
|
|
|
|
|
type Release = |
|
|
type Release = |
|
|
{ Title: string |
|
|
{ RepoKey: string |
|
|
|
|
|
Title: string |
|
|
AssemblyVersion: string |
|
|
AssemblyVersion: string |
|
|
PackageVersion: string |
|
|
PackageVersion: string |
|
|
ReleaseNotes: string |
|
|
ReleaseNotes: string |
|
|
@ -102,8 +101,7 @@ type Release = |
|
|
type ZipPackage = |
|
|
type ZipPackage = |
|
|
{ Id: string |
|
|
{ Id: string |
|
|
Release: Release |
|
|
Release: Release |
|
|
Title: string |
|
|
Title: string } |
|
|
FsLoader: bool } |
|
|
|
|
|
|
|
|
|
|
|
type NuGetPackage = |
|
|
type NuGetPackage = |
|
|
{ Id: string |
|
|
{ Id: string |
|
|
@ -153,23 +151,23 @@ type NuGetSpecification = |
|
|
Title: string } |
|
|
Title: string } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let release title releaseNotesFile : Release = |
|
|
let release repoKey title releaseNotesFile : Release = |
|
|
let info = LoadReleaseNotes releaseNotesFile |
|
|
let info = LoadReleaseNotes releaseNotesFile |
|
|
let buildPart = "0" |
|
|
let buildPart = "0" |
|
|
let assemblyVersion = info.AssemblyVersion + "." + buildPart |
|
|
let assemblyVersion = info.AssemblyVersion + "." + buildPart |
|
|
let packageVersion = info.NugetVersion |
|
|
let packageVersion = info.NugetVersion |
|
|
let notes = info.Notes |> List.map (fun l -> l.Replace("*","").Replace("`","")) |> toLines |
|
|
let notes = info.Notes |> List.map (fun l -> l.Replace("*","").Replace("`","")) |> toLines |
|
|
{ Release.Title = title |
|
|
{ Release.RepoKey = repoKey |
|
|
|
|
|
Title = title |
|
|
AssemblyVersion = assemblyVersion |
|
|
AssemblyVersion = assemblyVersion |
|
|
PackageVersion = packageVersion |
|
|
PackageVersion = packageVersion |
|
|
ReleaseNotes = notes |
|
|
ReleaseNotes = notes |
|
|
ReleaseNotesFile = releaseNotesFile } |
|
|
ReleaseNotesFile = releaseNotesFile } |
|
|
|
|
|
|
|
|
let zipPackage packageId title release fsLoader = |
|
|
let zipPackage packageId title release = |
|
|
{ ZipPackage.Id = packageId |
|
|
{ ZipPackage.Id = packageId |
|
|
Title = title |
|
|
Title = title |
|
|
Release = release |
|
|
Release = release } |
|
|
FsLoader = fsLoader } |
|
|
|
|
|
|
|
|
|
|
|
let nugetPackage packageId release = |
|
|
let nugetPackage packageId release = |
|
|
{ NuGetPackage.Id = packageId |
|
|
{ NuGetPackage.Id = packageId |
|
|
@ -351,21 +349,6 @@ let provideReadme title (release:Release) path = |
|
|
|> ConvertTextToWindowsLineBreaks |
|
|
|> ConvertTextToWindowsLineBreaks |
|
|
|> ReplaceFile (path </> "readme.txt") |
|
|
|> 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) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// SIGN |
|
|
// SIGN |
|
|
|
|
|
|
|
|
@ -407,10 +390,6 @@ let zip (package:ZipPackage) zipDir filesDir filesFilter = |
|
|
CopyDir workPath filesDir filesFilter |
|
|
CopyDir workPath filesDir filesFilter |
|
|
provideLicense workPath |
|
|
provideLicense workPath |
|
|
provideReadme (sprintf "%s v%s" package.Title package.Release.PackageVersion) package.Release workPath |
|
|
provideReadme (sprintf "%s v%s" package.Title package.Release.PackageVersion) package.Release workPath |
|
|
if package.FsLoader then |
|
|
|
|
|
let includes = [ for root in [ ""; "../"; "../../" ] -> sprintf "#I \"%sNet40\"" root ] |
|
|
|
|
|
provideFsLoader includes workPath |
|
|
|
|
|
provideFsIfSharpLoader workPath |
|
|
|
|
|
Zip "obj/Zip/" (zipDir </> sprintf "%s-%s.zip" package.Id package.Release.PackageVersion) !! (workPath + "/**/*.*") |
|
|
Zip "obj/Zip/" (zipDir </> sprintf "%s-%s.zip" package.Id package.Release.PackageVersion) !! (workPath + "/**/*.*") |
|
|
DeleteDir "obj/Zip" |
|
|
DeleteDir "obj/Zip" |
|
|
|
|
|
|
|
|
@ -499,7 +478,7 @@ let publishReleaseTag title prefix (release:Release) = |
|
|
let cmd = sprintf """tag -a %s -m "%s" """ tagName tagMessage |
|
|
let cmd = sprintf """tag -a %s -m "%s" """ tagName tagMessage |
|
|
Git.CommandHelper.runSimpleGitCommand "." cmd |> printfn "%s" |
|
|
Git.CommandHelper.runSimpleGitCommand "." cmd |> printfn "%s" |
|
|
let _, remotes, _ = Git.CommandHelper.runGitCommand "." "remote -v" |
|
|
let _, remotes, _ = Git.CommandHelper.runGitCommand "." "remote -v" |
|
|
let main = remotes |> Seq.find (fun s -> s.Contains("(push)") && s.Contains("mathnet/mathnet-numerics")) |
|
|
let main = remotes |> Seq.find (fun s -> s.Contains("(push)") && s.Contains("mathnet/mathnet-" + release.RepoKey)) |
|
|
let remoteName = main.Split('\t').[0] |
|
|
let remoteName = main.Split('\t').[0] |
|
|
Git.Branches.pushTag "." remoteName tagName |
|
|
Git.Branches.pushTag "." remoteName tagName |
|
|
|
|
|
|
|
|
@ -524,26 +503,21 @@ let publishNuGet (solutions: Solution list) = |
|
|
|> Seq.iter (impl 3) |
|
|
|> Seq.iter (impl 3) |
|
|
DeleteDir "obj/NuGet" |
|
|
DeleteDir "obj/NuGet" |
|
|
|
|
|
|
|
|
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:Release) = |
|
|
let publishDocs (release:Release) = |
|
|
let repo = "../web-mathnet-numerics" |
|
|
let repo = "../web-mathnet-" + release.RepoKey |
|
|
Git.Branches.pull repo "origin" "gh-pages" |
|
|
Git.Branches.pull repo "origin" "gh-pages" |
|
|
CopyRecursive "out/docs" "../web-mathnet-numerics" true |> printfn "%A" |
|
|
CopyRecursive "out/docs" repo true |> printfn "%A" |
|
|
Git.Staging.StageAll repo |
|
|
Git.Staging.StageAll repo |
|
|
Git.Commit.Commit repo (sprintf "Numerics: %s docs update" release.PackageVersion) |
|
|
Git.Commit.Commit repo (sprintf "%s: %s docs update" release.Title release.PackageVersion) |
|
|
Git.Branches.pushBranch repo "origin" "gh-pages" |
|
|
Git.Branches.pushBranch repo "origin" "gh-pages" |
|
|
|
|
|
|
|
|
let publishApi (release:Release) = |
|
|
let publishApi (release:Release) = |
|
|
let repo = "../web-mathnet-numerics" |
|
|
let repo = "../web-mathnet-" + release.RepoKey |
|
|
Git.Branches.pull repo "origin" "gh-pages" |
|
|
Git.Branches.pull repo "origin" "gh-pages" |
|
|
CleanDir "../web-mathnet-numerics/api" |
|
|
CleanDir (repo + "/api") |
|
|
CopyRecursive "out/api" "../web-mathnet-numerics/api" true |> printfn "%A" |
|
|
CopyRecursive "out/api" (repo + "/api") true |> printfn "%A" |
|
|
Git.Staging.StageAll repo |
|
|
Git.Staging.StageAll repo |
|
|
Git.Commit.Commit repo (sprintf "Numerics: %s api update" release.PackageVersion) |
|
|
Git.Commit.Commit repo (sprintf "%s: %s api update" release.Title release.PackageVersion) |
|
|
Git.Branches.pushBranch repo "origin" "gh-pages" |
|
|
Git.Branches.pushBranch repo "origin" "gh-pages" |
|
|
|
|
|
|
|
|
let publishNuGetToArchive (package:NuGetPackage) archivePath nupkgFile = |
|
|
let publishNuGetToArchive (package:NuGetPackage) archivePath nupkgFile = |
|
|
@ -558,8 +532,8 @@ let publishNuGetToArchive (package:NuGetPackage) archivePath nupkgFile = |
|
|
!! (tempDir </> "*.nuspec") |> Copy archiveDir |
|
|
!! (tempDir </> "*.nuspec") |> Copy archiveDir |
|
|
DeleteDir tempDir |
|
|
DeleteDir tempDir |
|
|
|
|
|
|
|
|
let publishArchiveManual zipOutPath nugetOutPath (zipPackages:ZipPackage list) (nugetPackages:NuGetPackage list) = |
|
|
let publishArchiveManual title zipOutPath nugetOutPath (zipPackages:ZipPackage list) (nugetPackages:NuGetPackage list) = |
|
|
let archivePath = (environVarOrFail "MathNetReleaseArchive") </> "Math.NET Numerics" |
|
|
let archivePath = (environVarOrFail "MathNetReleaseArchive") </> title |
|
|
if directoryExists archivePath |> not then failwith "Release archive directory does not exists. Safety Check failed." |
|
|
if directoryExists archivePath |> not then failwith "Release archive directory does not exists. Safety Check failed." |
|
|
for zipPackage in zipPackages do |
|
|
for zipPackage in zipPackages do |
|
|
let zipFile = zipOutPath </> sprintf "%s-%s.zip" zipPackage.Id zipPackage.Release.PackageVersion |
|
|
let zipFile = zipOutPath </> sprintf "%s-%s.zip" zipPackage.Id zipPackage.Release.PackageVersion |
|
|
@ -579,6 +553,6 @@ let publishArchive (solution:Solution) = |
|
|
let nugetOutPath = solution.OutputNuGetDir |
|
|
let nugetOutPath = solution.OutputNuGetDir |
|
|
let zipPackages = solution.ZipPackages |
|
|
let zipPackages = solution.ZipPackages |
|
|
let nugetPackages = solution.Projects |> List.collect projectNuGetPackages |> List.distinct |
|
|
let nugetPackages = solution.Projects |> List.collect projectNuGetPackages |> List.distinct |
|
|
publishArchiveManual zipOutPath nugetOutPath zipPackages nugetPackages |
|
|
publishArchiveManual solution.Release.Title zipOutPath nugetOutPath zipPackages nugetPackages |
|
|
|
|
|
|
|
|
let publishArchives (solutions: Solution list) = solutions |> List.iter publishArchive |
|
|
let publishArchives (solutions: Solution list) = solutions |> List.iter publishArchive |
|
|
|