From f0c8245e8f94023f37f9e64b5b440b3faeaecf0f Mon Sep 17 00:00:00 2001 From: Ed Ball Date: Wed, 3 Jul 2024 13:33:33 -0700 Subject: [PATCH] Fix build. Add .NET 8. --- src/fsdgenswagger/fsdgenswagger.csproj | 2 +- ...Facility.Definition.Swagger.UnitTests.csproj | 2 +- tools/Build/Build.cs | 17 +++++++++-------- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/fsdgenswagger/fsdgenswagger.csproj b/src/fsdgenswagger/fsdgenswagger.csproj index 6bb24f7..1c3fd12 100644 --- a/src/fsdgenswagger/fsdgenswagger.csproj +++ b/src/fsdgenswagger/fsdgenswagger.csproj @@ -2,7 +2,7 @@ Exe - net6.0;net7.0 + net6.0;net7.0;net8.0 A tool that converts OpenAPI 2.0 (Swagger) to/from a Facility Service Definition. Facility FSD Swagger OpenAPI CodeGen true diff --git a/tests/Facility.Definition.Swagger.UnitTests/Facility.Definition.Swagger.UnitTests.csproj b/tests/Facility.Definition.Swagger.UnitTests/Facility.Definition.Swagger.UnitTests.csproj index 782c0ca..ee48807 100644 --- a/tests/Facility.Definition.Swagger.UnitTests/Facility.Definition.Swagger.UnitTests.csproj +++ b/tests/Facility.Definition.Swagger.UnitTests/Facility.Definition.Swagger.UnitTests.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 diff --git a/tools/Build/Build.cs b/tools/Build/Build.cs index da162df..552de88 100644 --- a/tools/Build/Build.cs +++ b/tools/Build/Build.cs @@ -39,21 +39,22 @@ void CodeGen(bool verify) { var configuration = dotNetBuildSettings.GetConfiguration(); - var toolPath = FindFiles($"src/{codegen}/bin/{configuration}/net6.0/{codegen}.dll").FirstOrDefault() ?? throw new BuildException($"Missing {codegen}.dll."); - var verifyOption = verify ? "--verify" : null; - RunDotNet(toolPath, "example/ExampleApi.fsd", "example/output/swagger", "--json", "--newline", "lf", verifyOption); - RunDotNet(toolPath, "example/ExampleApi.fsd", "example/output/swagger", "--newline", "lf", verifyOption); - RunDotNet(toolPath, "example/output/swagger/ExampleApi.json", "example/output/swagger/fsd", "--fsd", "--newline", "lf", verifyOption); + RunCodeGen("example/ExampleApi.fsd", "example/output/swagger", "--json"); + RunCodeGen("example/ExampleApi.fsd", "example/output/swagger"); + RunCodeGen("example/output/swagger/ExampleApi.json", "example/output/swagger/fsd", "--fsd"); if (verify) - RunDotNet(toolPath, "example/output/swagger/ExampleApi.yaml", "example/output/swagger/fsd", "--fsd", "--newline", "lf", verifyOption); + RunCodeGen("example/output/swagger/ExampleApi.yaml", "example/output/swagger/fsd", "--fsd"); foreach (var yamlPath in FindFiles("example/*.yaml")) - RunDotNet(toolPath, yamlPath, "example/output/fsd", "--fsd", "--newline", "lf", verifyOption); + RunCodeGen(yamlPath, "example/output/fsd", "--fsd"); Directory.CreateDirectory("example/output/fsd/swagger"); foreach (var fsdPath in FindFiles("example/output/fsd/*.fsd")) - RunDotNet(toolPath, fsdPath, $"example/output/fsd/swagger/{Path.GetFileNameWithoutExtension(fsdPath)}.yaml", "--newline", "lf", verifyOption); + RunCodeGen(fsdPath, $"example/output/fsd/swagger/{Path.GetFileNameWithoutExtension(fsdPath)}.yaml"); + + void RunCodeGen(params string?[] args) => + RunDotNet(new[] { "run", "--no-build", "--project", $"src/{codegen}", "-f", "net6.0", "-c", configuration, "--", "--newline", "lf", verifyOption }.Concat(args)); } });