Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ partial class Build : NukeBuild
DotNet("run --framework net9.0 -- describe --file description.txt", Solution.TestHarnesses.CommandLineRunner.Directory);
DotNet("run --framework net9.0 -- describe --environment Testing --applicationName Different --contentRoot /bin", Solution.TestHarnesses.CommandLineRunner.Directory);
DotNet("run --framework net9.0 -- describe --environment=Testing --applicationName=Different --contentRoot=/bin", Solution.TestHarnesses.CommandLineRunner.Directory);
DotNet("run --framework net9.0 -- codegen preview --start", Solution.TestHarnesses.CommandLineRunner.Directory);
});

AbsolutePath ArtifactsDirectory => RootDirectory / "artifacts";
Expand Down
11 changes: 10 additions & 1 deletion src/JasperFx/CodeGeneration/Commands/GenerateCodeCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,18 @@ public GenerateCodeCommand()
public override bool Execute(GenerateCodeInput input)
{
DynamicCodeBuilder.WithinCodegenCommand = true;

using var host = input.BuildHost();

// When using the old ASP.NET Core Startup.Configure() pattern,
// code generation participants (like Wolverine.Http endpoints) are
// registered during host startup, not during Build(). Starting the
// host ensures Configure() runs and all participants are discovered.
if (input.StartFlag)
{
host.StartAsync().GetAwaiter().GetResult();
}

var collections = host.Services.GetServices<ICodeFileCollection>().ToArray();
if (!collections.Any())
{
Expand Down
3 changes: 3 additions & 0 deletions src/JasperFx/CodeGeneration/Commands/GenerateCodeInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ public class GenerateCodeInput : NetCoreInput

[Description("Optionally limit the preview to only one type of code generation")]
public string? TypeFlag { get; set; }

[Description("Start the IHost instead of just building it. Use this when code generation participants are registered during host startup (e.g., ASP.NET Core Startup.Configure)")]
public bool StartFlag { get; set; }
}
2 changes: 1 addition & 1 deletion src/JasperFx/JasperFx.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Description>Foundational helpers and command line support used by JasperFx and the Critter Stack projects</Description>
<AssemblyName>JasperFx</AssemblyName>
<PackageId>JasperFx</PackageId>
<Version>1.21.5</Version>
<Version>1.21.6</Version>
</PropertyGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
Expand Down
Loading