diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 26ca307b..fdbedb66 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -7,6 +7,12 @@ "commands": [ "jb" ] + }, + "docfx": { + "version": "2.76.0", + "commands": [ + "docfx" + ] } } } \ No newline at end of file diff --git a/Akka.Persistence.Sql.sln b/Akka.Persistence.Sql.sln index 4da7a494..1cf5d56e 100644 --- a/Akka.Persistence.Sql.sln +++ b/Akka.Persistence.Sql.sln @@ -14,13 +14,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_", "_", "{20C26B2D-59EA-42 README.md = README.md RELEASE_NOTES.md = RELEASE_NOTES.md serve-docs.cmd = serve-docs.cmd - serve-docs.ps1 = serve-docs.ps1 + serve-docs.sh = serve-docs.sh src\Directory.Build.props = src\Directory.Build.props src\Directory.Packages.props = src\Directory.Packages.props build.cmd = build.cmd - build.fsx = build.fsx - build.ps1 = build.ps1 build.sh = build.sh + build.fsx = build.fsx EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build-system", "build-system", "{7537908B-6A42-4E34-889F-6004A97D4987}" diff --git a/build-system/azure-pipeline.template.yaml b/build-system/azure-pipeline.template.yaml index 707f0f89..da501514 100644 --- a/build-system/azure-pipeline.template.yaml +++ b/build-system/azure-pipeline.template.yaml @@ -23,9 +23,9 @@ jobs: persistCredentials: true - task: UseDotNet@2 - displayName: 'Use .NET 7' + displayName: 'Use .NET 8' inputs: - version: '7.x' + version: '8.x' # Linux or macOS - task: Bash@3 diff --git a/build-system/windows-release.yaml b/build-system/windows-release.yaml index e74f0370..18af5604 100644 --- a/build-system/windows-release.yaml +++ b/build-system/windows-release.yaml @@ -21,9 +21,9 @@ variables: steps: - task: UseDotNet@2 - displayName: 'Use .NET 7' + displayName: 'Use .NET 8' inputs: - version: '7.x' + version: '8.x' - task: BatchScript@1 displayName: 'FAKE Build' diff --git a/build.cmd b/build.cmd index 3cb534ea..9cf1a6e5 100644 --- a/build.cmd +++ b/build.cmd @@ -1 +1 @@ -PowerShell.exe -file "build.ps1" %* \ No newline at end of file +dotnet fsi build.fsx -- -t %* \ No newline at end of file diff --git a/build.fsx b/build.fsx index 4c57f6b2..7dd67bc6 100644 --- a/build.fsx +++ b/build.fsx @@ -1,71 +1,91 @@ -#I @"tools/FAKE/tools" -#r "FakeLib.dll" +#r "nuget: Fake.Core.ReleaseNotes" +#r "nuget: Fake.Core.Target" +#r "nuget: Fake.Dotnet.Nuget" +#r "nuget: Fake.Dotnet.Cli" +#r "nuget: Fake.DotNet.Testing.XUnit2" +// #r "nuget: Fake.Documentation.DocFx" +#r "nuget: MSBuild.StructuredLogger" + + open System open System.IO open System.Text - -open Fake -open Fake.DotNetCli -open Fake.NuGet.Install - -// Information about the project for Nuget and Assembly info files -let configuration = "Release" +open Fake.Core +open Fake.DotNet +open Fake.IO +open Fake.IO.FileSystemOperators +open Fake.IO.Globbing.Operators +open Fake.Core.TargetOperators +open Fake.DotNet.NuGet.Install +open Fake.Testing.Common +// open Fake.Documentation +//Information about the project for Nuget and Assembly info files +let configuration = DotNet.BuildConfiguration.Release // Read release notes and version -let solutionFile = FindFirstMatchingFile "*.sln" __SOURCE_DIRECTORY__ // dynamically look up the solution -let buildNumber = environVarOrDefault "BUILD_NUMBER" "0" +let root = __SOURCE_DIRECTORY__ +let solutionFile = Directory.findFirstMatchingFile "*.sln" root // dynamically look up the solution +let buildNumber = Environment.environVarOrDefault "BUILD_NUMBER" "0" let hasTeamCity = (not (buildNumber = "0")) // check if we have the TeamCity environment variable for build # set let preReleaseVersionSuffix = "beta" + (if (not (buildNumber = "0")) then (buildNumber) else DateTime.UtcNow.Ticks.ToString()) let releaseNotes = - File.ReadLines (__SOURCE_DIRECTORY__ @@ "RELEASE_NOTES.md") - |> ReleaseNotesHelper.parseReleaseNotes + File.ReadLines (root @@ "RELEASE_NOTES.md") + |> ReleaseNotes.parse let versionFromReleaseNotes = match releaseNotes.SemVer.PreRelease with - | Some r -> r.Origin - | None -> "" + | Some r -> Some r.Origin + | None -> None let versionSuffix = - match (getBuildParam "nugetprerelease") with - | "dev" -> preReleaseVersionSuffix - | "" -> versionFromReleaseNotes - | str -> str + match Environment.environVarOrNone "nugetprerelease" with + | Some "dev" -> Some preReleaseVersionSuffix + | Some str -> Some str + | None -> versionFromReleaseNotes + // Directories -let toolsDir = __SOURCE_DIRECTORY__ @@ "tools" -let output = __SOURCE_DIRECTORY__ @@ "bin" -let outputTests = __SOURCE_DIRECTORY__ @@ "TestResults" -let outputPerfTests = __SOURCE_DIRECTORY__ @@ "PerfResults" +let toolsDir = root @@ "tools" +let output = root @@ "bin" +let outputTests = root @@ "TestResults" +let outputPerfTests = root @@ "PerfResults" let outputNuGet = output @@ "nuget" -Target "Clean" (fun _ -> - ActivateFinalTarget "KillCreatedProcesses" +let clean _ = + Target.activateFinal "KillCreatedProcesses" + + Shell.cleanDir output + Shell.cleanDir outputTests + Shell.cleanDir outputPerfTests + Shell.cleanDir outputNuGet - CleanDir output - CleanDir outputTests - CleanDir outputPerfTests - CleanDir outputNuGet -) -Target "AssemblyInfo" (fun _ -> - XmlPokeInnerText "./src/Directory.Generated.props" "//Project/PropertyGroup/VersionPrefix" releaseNotes.AssemblyVersion - XmlPokeInnerText "./src/Directory.Generated.props" "//Project/PropertyGroup/PackageReleaseNotes" (releaseNotes.Notes |> String.concat "\n") -) +let assemblyInfo _ = + Xml.pokeInnerText "./src/Directory.Generated.props" "//Project/PropertyGroup/VersionPrefix" releaseNotes.AssemblyVersion + Xml.pokeInnerText "./src/Directory.Generated.props" "//Project/PropertyGroup/PackageReleaseNotes" (releaseNotes.Notes |> String.concat "\n") -Target "Build" (fun _ -> - DotNetCli.Build + + +let build _ = + solutionFile + |> DotNet.build (fun p -> - { p with - Project = solutionFile - Configuration = configuration }) // "Rebuild" -) + { p with + Configuration = configuration + }) + //-------------------------------------------------------------------------------- // Tests targets //-------------------------------------------------------------------------------- module internal ResultHandling = + let checkExitCode msg : ProcessResult -> _ = + _.ExitCode + >> function + | 0 -> () + | _ -> failwith msg let (|OK|Failure|) = function | 0 -> OK | x -> Failure x @@ -76,16 +96,16 @@ module internal ResultHandling = Some (sprintf "xUnit2 reported an error (Error Code %d)" errorCode) let failBuildWithMessage = function - | DontFailBuild -> traceError + | DontFailBuild -> Trace.traceError | _ -> (fun m -> raise(FailedTestsException m)) let failBuildIfXUnitReportedError errorLevel = buildErrorMessage >> Option.iter (failBuildWithMessage errorLevel) -Target "RunTests" (fun _ -> +let runTests _ = let projects = - match (isWindows) with + match (Environment.isWindows) with | true -> !! "./src/**/*.Tests.csproj" -- "./src/**/*.Benchmark.*.csproj" -- "./src/**/*.Data.Compatibility.Tests.csproj" // All of the data docker images are Linux only @@ -94,43 +114,40 @@ Target "RunTests" (fun _ -> -- "./src/**/*.Benchmark.*.csproj" -- "./src/Examples/**/*.csproj" // skip example projects ++ "./src/**/*.DockerTests.csproj" // if you need to filter specs for Linux vs. Windows, do it here - let runSingleProject project = - let arguments = + let args = match (hasTeamCity) with - | true -> (sprintf "test -c Release --no-build --logger:trx --logger:\"console;verbosity=normal\" --results-directory %s -- -parallel none -teamcity" (outputTests)) - | false -> (sprintf "test -c Release --no-build --logger:trx --logger:\"console;verbosity=normal\" --results-directory %s -- -parallel none" (outputTests)) - - let result = ExecProcess(fun info -> - info.FileName <- "dotnet" - info.WorkingDirectory <- (Directory.GetParent project).FullName - info.Arguments <- arguments) (TimeSpan.FromMinutes 30.0) - - ResultHandling.failBuildIfXUnitReportedError TestRunnerErrorLevel.Error result - - projects |> Seq.iter (log) + | true -> (sprintf "-c Release --no-build --logger:trx --logger:\"console;verbosity=normal\" --results-directory %s -- -parallel none -teamcity" (outputTests)) + | false -> (sprintf "-c Release --no-build --logger:trx --logger:\"console;verbosity=normal\" --results-directory %s -- -parallel none" (outputTests)) + //We use exec instead of DotNet.test as it doesn't allow for multiple loggers and runsettingsargs are not working https://github.com/fsprojects/FAKE/pull/2771 + in DotNet.exec (fun o -> + { o with + WorkingDirectory = (Directory.GetParent project).FullName + Timeout = Some(TimeSpan.FromMinutes 30.0) + }) "test" args + |> ResultHandling.checkExitCode "Test run failed" + projects |> Seq.iter (Trace.log) projects |> Seq.iter (runSingleProject) -) -Target "NBench" <| fun _ -> +let nbench _ = + let projects = - match (isWindows) with + match Environment.isWindows with | true -> !! "./src/**/*.Tests.Performance.csproj" | _ -> !! "./src/**/*.Tests.Performance.csproj" // if you need to filter specs for Linux vs. Windows, do it here let runSingleProject project = - let arguments = - match (hasTeamCity) with - | true -> (sprintf "nbench --nobuild --teamcity --concurrent true --trace true --output %s" (outputPerfTests)) - | false -> (sprintf "nbench --nobuild --concurrent true --trace true --output %s" (outputPerfTests)) - - let result = ExecProcess(fun info -> - info.FileName <- "dotnet" - info.WorkingDirectory <- (Directory.GetParent project).FullName - info.Arguments <- arguments) (TimeSpan.FromMinutes 30.0) - - ResultHandling.failBuildIfXUnitReportedError TestRunnerErrorLevel.Error result + match (hasTeamCity) with + | true -> (sprintf "--nobuild --teamcity --concurrent true --trace true --output %s" (outputPerfTests)) + | false -> (sprintf "--nobuild --concurrent true --trace true --output %s" (outputPerfTests)) + |> DotNet.exec(fun info -> + { info with + Timeout = Some (TimeSpan.FromMinutes 30.0) + WorkingDirectory = (Directory.GetParent project).FullName + }) "nbench" + |> _.ExitCode + |> ResultHandling.failBuildIfXUnitReportedError TestRunnerErrorLevel.Error projects |> Seq.iter runSingleProject @@ -141,139 +158,151 @@ let overrideVersionSuffix (project:string) = match project with | _ -> versionSuffix // add additional matches to publish different versions for different projects in solution -Target "CreateNuget" (fun _ -> +let createNuget _ = let projects = !! "src/**/*.csproj" -- "src/**/*Tests.csproj" // Don't publish unit tests -- "src/**/*Tests*.csproj" -- "src/**/*.Benchmark.*.csproj" -- "./src/Examples/**/*.csproj" // skip example projects - + let runSingleProject project = - DotNetCli.Pack + DotNet.pack (fun p -> { p with - Project = project Configuration = configuration - AdditionalArgs = ["--include-symbols --no-build"] - VersionSuffix = overrideVersionSuffix project - OutputPath = outputNuGet }) + NoBuild = true + IncludeSymbols = true + + VersionSuffix = (overrideVersionSuffix project) + OutputPath = Some outputNuGet }) project - projects |> Seq.iter (runSingleProject) -) - -Target "PublishNuget" (fun _ -> - let shouldPushNugetPackages = hasBuildParam "nugetkey" - if not shouldPushNugetPackages then () - else - let apiKey = getBuildParam "nugetkey" - let sourceUrl = getBuildParamOrDefault "nugetpublishurl" "https://api.nuget.org/v3/index.json" + projects + |> Seq.iter (runSingleProject) + + +let publishNuget _ = + match Environment.environVarOrNone "nugetkey" with + | None -> printfn "Skip nuget publish as no key were provided" + | Some apiKey -> + let sourceUrl = Environment.environVarOrDefault "nugetpublishurl" "https://api.nuget.org/v3/index.json" let rec publishPackage retryLeft packageFile = - tracefn "Pushing %s Attempts left: %d" (FullName packageFile) retryLeft - let tracing = ProcessHelper.enableProcessTracing + Trace.tracefn "Pushing %s Attempts left: %d" (Path.getFullName packageFile) retryLeft + let before = Process.shouldEnableProcessTracing() try try - ProcessHelper.enableProcessTracing <- false - DotNetCli.RunCommand + Process.setEnableProcessTracing false + DotNet.nugetPush (fun p -> { p with - TimeOut = TimeSpan.FromMinutes 10. }) - (sprintf "nuget push %s --api-key %s --source %s --no-service-endpoint" packageFile apiKey sourceUrl) + Common = { p.Common with Timeout = Some (TimeSpan.FromMinutes 10.) } + PushParams = { p.PushParams with + ApiKey = Some apiKey + Source = Some sourceUrl + NoServiceEndpoint = true } }) + packageFile + with exn -> + printfn "Nuget push failed: %A" <| exn if (retryLeft > 0) then (publishPackage (retryLeft-1) packageFile) finally - ProcessHelper.enableProcessTracing <- tracing + Process.setEnableProcessTracing before printfn "Pushing nuget packages" let normalPackages = !! (outputNuGet @@ "*.nupkg") |> Seq.sortBy(fun x -> x.ToLower()) for package in normalPackages do publishPackage 3 package -) + + + +//-------------------------------------------------------------------------------- +// Restore dotnet tools +//-------------------------------------------------------------------------------- +let restoreTools _ = + let restoreOne = + sprintf "restore --tool-manifest %s --verbosity d " + >> DotNet.exec + (fun p -> + { p with + Timeout = Some(TimeSpan.FromMinutes 10.) + PrintRedirectedOutput = true + }) + "tool" + >> ResultHandling.checkExitCode "dotnet tool restore failed" + in + !! "./.config/*.json" |> Seq.iter restoreOne + //-------------------------------------------------------------------------------- // Documentation //-------------------------------------------------------------------------------- -Target "DocFx" (fun _ -> - // build the projects with samples - //let docsTestsProject = "./src/core/Akka.Docs.Tests/Akka.Docs.Tests.csproj" - //DotNetCli.Restore (fun p -> { p with Project = docsTestsProject }) - //DotNetCli.Build (fun p -> { p with Project = docsTestsProject; Configuration = configuration }) - //let docsTutorialsProject = "./src/core/Akka.Docs.Tutorials/Akka.Docs.Tutorials.csproj" - //DotNetCli.Restore (fun p -> { p with Project = docsTutorialsProject }) - //DotNetCli.Build (fun p -> { p with Project = docsTutorialsProject; Configuration = configuration }) - - // install MSDN references - NugetInstall (fun p -> - { p with - ExcludeVersion = true - Version = "0.1.0-alpha-1611021200" - OutputDirectory = currentDirectory @@ "tools" }) "msdn.4.5.2" - let docsPath = FullName "./docs" - let docFxPath = FullName(findToolInSubPath "docfx.exe" "tools/docfx.console/tools") - - let args = StringBuilder() - |> append (docsPath @@ "docfx.json" ) - |> append ("--warningsAsErrors") - |> toText +let buildDocfx _ = + let args = + StringBuilder() + |> StringBuilder.append (Path.getFullName "./docs" @@ "docfx.json" ) + // |> StringBuilder.append ("--warningsAsErrors") + |> StringBuilder.toText in + DotNet.exec(fun info -> + { info with + Timeout = Some (System.TimeSpan.FromMinutes 45.0) (* Reasonably long-running task. *)}) + "docfx" args + |> ResultHandling.checkExitCode "docfx failed" + + +let serveDocfx _ = + let port = + Environment.GetCommandLineArgs() + |> Seq.tryLast + |> Option.bind (fun arg -> try Some (int arg) with _ -> None) + |> Option.defaultValue 8100 in + let args = sprintf "serve %s --port %d" (Path.getFullName "./docs" @@ "_site" ) port in + DotNet.exec(fun info -> + { info with + Timeout = Some (System.TimeSpan.FromMinutes 45.0) (* Reasonably long-running task. *)}) + "docfx" args + |> ResultHandling.checkExitCode "docfx serve failed" - let result = ExecProcess(fun info -> - info.FileName <- docFxPath - info.WorkingDirectory <- (Path.GetDirectoryName (FullName docFxPath)) - info.Arguments <- args) (System.TimeSpan.FromMinutes 45.0) (* Reasonably long-running task. *) - if result <> 0 then failwithf "DocFX failed. %s %s" docFxPath args -) - //-------------------------------------------------------------------------------- // JetBrain targets //-------------------------------------------------------------------------------- -Target "InspectCode" (fun _ -> - DotNetCli.RunCommand - (fun p -> - { p with - TimeOut = TimeSpan.FromMinutes 10. }) - "tool restore" - DotNetCli.RunCommand +let inspectCode _ = + DotNet.exec (fun p -> { p with - TimeOut = TimeSpan.FromMinutes 10. }) - "dotnet jb inspectcode Akka.Persistence.Sql.sln --build --swea --properties=\"Configuration=Release\" --telemetry-optout --format=\"Html;Xml;Text\" --output=\"TestResults/Akka.Persistence.Sql.jb\"" -) + Timeout = Some(TimeSpan.FromMinutes 10.) }) + "jb" "inspectcode Akka.Persistence.Sql.sln --build --swea --properties=\"Configuration=Release\" --telemetry-optout --format=\"Html;Xml;Text\" --output=\"TestResults/Akka.Persistence.Sql.jb\"" + |> ignore -Target "CleanupCode" (fun _ -> - DotNetCli.RunCommand - (fun p -> - { p with - TimeOut = TimeSpan.FromMinutes 10. }) - "tool restore" - DotNetCli.RunCommand +let cleanupCode _ = + DotNet.exec (fun p -> { p with - TimeOut = TimeSpan.FromMinutes 10. }) - "dotnet jb cleanupcode Akka.Persistence.Sql.sln --profile=\"Akka.NET\" --properties=\"Configuration=Release\" --telemetry-optout" -) + Timeout = Some(TimeSpan.FromMinutes 10.) }) + "jb" "cleanupcode Akka.Persistence.Sql.sln --profile=\"Akka.NET\" --properties=\"Configuration=Release\" --telemetry-optout" + |> ignore //-------------------------------------------------------------------------------- // Cleanup //-------------------------------------------------------------------------------- -FinalTarget "KillCreatedProcesses" (fun _ -> - log "Shutting down dotnet build-server" - let result = ExecProcess(fun info -> - info.FileName <- "dotnet" - info.WorkingDirectory <- __SOURCE_DIRECTORY__ - info.Arguments <- "build-server shutdown") (System.TimeSpan.FromMinutes 2.0) - if result <> 0 then failwithf "dotnet build-server shutdown failed" -) +let killCreatedProcesses _ = + Trace.log "Shutting down dotnet build-server" + DotNet.exec (fun p -> + { p with + WorkingDirectory = root + Timeout = Some(TimeSpan.FromMinutes 2.) }) + "build-server" "shutdown" + |> ResultHandling.checkExitCode "dotnet build-server shutdown failed" //-------------------------------------------------------------------------------- // Help //-------------------------------------------------------------------------------- -Target "Help" <| fun _ -> +let help _ = List.iter printfn [ "usage:" - "./build.ps1 [target]" + "./build.[sh|cmd] [target]" "" " Targets for building:" " * Build Builds" @@ -288,28 +317,64 @@ Target "Help" <| fun _ -> //-------------------------------------------------------------------------------- // Target dependencies //-------------------------------------------------------------------------------- -Target "BuildRelease" DoNothing -Target "All" DoNothing -Target "Nuget" DoNothing - -// build dependencies -"Clean" ==> "AssemblyInfo" ==> "Build" ==> "InspectCode" ==> "BuildRelease" - -// tests dependencies -"Build" ==> "RunTests" - -// nuget dependencies -"Clean" ==> "Build" ==> "CreateNuget" -"CreateNuget" ==> "PublishNuget" ==> "Nuget" - -// jetbrain dependencies -"InspectCode" -"Build" ==> "CleanupCode" - -// all -"BuildRelease" ==> "All" -"RunTests" ==> "All" -"NBench" ==> "All" -"Nuget" ==> "All" - -RunTargetOrDefault "Help" +let initTargets () = + Target.create "BuildRelease" ignore + Target.create "All" ignore + Target.create "Nuget" ignore + Target.create "Clean" clean + Target.create "AssemblyInfo" assemblyInfo + Target.create "Build" build + Target.create "RunTests" runTests + Target.create "NBench" nbench + Target.create "PublishNuget" publishNuget + Target.create "CreateNuget" createNuget + Target.create "RestoreTools" restoreTools + Target.create "DocFx" buildDocfx + Target.create "ServeDocFx" serveDocfx + Target.create "InspectCode" inspectCode + Target.create "CleanupCode" cleanupCode + Target.createFinal "KillCreatedProcesses" killCreatedProcesses + Target.create "Help" help + // build dependencies + "Clean" ==> "AssemblyInfo" ==> "Build" ==> "InspectCode" ==> "BuildRelease" |> ignore + + // tests dependencies + "Build" ==> "RunTests" |> ignore + + // nuget dependencies + "Clean" ==> "Build" ==> "CreateNuget" |> ignore + "CreateNuget" ==> "PublishNuget" ==> "Nuget" |> ignore + + // jetbrain dependencies + "RestoreTools" ==> "InspectCode" |> ignore + "RestoreTools" ==> "Build" ==> "CleanupCode" |> ignore + + // all + "BuildRelease" ==> "All" |> ignore + "RunTests" ==> "All" |> ignore + "NBench" ==> "All" |> ignore + "Nuget" ==> "All" |> ignore + + //docs + "RestoreTools" ==> "DocFx" |> ignore + "RestoreTools" ==> "DocFx" ==> "ServeDocFx" |> ignore + + //workaround for https://github.com/fsprojects/FAKE/issues/2744 + Microsoft.Build.Logging.StructuredLogger.Strings.Initialize() + + "Help" // <- default target + +//----------------------------------------------------------------------------- +// Target Start +//----------------------------------------------------------------------------- + +System.Environment.GetCommandLineArgs() +|> Array.skip 2 +|> Array.toList +|> Context.FakeExecutionContext.Create false "build.fsx" +|> Context.RuntimeContext.Fake +|> Context.setExecutionContext +|> initTargets +|> Target.runOrDefaultWithArguments + +0 \ No newline at end of file diff --git a/build.ps1 b/build.ps1 deleted file mode 100644 index 5b4111b8..00000000 --- a/build.ps1 +++ /dev/null @@ -1,100 +0,0 @@ -<# -.SYNOPSIS -This is a Powershell script to bootstrap a Fake build. -.DESCRIPTION -This Powershell script will download NuGet if missing, restore NuGet tools (including Fake) -and execute your Fake build script with the parameters you provide. -.PARAMETER Target -The build script target to run. -.PARAMETER Configuration -The build configuration to use. -.PARAMETER Verbosity -Specifies the amount of information to be displayed. -.PARAMETER WhatIf -Performs a dry run of the build script. -No tasks will be executed. -.PARAMETER ScriptArgs -Remaining arguments are added here. -#> - -[CmdletBinding()] -Param( - [string]$Target = "Default", - [ValidateSet("Release", "Debug")] - [string]$Configuration = "Release", - [ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")] - [string]$Verbosity = "Verbose", - [switch]$WhatIf, - [Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)] - [string[]]$ScriptArgs -) - -$FakeVersion = "4.63.0" -$NugetVersion = "5.8.0" -$NugetUrl = "https://dist.nuget.org/win-x86-commandline/v$NugetVersion/nuget.exe" -$DocfxVersion = "2.59.4" - -# Make sure tools folder exists -$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent -$ToolPath = Join-Path $PSScriptRoot "tools" -if (!(Test-Path $ToolPath)) { - Write-Verbose "Creating tools directory..." - New-Item -Path $ToolPath -Type directory | out-null -} - -########################################################################### -# INSTALL NUGET -########################################################################### - -# Make sure nuget.exe exists. -$NugetPath = Join-Path $ToolPath "nuget.exe" -if (!(Test-Path $NugetPath)) { - Write-Host "Downloading NuGet.exe..." - (New-Object System.Net.WebClient).DownloadFile($NugetUrl, $NugetPath); -} - -########################################################################### -# INSTALL FAKE -########################################################################### -# Make sure Fake has been installed. - -$FakeExePath = Join-Path $ToolPath "FAKE/tools/FAKE.exe" -if (!(Test-Path $FakeExePath)) { - Write-Host "Installing Fake..." - Invoke-Expression "&`"$NugetPath`" install Fake -ExcludeVersion -Version $FakeVersion -OutputDirectory `"$ToolPath`"" | Out-Null; - if ($LASTEXITCODE -ne 0) { - Throw "An error occured while restoring Fake from NuGet." - } -} - -########################################################################### -# Docfx -########################################################################### - -# Make sure Docfx has been installed. -$DocfxExePath = Join-Path $ToolPath "docfx.console/tools/docfx.exe" -if (!(Test-Path $DocfxExePath)) { - Write-Host "Installing Docfx..." - Invoke-Expression "&`"$NugetPath`" install docfx.console -ExcludeVersion -Version $DocfxVersion -OutputDirectory `"$ToolPath`"" | Out-Null; - if ($LASTEXITCODE -ne 0) { - Throw "An error occured while restoring docfx.console from NuGet." - } -} - -########################################################################### -# RUN BUILD SCRIPT -########################################################################### - -# Build the argument list. -$Arguments = @{ - target=$Target; - configuration=$Configuration; - verbosity=$Verbosity; - dryrun=$WhatIf; -}.GetEnumerator() | %{"--{0}=`"{1}`"" -f $_.key, $_.value }; - -# Start Fake -Write-Host "Running build script..." -Invoke-Expression "$FakeExePath `"build.fsx`" $ScriptArgs $Arguments" - -exit $LASTEXITCODE diff --git a/build.sh b/build.sh old mode 100644 new mode 100755 index 9250417f..b3e276df --- a/build.sh +++ b/build.sh @@ -1,81 +1,6 @@ #!/usr/bin/env bash -########################################################################## -# This is the Fake bootstrapper script for Linux and OS X. -########################################################################## -# Define directories. -SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) -TOOLS_DIR=$SCRIPT_DIR/tools -NUGET_EXE=$TOOLS_DIR/nuget.exe -NUGET_URL=https://dist.nuget.org/win-x86-commandline/v5.8.0/nuget.exe -FAKE_VERSION=4.63.0 -FAKE_EXE=$TOOLS_DIR/FAKE/tools/FAKE.exe +set -eu +set -o pipefail -# Define default arguments. -TARGET="Default" -CONFIGURATION="Release" -VERBOSITY="verbose" -DRYRUN= -SCRIPT_ARGUMENTS=() - -# Parse arguments. -for i in "$@"; do - case $1 in - -t|--target) TARGET="$2"; shift ;; - -c|--configuration) CONFIGURATION="$2"; shift ;; - -v|--verbosity) VERBOSITY="$2"; shift ;; - -d|--dryrun) DRYRUN="-dryrun" ;; - --) shift; SCRIPT_ARGUMENTS+=("$@"); break ;; - *) SCRIPT_ARGUMENTS+=("$1") ;; - esac - shift -done - -# Make sure the tools folder exist. -if [ ! -d "$TOOLS_DIR" ]; then - mkdir "$TOOLS_DIR" -fi - -########################################################################### -# INSTALL NUGET -########################################################################### - -# Download NuGet if it does not exist. -if [ ! -f "$NUGET_EXE" ]; then - echo "Downloading NuGet..." - curl -Lsfo "$NUGET_EXE" $NUGET_URL - if [ $? -ne 0 ]; then - echo "An error occured while downloading nuget.exe." - exit 1 - fi -fi - -########################################################################### -# INSTALL FAKE -########################################################################### - -if [ ! -f "$FAKE_EXE" ]; then - mono "$NUGET_EXE" install Fake -ExcludeVersion -Version $FAKE_VERSION -OutputDirectory "$TOOLS_DIR" - if [ $? -ne 0 ]; then - echo "An error occured while installing Cake." - exit 1 - fi -fi - -# Make sure that Fake has been installed. -if [ ! -f "$FAKE_EXE" ]; then - echo "Could not find Fake.exe at '$FAKE_EXE'." - exit 1 -fi - -########################################################################### -# WORKAROUND FOR MONO -########################################################################### -export FrameworkPathOverride=/usr/lib/mono/4.5/ - -########################################################################### -# RUN BUILD SCRIPT -########################################################################### - -# Start Fake -exec mono "$FAKE_EXE" build.fsx "${SCRIPT_ARGUMENTS[@]}" --verbosity=$VERBOSITY --configuration=$CONFIGURATION --target=$TARGET $DRYRUN +dotnet fsi build.fsx -- -t "$@" diff --git a/docs/articles/migration.md b/docs/articles/migration.md index 3c193cf4..6632ee90 100644 --- a/docs/articles/migration.md +++ b/docs/articles/migration.md @@ -20,8 +20,8 @@ This guide are only needed if you intend to migrate from legacy `Akka.Persistenc * [Migrating Using Compatibility Mode](#migrating-using-compatibility-mode) + [Akka.Hosting Migration](#akkahosting-migration) + [HOCON Migration](#hocon-migration) -* [Tag Table Based Tag Query Migration (Optional)](#tag-table-based-tag-query-migration-optional) -* [Enable WriterUuid Anti-Corruption Layer Feature (Optional)](#enable-writeruuid-anti-corruption-layer-feature-optional) +* [Upgrading to Tag Table (Optional)](#upgrading-to-tag-table-optional) +* [Enable WriterUuid Anti-Corruption Layer Feature (Recommended)](#enable-writeruuid-anti-corruption-layer-feature-recommended) # Migrating Using Compatibility Mode diff --git a/docs/docfx.json b/docs/docfx.json index 52b15fe5..05482323 100644 --- a/docs/docfx.json +++ b/docs/docfx.json @@ -62,7 +62,7 @@ ] }], "xref": [ - "../tools/msdn.4.5.2/content/msdn.4.5.2.zip" + "https://learn.microsoft.com/en-us/dotnet/.xrefmap.json" ], "globalMetadata": { "_appTitle": "Akka.Persistence.Sql Documentation", diff --git a/serve-docs.cmd b/serve-docs.cmd index 2c98378e..083a3640 100644 --- a/serve-docs.cmd +++ b/serve-docs.cmd @@ -1 +1 @@ -PowerShell.exe -file "serve-docs.ps1" %* .\docs\docfx.json --serve -p 8100 \ No newline at end of file +dotnet fsi build.fsx -- -t "ServeDocFx" %* 8100 \ No newline at end of file diff --git a/serve-docs.ps1 b/serve-docs.ps1 deleted file mode 100644 index 91dbe9fb..00000000 --- a/serve-docs.ps1 +++ /dev/null @@ -1,21 +0,0 @@ -# docfx.ps1 -$VisualStudioVersion = "15.0"; -$DotnetSDKVersion = "2.0.0"; - -# Get dotnet paths -$MSBuildExtensionsPath = "C:\Program Files\dotnet\sdk\" + $DotnetSDKVersion; -$MSBuildSDKsPath = $MSBuildExtensionsPath + "\SDKs"; - -# Get Visual Studio install path -$VSINSTALLDIR = $(Get-ItemProperty "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\SxS\VS7").$VisualStudioVersion; - -# Add Visual Studio environment variables -$env:VisualStudioVersion = $VisualStudioVersion; -$env:VSINSTALLDIR = $VSINSTALLDIR; - -# Add dotnet environment variables -$env:MSBuildExtensionsPath = $MSBuildExtensionsPath; -$env:MSBuildSDKsPath = $MSBuildSDKsPath; - -# Build our docs -& .\tools\docfx.console\tools\docfx @args \ No newline at end of file diff --git a/serve-docs.sh b/serve-docs.sh new file mode 100755 index 00000000..b3f99618 --- /dev/null +++ b/serve-docs.sh @@ -0,0 +1 @@ +dotnet fsi build.fsx -- -t "ServeDocFx" %* "$@" 8100 \ No newline at end of file diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 39861213..dafd40a2 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -14,7 +14,7 @@ netstandard2.0 - net7.0 + net8.0 diff --git a/src/Directory.Generated.props b/src/Directory.Generated.props index bcbe57fc..abf45109 100644 --- a/src/Directory.Generated.props +++ b/src/Directory.Generated.props @@ -1,27 +1,11 @@ - 1.5.2 - > **NOTE: Database schema changes** -> -> 1.5.2-beta1 package should be considered as deprecated. If you experimented with 1.5.2-beta1, you will need to drop existing persistence tables and recreate them using 1.5.2-beta2 -[Fix event journal table and tag table constraints and indices](https://github.com/akkadotnet/Akka.Persistence.Sql/pull/211) -[Fix snapshot table constraints and indices](https://github.com/akkadotnet/Akka.Persistence.Sql/pull/216) -This beta version introduces database schema optimization to: -Improve the tag table based query performance, without compromising overall persistence performance. -Improve inter-compatibility with other SQL persistence plugins. -Tag Query Benchmark** -Benchmark is performed on a worst possible scenario: -Event journal table with 3 million row entries -Tagged events near the end of the table -| Tag Count | TagMode | Mean | Error | StdDev | -|-----------------:|--------- |-------------:|-----------:|-----------:| -| 10 | Csv | 1,746.621 ms | 27.8946 ms | 29.8469 ms | -| 100 | Csv | 1,724.465 ms | 25.4638 ms | 23.8189 ms | -| 1000 | Csv | 1,723.063 ms | 26.2311 ms | 24.5366 ms | -| 10000 | Csv | 1,873.467 ms | 26.1173 ms | 23.1523 ms | -| 10 | TagTable | 3.201 ms | 0.0633 ms | 0.1479 ms | -| 100 | TagTable | 5.163 ms | 0.1018 ms | 0.1358 ms | -| 1000 | TagTable | 25.545 ms | 0.4952 ms | 0.4864 ms | -| 10000 | TagTable | 441.877 ms | 3.5410 ms | 2.9569 ms | + 1.5.13 + [Update Akka.NET to 1.5.13](https://github.com/akkadotnet/akka.net/releases/tag/1.5.13) +[Fix missing Persistence.Query configuration in legacy HOCON configuration mode](https://github.com/akkadotnet/Akka.Persistence.Sql/pull/317) +[Bump Akka.Hosting version to 1.5.12.1](https://github.com/akkadotnet/Akka.Persistence.Sql/pull/312) +[Bump Language.Ext.Core version to 4.4.4](https://github.com/akkadotnet/Akka.Persistence.Sql/pull/315) +[Bump System.Reactive.Linq version to 6.0.0](https://github.com/akkadotnet/Akka.Persistence.Sql/pull/260) +[Bump linq2db version to 5.2.2](https://github.com/akkadotnet/Akka.Persistence.Sql/pull/266) \ No newline at end of file diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 4d0f3ca1..41c369fb 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -61,7 +61,7 @@ - +