Skip to content

Commit

Permalink
Fix build. Add .NET 8.
Browse files Browse the repository at this point in the history
  • Loading branch information
ejball committed Jul 3, 2024
1 parent 5606146 commit f0c8245
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/fsdgenswagger/fsdgenswagger.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<Description>A tool that converts OpenAPI 2.0 (Swagger) to/from a Facility Service Definition.</Description>
<PackageTags>Facility FSD Swagger OpenAPI CodeGen</PackageTags>
<IsPackable>true</IsPackable>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
17 changes: 9 additions & 8 deletions tools/Build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
});

0 comments on commit f0c8245

Please sign in to comment.