diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c5b558c3..6fadb7f1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,9 @@ on: jobs: build: strategy: + fail-fast: false matrix: + configuration: [Debug, Release] os: [ubuntu-latest, windows-latest, macOS-latest] runs-on: ${{ matrix.os }} @@ -23,6 +25,7 @@ jobs: global-json-file: global.json dotnet-version: | 6.x + 7.x - name: Build via Bash if: runner.os != 'Windows' @@ -30,9 +33,11 @@ jobs: chmod +x ./build.sh ./build.sh IntegrationTests env: + CONFIGURATION: ${{ matrix.configuration }} CI: true - name: Build via Windows if: runner.os == 'Windows' run: ./build.cmd IntegrationTests env: + CONFIGURATION: ${{ matrix.configuration }} CI: true diff --git a/Content/Console/.github/workflows/build.yml b/Content/Console/.github/workflows/build.yml index b9e4ff90..643b82e6 100644 --- a/Content/Console/.github/workflows/build.yml +++ b/Content/Console/.github/workflows/build.yml @@ -17,6 +17,7 @@ jobs: build: strategy: matrix: + configuration: [Debug, Release] os: [ubuntu-latest, windows-latest, macOS-latest] runs-on: ${{ matrix.os }} @@ -29,6 +30,7 @@ jobs: with: dotnet-version: | 6.x + 7.x global-json-file: global.json - name: Build @@ -39,6 +41,7 @@ jobs: chmod +x ./build.sh ./build.sh env: + CONFIGURATION: ${{ matrix.configuration }} CI: true - name: Build if: runner.os == 'Windows' @@ -46,4 +49,5 @@ jobs: dotnet --info ./build.cmd env: + CONFIGURATION: ${{ matrix.configuration }} CI: true diff --git a/Content/Console/Directory.Build.props b/Content/Console/Directory.Build.props index 88bf2b9b..26a15e25 100644 --- a/Content/Console/Directory.Build.props +++ b/Content/Console/Directory.Build.props @@ -1,6 +1,10 @@ + + - f#, fsharp https://github.com/MyGithubUsername/MyLib.1 https://github.com/MyGithubUsername/MyLib.1/blob/master/LICENSE.md @@ -8,7 +12,6 @@ git MyGithubUsername https://github.com/MyGithubUsername/MyLib.1 - false diff --git a/Content/Console/Directory.Build.targets b/Content/Console/Directory.Build.targets new file mode 100644 index 00000000..21da1237 --- /dev/null +++ b/Content/Console/Directory.Build.targets @@ -0,0 +1,26 @@ + + + + + <_BuildProjBaseIntermediateOutputPath>$(MSBuildThisFileDirectory)build/obj/ + <_DotnetToolManifestFile>$(MSBuildThisFileDirectory).config/dotnet-tools.json + <_DotnetToolRestoreOutputFile>$(_BuildProjBaseIntermediateOutputPath)/dotnet-tool-restore-$(NETCoreSdkVersion) + <_DotnetFantomasOutputFile>$(BaseIntermediateOutputPath)dotnet-fantomas-msbuild + + + + + + + + + + + + + + + diff --git a/Content/Console/build.cmd b/Content/Console/build.cmd index 140db8b3..b9f6df44 100644 --- a/Content/Console/build.cmd +++ b/Content/Console/build.cmd @@ -1,4 +1 @@ -echo Restoring dotnet tools... -dotnet tool restore - dotnet run --project ./build/build.fsproj -- -t %* diff --git a/Content/Console/build.sh b/Content/Console/build.sh index 779c670f..0783d630 100755 --- a/Content/Console/build.sh +++ b/Content/Console/build.sh @@ -3,7 +3,4 @@ set -eu set -o pipefail -echo "Restoring dotnet tools..." -dotnet tool restore - FAKE_DETAILED_ERRORS=true dotnet run --project ./build/build.fsproj -- -t "$@" diff --git a/Content/Console/build/build.fs b/Content/Console/build/build.fs index 84d960c5..9b856e62 100644 --- a/Content/Console/build/build.fs +++ b/Content/Console/build/build.fs @@ -29,12 +29,20 @@ let environVarAsBoolOrDefault varName defaultValue = with _ -> defaultValue + +let isCI = lazy environVarAsBoolOrDefault "CI" false + //----------------------------------------------------------------------------- // Metadata and Configuration //----------------------------------------------------------------------------- let productName = "MyLib.1" + +let rootDirectory = + __SOURCE_DIRECTORY__ + ".." + let sln = __SOURCE_DIRECTORY__ ".." @@ -175,8 +183,7 @@ let failOnBadExitAndPrint (p: ProcessResult) = failwithf "failed with exitcode %d" p.ExitCode let rec retryIfInCI times fn = - match Environment.environVarOrNone "CI" with - | Some _ -> + if isCI.Value then if times > 1 then try fn () @@ -184,7 +191,8 @@ let rec retryIfInCI times fn = retryIfInCI (times - 1) fn else fn () - | _ -> fn () + else + fn () let allReleaseChecks () = @@ -544,14 +552,15 @@ let githubRelease _ = |> GitHub.publishDraft |> Async.RunSynchronously + let formatCode _ = - let result = dotnet.fantomas "." + let result = dotnet.fantomas $"{rootDirectory}" if not result.OK then printfn "Errors while formatting all files: %A" result.Messages -let checkFormatCode _ = - let result = dotnet.fantomas "--check ." +let checkFormatCode ctx = + let result = dotnet.fantomas $"{rootDirectory} --check" if result.ExitCode = 0 then Trace.log "No files need formatting" @@ -560,6 +569,7 @@ let checkFormatCode _ = else Trace.logf "Errors while formatting: %A" result.Errors + let initTargets () = BuildServer.install [ GitHubActions.Installer ] @@ -635,7 +645,7 @@ let initTargets () = ==>! "GitRelease" "DotnetRestore" - ==> "CheckFormatCode" + =?> ("CheckFormatCode", isCI.Value) ==> "DotnetBuild" // ==> "FSharpAnalyzers" ==> "DotnetTest" diff --git a/Content/Library/.github/workflows/build.yml b/Content/Library/.github/workflows/build.yml index 4e82db7c..b1df5e54 100644 --- a/Content/Library/.github/workflows/build.yml +++ b/Content/Library/.github/workflows/build.yml @@ -12,6 +12,7 @@ jobs: build: strategy: matrix: + configuration: [Debug, Release] os: [ubuntu-latest, windows-latest, macOS-latest] runs-on: ${{ matrix.os }} @@ -23,6 +24,7 @@ jobs: global-json-file: global.json dotnet-version: | 6.x + 7.x - name: Build via Bash if: runner.os != 'Windows' @@ -31,10 +33,12 @@ jobs: ./build.sh env: CI: true + CONFIGURATION: ${{ matrix.configuration }} ENABLE_COVERAGE: true - name: Build via Windows if: runner.os == 'Windows' run: ./build.cmd env: CI: true + CONFIGURATION: ${{ matrix.configuration }} ENABLE_COVERAGE: true diff --git a/Content/Library/Directory.Build.props b/Content/Library/Directory.Build.props index 8ab5878f..a1b72e35 100644 --- a/Content/Library/Directory.Build.props +++ b/Content/Library/Directory.Build.props @@ -1,3 +1,9 @@ + + + f#, fsharp @@ -13,7 +19,7 @@ false - - + + diff --git a/Content/Library/Directory.Build.targets b/Content/Library/Directory.Build.targets new file mode 100644 index 00000000..21da1237 --- /dev/null +++ b/Content/Library/Directory.Build.targets @@ -0,0 +1,26 @@ + + + + + <_BuildProjBaseIntermediateOutputPath>$(MSBuildThisFileDirectory)build/obj/ + <_DotnetToolManifestFile>$(MSBuildThisFileDirectory).config/dotnet-tools.json + <_DotnetToolRestoreOutputFile>$(_BuildProjBaseIntermediateOutputPath)/dotnet-tool-restore-$(NETCoreSdkVersion) + <_DotnetFantomasOutputFile>$(BaseIntermediateOutputPath)dotnet-fantomas-msbuild + + + + + + + + + + + + + + + diff --git a/Content/Library/build.cmd b/Content/Library/build.cmd index 140db8b3..b9f6df44 100644 --- a/Content/Library/build.cmd +++ b/Content/Library/build.cmd @@ -1,4 +1 @@ -echo Restoring dotnet tools... -dotnet tool restore - dotnet run --project ./build/build.fsproj -- -t %* diff --git a/Content/Library/build.sh b/Content/Library/build.sh index 779c670f..0783d630 100755 --- a/Content/Library/build.sh +++ b/Content/Library/build.sh @@ -3,7 +3,4 @@ set -eu set -o pipefail -echo "Restoring dotnet tools..." -dotnet tool restore - FAKE_DETAILED_ERRORS=true dotnet run --project ./build/build.fsproj -- -t "$@" diff --git a/Content/Library/build/FsDocs.fs b/Content/Library/build/FsDocs.fs index 07036730..d69b4524 100644 --- a/Content/Library/build/FsDocs.fs +++ b/Content/Library/build/FsDocs.fs @@ -14,71 +14,70 @@ module Fsdocs = /// /// Fsdocs build command parameters and options /// - type BuildCommandParams = - { - /// Input directory of content (default: docs) - Input: string option + type BuildCommandParams = { + /// Input directory of content (default: docs) + Input: string option - /// Project files to build API docs for outputs, defaults to all packable projects - Projects: seq option + /// Project files to build API docs for outputs, defaults to all packable projects + Projects: seq option - /// Output Directory (default output for build and tmp/watch for watch) - Output: string option + /// Output Directory (default output for build and tmp/watch for watch) + Output: string option - /// Disable generation of API docs - NoApiDocs: bool option + /// Disable generation of API docs + NoApiDocs: bool option - /// Evaluate F# fragments in scripts - Eval: bool option + /// Evaluate F# fragments in scripts + Eval: bool option - /// Save images referenced in docs - SaveImages: bool option + /// Save images referenced in docs + SaveImages: bool option - /// Add line numbers - LineNumbers: bool option + /// Add line numbers + LineNumbers: bool option - /// Additional substitution parameters for templates - Parameters: seq option + /// Additional substitution parameters for templates + Parameters: seq option - /// Disable project cracking. - IgnoreProjects: bool option + /// Disable project cracking. + IgnoreProjects: bool option - /// In API doc generation qualify the output by the collection name, e.g. 'reference/FSharp.Core/...' instead of 'reference/...' . - Qualify: bool option + /// In API doc generation qualify the output by the collection name, e.g. 'reference/FSharp.Core/...' instead of 'reference/...' . + Qualify: bool option - /// The tool will also generate documentation for non-public members - NoPublic: bool option + /// The tool will also generate documentation for non-public members + NoPublic: bool option - /// Do not copy default content styles, javascript or use default templates - NoDefaultContent: bool option + /// Do not copy default content styles, javascript or use default templates + NoDefaultContent: bool option - /// Clean the output directory - Clean: bool option + /// Clean the output directory + Clean: bool option - /// Display version information - Version: bool option + /// Display version information + Version: bool option - /// Provide properties to dotnet msbuild, e.g. --properties Configuration=Release Version=3.4 - Properties: string option + /// Provide properties to dotnet msbuild, e.g. --properties Configuration=Release Version=3.4 + Properties: string option - /// Additional arguments passed down as otherflags to the F# compiler when the API is being generated. - /// Note that these arguments are trimmed, this is to overcome a limitation in the command line argument - /// processing. A typical use-case would be to pass an addition assembly reference. - /// Example --fscoptions " -r:MyAssembly.dll" - FscOptions: string option + /// Additional arguments passed down as otherflags to the F# compiler when the API is being generated. + /// Note that these arguments are trimmed, this is to overcome a limitation in the command line argument + /// processing. A typical use-case would be to pass an addition assembly reference. + /// Example --fscoptions " -r:MyAssembly.dll" + FscOptions: string option - /// Fail if docs are missing or can't be generated - Strict: bool option + /// Fail if docs are missing or can't be generated + Strict: bool option - /// Source folder at time of component build (<FsDocsSourceFolder>) - SourceFolder: string option + /// Source folder at time of component build (<FsDocsSourceFolder>) + SourceFolder: string option - /// Source repository for github links (<FsDocsSourceRepository>) - SourceRepository: string option + /// Source repository for github links (<FsDocsSourceRepository>) + SourceRepository: string option - /// Assume comments in F# code are markdown (<UsesMarkdownComments>) - MdComments: bool option - } + /// Assume comments in F# code are markdown (<UsesMarkdownComments>) + MdComments: bool option + } with /// Parameter default values. static member Default = { @@ -107,23 +106,22 @@ module Fsdocs = /// /// Fsdocs watch command parameters and options /// - type WatchCommandParams = - { - /// Do not serve content when watching. - NoServer: bool option + type WatchCommandParams = { + /// Do not serve content when watching. + NoServer: bool option - /// Do not launch a browser window. - NoLaunch: bool option + /// Do not launch a browser window. + NoLaunch: bool option - /// URL extension to launch http://localhost:/%s. - Open: string option + /// URL extension to launch http://localhost:/%s. + Open: string option - /// Port to serve content for http://localhost serving. - Port: int option + /// Port to serve content for http://localhost serving. + Port: int option - /// Build Commands - BuildCommandParams: BuildCommandParams option - } + /// Build Commands + BuildCommandParams: BuildCommandParams option + } with /// Parameter default values. static member Default = { diff --git a/Content/Library/build/build.fs b/Content/Library/build/build.fs index 5c0c5840..f9a92fd7 100644 --- a/Content/Library/build/build.fs +++ b/Content/Library/build/build.fs @@ -170,7 +170,7 @@ let failOnBadExitAndPrint (p: ProcessResult) = let isCI = lazy environVarAsBoolOrDefault "CI" false -// CI Servers can have bizzare failures that have nothing to do with your code +// CI Servers can have bizarre failures that have nothing to do with your code let rec retryIfInCI times fn = match isCI.Value with | true -> @@ -228,13 +228,13 @@ module FSharpAnalyzers = module DocsTool = let quoted s = $"\"%s{s}\"" - let fsDocsDotnetOptions (o: DotNet.Options) = - { o with + let fsDocsDotnetOptions (o: DotNet.Options) = { + o with WorkingDirectory = rootDirectory - } + } - let fsDocsBuildParams configuration (p: Fsdocs.BuildCommandParams) = - { p with + let fsDocsBuildParams configuration (p: Fsdocs.BuildCommandParams) = { + p with Clean = Some true Input = Some(quoted docsSrcDir) Output = Some(quoted docsDir) @@ -252,7 +252,7 @@ module DocsTool = "fsdocs-release-notes-link", quoted (CHANGELOGlink.ToString()) ] Strict = Some true - } + } let cleanDocsCache () = Fsdocs.cleanCache rootDirectory @@ -267,18 +267,18 @@ module DocsTool = Option.defaultValue Fsdocs.BuildCommandParams.Default bp |> fsDocsBuildParams configuration - { bp with - Output = Some watchDocsDir - Strict = None + { + bp with + Output = Some watchDocsDir + Strict = None } Fsdocs.watch fsDocsDotnetOptions - (fun p -> - { p with + (fun p -> { + p with BuildCommandParams = Some(buildParams p.BuildCommandParams) - } - ) + }) let allReleaseChecks () = failOnWrongBranch () @@ -337,13 +337,12 @@ let dotnetRestore _ = |> String.concat " " DotNet.restore - (fun c -> - { c with + (fun c -> { + c with Common = c.Common |> DotNet.Options.withCustomParams (Some(args)) - } - ) + }) dir ) |> Seq.iter (retryIfInCI 10) @@ -368,15 +367,14 @@ let dotnetBuild ctx = ] DotNet.build - (fun c -> - { c with + (fun c -> { + c with Configuration = configuration (ctx.Context.AllExecutingTargets) Common = c.Common |> DotNet.Options.withAdditionalArgs args - } - ) + }) sln let fsharpAnalyzers _ = @@ -407,14 +405,20 @@ let dotnetTest ctx = |> Seq.map IO.Path.GetFileNameWithoutExtension |> String.concat "|" - let isGenerateCoverageReport = ctx.Context.TryFindTarget("GenerateCoverageReport").IsSome + let isGenerateCoverageReport = + ctx.Context.TryFindTarget("GenerateCoverageReport").IsSome let args = [ "--no-build" - if enableCodeCoverage || isGenerateCoverageReport then + if + enableCodeCoverage + || isGenerateCoverageReport + then sprintf "/p:AltCover=true" + if not isGenerateCoverageReport then sprintf "/p:AltCoverThreshold=%d" coverageThresholdPercent + sprintf "/p:AltCoverAssemblyExcludeFilter=%s" excludeCoverage "/p:AltCoverLocalSource=true" ] @@ -422,13 +426,13 @@ let dotnetTest ctx = DotNet.test (fun c -> - { c with - Configuration = configuration (ctx.Context.AllExecutingTargets) - Common = - c.Common - |> DotNet.Options.withAdditionalArgs args - } - ) + { + c with + Configuration = configuration (ctx.Context.AllExecutingTargets) + Common = + c.Common + |> DotNet.Options.withAdditionalArgs args + }) sln let generateCoverageReport _ = @@ -459,7 +463,9 @@ let generateCoverageReport _ = let showCoverageReport _ = failOnCIBuild () - coverageReportDir "index.html" + + coverageReportDir + "index.html" |> Command.ShellCommand |> CreateProcess.fromCommand |> Proc.start @@ -554,8 +560,7 @@ let generateAssemblyInfo _ = let dotnetPack ctx = // Get release notes with properly-linked version number - let releaseNotes = - Changelog.mkReleaseNotes changelog latestEntry gitHubRepoUrl + let releaseNotes = Changelog.mkReleaseNotes changelog latestEntry gitHubRepoUrl let args = [ $"/p:PackageVersion={latestEntry.NuGetVersion}" @@ -563,15 +568,14 @@ let dotnetPack ctx = ] DotNet.pack - (fun c -> - { c with + (fun c -> { + c with Configuration = configuration (ctx.Context.AllExecutingTargets) OutputPath = Some distDir Common = c.Common |> DotNet.Options.withAdditionalArgs args - } - ) + }) sln let sourceLinkTest _ = @@ -581,8 +585,8 @@ let sourceLinkTest _ = let publishToNuget _ = allPublishChecks () - Paket.push (fun c -> - { c with + Paket.push (fun c -> { + c with ToolType = ToolType.CreateLocalTool() PublishUrl = publishUrl WorkingDir = "dist" @@ -590,8 +594,7 @@ let publishToNuget _ = match nugetToken with | Some s -> s | _ -> c.ApiKey // assume paket-config was set properly - } - ) + }) let gitRelease _ = allReleaseChecks () @@ -601,14 +604,18 @@ let gitRelease _ = Git.Staging.stageFile "" "CHANGELOG.md" |> ignore - !!(rootDirectory "src/**/AssemblyInfo.fs") - ++ (rootDirectory "tests/**/AssemblyInfo.fs") + !!(rootDirectory + "src/**/AssemblyInfo.fs") + ++ (rootDirectory + "tests/**/AssemblyInfo.fs") |> Seq.iter ( Git.Staging.stageFile "" >> ignore ) - let msg = sprintf "Bump version to %s\n\n%s" latestEntry.NuGetVersion releaseNotesGitCommitFormat + let msg = + sprintf "Bump version to %s\n\n%s" latestEntry.NuGetVersion releaseNotesGitCommitFormat + Git.Commit.exec "" msg Target.deactivateBuildFailure "RevertChangelog" @@ -633,8 +640,7 @@ let githubRelease _ = let files = !!distGlob // Get release notes with properly-linked version number - let releaseNotes = - Changelog.mkReleaseNotes changelog latestEntry gitHubRepoUrl + let releaseNotes = Changelog.mkReleaseNotes changelog latestEntry gitHubRepoUrl GitHub.createClientWithToken token |> GitHub.draftNewRelease @@ -650,38 +656,13 @@ let githubRelease _ = |> Async.RunSynchronously let formatCode _ = - let result = - [ - srcCodeGlob - testsCodeGlob - ] - |> Seq.collect id - // Ignore AssemblyInfo - |> Seq.filter (fun f -> - f.EndsWith("AssemblyInfo.fs") - |> not - ) - |> String.concat " " - |> dotnet.fantomas + let result = dotnet.fantomas $"{rootDirectory}" if not result.OK then printfn "Errors while formatting all files: %A" result.Messages -let checkFormatCode _ = - let result = - [ - srcCodeGlob - testsCodeGlob - ] - |> Seq.collect id - // Ignore AssemblyInfo - |> Seq.filter (fun f -> - f.EndsWith("AssemblyInfo.fs") - |> not - ) - |> String.concat " " - |> sprintf "%s --check" - |> dotnet.fantomas +let checkFormatCode ctx = + let result = dotnet.fantomas $"{rootDirectory} --check" if result.ExitCode = 0 then Trace.log "No files need formatting" @@ -690,6 +671,7 @@ let checkFormatCode _ = else Trace.logf "Errors while formatting: %A" result.Errors + let cleanDocsCache _ = DocsTool.cleanDocsCache () let buildDocs ctx = @@ -799,7 +781,7 @@ let initTargets () = "DotnetRestore" - ==> "CheckFormatCode" + =?> ("CheckFormatCode", isCI.Value) ==> "DotnetBuild" ==> "DotnetTest" ==> "DotnetPack" diff --git a/Directory.Build.targets b/Directory.Build.targets new file mode 100644 index 00000000..21da1237 --- /dev/null +++ b/Directory.Build.targets @@ -0,0 +1,26 @@ + + + + + <_BuildProjBaseIntermediateOutputPath>$(MSBuildThisFileDirectory)build/obj/ + <_DotnetToolManifestFile>$(MSBuildThisFileDirectory).config/dotnet-tools.json + <_DotnetToolRestoreOutputFile>$(_BuildProjBaseIntermediateOutputPath)/dotnet-tool-restore-$(NETCoreSdkVersion) + <_DotnetFantomasOutputFile>$(BaseIntermediateOutputPath)dotnet-fantomas-msbuild + + + + + + + + + + + + + + + diff --git a/build.cmd b/build.cmd index 140db8b3..b9f6df44 100644 --- a/build.cmd +++ b/build.cmd @@ -1,4 +1 @@ -echo Restoring dotnet tools... -dotnet tool restore - dotnet run --project ./build/build.fsproj -- -t %* diff --git a/build.sh b/build.sh index 779c670f..4b76f931 100755 --- a/build.sh +++ b/build.sh @@ -3,7 +3,4 @@ set -eu set -o pipefail -echo "Restoring dotnet tools..." -dotnet tool restore - -FAKE_DETAILED_ERRORS=true dotnet run --project ./build/build.fsproj -- -t "$@" +dotnet run -v:m --project ./build/build.fsproj -- -t "$@" diff --git a/build/FsDocs.fs b/build/FsDocs.fs index 1abdb2e7..09354497 100644 --- a/build/FsDocs.fs +++ b/build/FsDocs.fs @@ -15,71 +15,70 @@ module Fsdocs = /// /// Fsdocs build command parameters and options /// - type BuildCommandParams = - { - /// Input directory of content (default: docs) - Input: string option + type BuildCommandParams = { + /// Input directory of content (default: docs) + Input: string option - /// Project files to build API docs for outputs, defaults to all packable projects - Projects: seq option + /// Project files to build API docs for outputs, defaults to all packable projects + Projects: seq option - /// Output Directory (default output for build and tmp/watch for watch) - Output: string option + /// Output Directory (default output for build and tmp/watch for watch) + Output: string option - /// Disable generation of API docs - NoApiDocs: bool option + /// Disable generation of API docs + NoApiDocs: bool option - /// Evaluate F# fragments in scripts - Eval: bool option + /// Evaluate F# fragments in scripts + Eval: bool option - /// Save images referenced in docs - SaveImages: bool option + /// Save images referenced in docs + SaveImages: bool option - /// Add line numbers - LineNumbers: bool option + /// Add line numbers + LineNumbers: bool option - /// Additional substitution parameters for templates - Parameters: seq option + /// Additional substitution parameters for templates + Parameters: seq option - /// Disable project cracking. - IgnoreProjects: bool option + /// Disable project cracking. + IgnoreProjects: bool option - /// In API doc generation qualify the output by the collection name, e.g. 'reference/FSharp.Core/...' instead of 'reference/...' . - Qualify: bool option + /// In API doc generation qualify the output by the collection name, e.g. 'reference/FSharp.Core/...' instead of 'reference/...' . + Qualify: bool option - /// The tool will also generate documentation for non-public members - NoPublic: bool option + /// The tool will also generate documentation for non-public members + NoPublic: bool option - /// Do not copy default content styles, javascript or use default templates - NoDefaultContent: bool option + /// Do not copy default content styles, javascript or use default templates + NoDefaultContent: bool option - /// Clean the output directory - Clean: bool option + /// Clean the output directory + Clean: bool option - /// Display version information - Version: bool option + /// Display version information + Version: bool option - /// Provide properties to dotnet msbuild, e.g. --properties Configuration=Release Version=3.4 - Properties: string option + /// Provide properties to dotnet msbuild, e.g. --properties Configuration=Release Version=3.4 + Properties: string option - /// Additional arguments passed down as otherflags to the F# compiler when the API is being generated. - /// Note that these arguments are trimmed, this is to overcome a limitation in the command line argument - /// processing. A typical use-case would be to pass an addition assembly reference. - /// Example --fscoptions " -r:MyAssembly.dll" - FscOptions: string option + /// Additional arguments passed down as otherflags to the F# compiler when the API is being generated. + /// Note that these arguments are trimmed, this is to overcome a limitation in the command line argument + /// processing. A typical use-case would be to pass an addition assembly reference. + /// Example --fscoptions " -r:MyAssembly.dll" + FscOptions: string option - /// Fail if docs are missing or can't be generated - Strict: bool option + /// Fail if docs are missing or can't be generated + Strict: bool option - /// Source folder at time of component build (<FsDocsSourceFolder>) - SourceFolder: string option + /// Source folder at time of component build (<FsDocsSourceFolder>) + SourceFolder: string option - /// Source repository for github links (<FsDocsSourceRepository>) - SourceRepository: string option + /// Source repository for github links (<FsDocsSourceRepository>) + SourceRepository: string option - /// Assume comments in F# code are markdown (<UsesMarkdownComments>) - MdComments: bool option - } + /// Assume comments in F# code are markdown (<UsesMarkdownComments>) + MdComments: bool option + } with /// Parameter default values. static member Default = { @@ -108,23 +107,22 @@ module Fsdocs = /// /// Fsdocs watch command parameters and options /// - type WatchCommandParams = - { - /// Do not serve content when watching. - NoServer: bool option + type WatchCommandParams = { + /// Do not serve content when watching. + NoServer: bool option - /// Do not launch a browser window. - NoLaunch: bool option + /// Do not launch a browser window. + NoLaunch: bool option - /// URL extension to launch http://localhost:/%s. - Open: string option + /// URL extension to launch http://localhost:/%s. + Open: string option - /// Port to serve content for http://localhost serving. - Port: int option + /// Port to serve content for http://localhost serving. + Port: int option - /// Build Commands - BuildCommandParams: BuildCommandParams option - } + /// Build Commands + BuildCommandParams: BuildCommandParams option + } with /// Parameter default values. static member Default = { diff --git a/build/build.fs b/build/build.fs index f0dedc71..6698b2a4 100644 --- a/build/build.fs +++ b/build/build.fs @@ -465,32 +465,13 @@ let githubRelease _ = |> Async.RunSynchronously let formatCode _ = - let result = - [ testsCodeGlob ] - |> Seq.collect id - // Ignore AssemblyInfo - |> Seq.filter (fun f -> - f.EndsWith("AssemblyInfo.fs") - |> not - ) - |> String.concat " " - |> dotnet.fantomas + let result = dotnet.fantomas $"{rootDirectory}" if not result.OK then printfn "Errors while formatting all files: %A" result.Messages -let checkFormatCode _ = - let result = - [ testsCodeGlob ] - |> Seq.collect id - // Ignore AssemblyInfo - |> Seq.filter (fun f -> - f.EndsWith("AssemblyInfo.fs") - |> not - ) - |> String.concat " " - |> sprintf "%s --check" - |> dotnet.fantomas +let checkFormatCode ctx = + let result = dotnet.fantomas $"{rootDirectory} --check" if result.ExitCode = 0 then Trace.log "No files need formatting" @@ -499,6 +480,7 @@ let checkFormatCode _ = else Trace.logf "Errors while formatting: %A" result.Errors + let cleanDocsCache _ = DocsTool.cleanDocsCache () let buildDocs ctx = @@ -586,7 +568,7 @@ let initTargets () = ==>! "Release" "DotnetRestore" - ==> "CheckFormatCode" + =?> ("CheckFormatCode", isCI.Value) ==> "DotnetBuild" ==>! "DotnetPack"