From 334894f73a671420880d39194d7a47b0879575d4 Mon Sep 17 00:00:00 2001 From: Romfos Date: Wed, 4 Dec 2024 13:49:05 +0100 Subject: [PATCH] Cleanup build project --- build/build.fs | 78 ++++++++++++++++------------------------------ build/build.fsproj | 1 - 2 files changed, 27 insertions(+), 52 deletions(-) diff --git a/build/build.fs b/build/build.fs index 3a819ba0..576a116b 100644 --- a/build/build.fs +++ b/build/build.fs @@ -8,9 +8,6 @@ open Fake.IO.FileSystemOperators open ExtractDocs -let target = Target.create -let description = Target.description - module FileReaderWriter = let Read file = File.ReadAllText(file) let Write file (text: string) = File.WriteAllText(file, text) @@ -36,60 +33,39 @@ module ExamplesToCode = for file in files do ConvertFile file targetDir -type BuildVersion = { assembly: string; file: string; info: string; package: string } let root = __SOURCE_DIRECTORY__ ".." |> Path.getFullName let configuration = Environment.environVarOrDefault "configuration" "Debug" let output = root "bin" configuration -let solution = (root "NSubstitute.sln") - -let initTargets() = - Target.description("Extract, build and test code from documentation.") - Target.create "TestCodeFromDocs" <| fun _ -> - let outputCodePath = output "CodeFromDocs" - Directory.create outputCodePath - // generate samples from docs - ExamplesToCode.Convert [ root "docs/"; root "docs/docs"; root ] outputCodePath - // compile code samples - let csproj = """ - - - net8.0;net462 - latest - - - - - - - - - - - """ - let projPath = outputCodePath "Docs.csproj" - FileReaderWriter.Write projPath csproj - DotNet.restore (fun p -> p) projPath - DotNet.build (fun p -> p) projPath - DotNet.test (fun p -> p) projPath - - Target.description("List targets, similar to `rake -T`. For more details, run `--listTargets` instead.") - Target.create "-T" <| fun _ -> - printfn "Optional config options:" - printfn " configuration=Debug|Release" - printfn " benchmark=*| (only for Benchmarks target in Release mode)" - printfn "" - Target.listAvailable() [] let main argv = - argv - |> Array.toList - |> Context.FakeExecutionContext.Create false "build.fsx" - |> Context.RuntimeContext.Fake - |> Context.setExecutionContext - initTargets() - Target.runOrDefaultWithArguments "TestCodeFromDocs" - 0 \ No newline at end of file + let outputCodePath = output "CodeFromDocs" + Directory.create outputCodePath + // generate samples from docs + ExamplesToCode.Convert [ root "docs/"; root "docs/docs"; root ] outputCodePath + // compile code samples + let csproj = """ + + + net8.0;net462 + latest + + + + + + + + + + + """ + let projPath = outputCodePath "Docs.csproj" + FileReaderWriter.Write projPath csproj + DotNet.restore (fun p -> p) projPath + DotNet.build (fun p -> p) projPath + DotNet.test (fun p -> p) projPath + 0 \ No newline at end of file diff --git a/build/build.fsproj b/build/build.fsproj index abb45da8..fe9b89c2 100644 --- a/build/build.fsproj +++ b/build/build.fsproj @@ -16,7 +16,6 @@ -