Skip to content

feat(mediator): automate gRPC proto export during build - #793

Merged
AndreaCuneo merged 5 commits into
masterfrom
copilot/continue-mediator-framework-tasks
Jul 25, 2026
Merged

feat(mediator): automate gRPC proto export during build#793
AndreaCuneo merged 5 commits into
masterfrom
copilot/continue-mediator-framework-tasks

Conversation

Copilot AI commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Proto export previously launched the hosting application and required ArkProtoExport.TryHandle(args) entry-point plumbing. This could trigger startup side effects and produced output for projects without generated gRPC services.

  • Build-time exporter

    • Added isolated net8/net10 runner that loads the target assembly without invoking its entry point.
    • Exports generated service protos and shared ark/* assets.
    • Validates relative output paths and prevents traversal.
  • MSBuild integration

    • Replaced host execution with package-owned runner invocation after Build.
    • Preserved ArkExportProtoDir, ArkExportProto=false, and @(ArkAdditionalProto).
    • No-op when no generated gRPC services exist.
    • Supports net8 and net10 consumers.
<PropertyGroup>
  <ArkExportProtoDir>$(MSBuildProjectDirectory)/proto</ArkExportProtoDir>
  <!-- Optional -->
  <ArkExportProto>false</ArkExportProto>
</PropertyGroup>
  • Sample and documentation
    • Removed entry-point interception from the sample.
    • Documented automatic export, destination overrides, opt-out, and additional proto files.

Copilot AI and others added 4 commits July 25, 2026 13:39
Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>
Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>
Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>
Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot July 25, 2026 14:09
@AndreaCuneo
AndreaCuneo marked this pull request as ready for review July 25, 2026 14:10
@AndreaCuneo
AndreaCuneo requested a review from a team as a code owner July 25, 2026 14:10
Copilot AI review requested due to automatic review settings July 25, 2026 14:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Automates gRPC .proto export at build time for MediatorFramework gRPC consumers by invoking a package-owned runner that loads the built assembly (without running the host entry point), then exports generated service protos plus shared ark/* assets.

Changes:

  • Added a new Ark.Tools.MediatorFramework.Grpc.Export console runner (net8/net10) that performs proto export via assembly load + safe-path validation.
  • Updated buildTransitive MSBuild targets/props to run the exporter after Build, add ArkExportProto opt-out, and gate ArkAdditionalProto copying on an export marker.
  • Removed the runtime ArkProtoExport.TryHandle(args) entry-point plumbing from the sample, and updated docs/task status.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/mediator-framework/Ark.Tools.MediatorFramework.Grpc/buildTransitive/Ark.Tools.MediatorFramework.Grpc.targets Switch export to package-owned runner and gate additional proto copy via marker file
src/mediator-framework/Ark.Tools.MediatorFramework.Grpc/buildTransitive/Ark.Tools.MediatorFramework.Grpc.props Default ArkExportProto/ArkExportProtoDir for consumers
src/mediator-framework/Ark.Tools.MediatorFramework.Grpc/ArkProtoExport.cs Removed runtime entry-point export helper
src/mediator-framework/Ark.Tools.MediatorFramework.Grpc/Ark.Tools.MediatorFramework.Grpc.csproj Reference/pack the exporter runner into the NuGet package
src/mediator-framework/Ark.Tools.MediatorFramework.Grpc.Export/Program.cs Implement build-time export runner (load assembly, export generated/shared assets safely)
src/mediator-framework/Ark.Tools.MediatorFramework.Grpc.Export/packages.lock.json Lock dependencies for exporter project (CI locked restore compatibility)
src/mediator-framework/Ark.Tools.MediatorFramework.Grpc.Export/Ark.Tools.MediatorFramework.Grpc.Export.csproj New runner project definition (net8/net10 exe)
samples/Ark.MediatorFramework.Sample/src/Ark.MediatorFramework.Sample.WebInterface/Program.cs Remove ArkProtoExport.TryHandle(args) interception
samples/Ark.MediatorFramework.Sample/README.md Document automatic export, override/opt-out, and additional proto behavior
docs/mediator-framework/tasks/README.md Mark GEN-07 complete
docs/mediator-framework/design.md Update design docs to reflect build-time runner export model
Ark.Tools.slnx Add exporter project to solution
Comments suppressed due to low confidence (1)

src/mediator-framework/Ark.Tools.MediatorFramework.Grpc/Ark.Tools.MediatorFramework.Grpc.csproj:70

  • Same as the net10 runner artifacts above: add Exists(...) guards for the net8 runner files so dotnet pack doesn’t fail if only one TFM was built (or outputs are cleaned).
      <None Include="$(MSBuildThisFileDirectory)..\Ark.Tools.MediatorFramework.Grpc.Export\bin\$(Configuration)\net8.0\Ark.Tools.MediatorFramework.Grpc.Export.dll"
            Pack="true" PackagePath="tools/net8.0" Visible="false" />
      <None Include="$(MSBuildThisFileDirectory)..\Ark.Tools.MediatorFramework.Grpc.Export\bin\$(Configuration)\net8.0\Ark.Tools.MediatorFramework.Grpc.Export.runtimeconfig.json"
            Pack="true" PackagePath="tools/net8.0" Visible="false" />
      <None Include="$(MSBuildThisFileDirectory)..\Ark.Tools.MediatorFramework.Grpc.Export\bin\$(Configuration)\net8.0\Ark.Tools.MediatorFramework.Grpc.Export.deps.json"
            Pack="true" PackagePath="tools/net8.0" Visible="false" />

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot July 25, 2026 14:20
Copilot AI requested a review from AndreaCuneo July 25, 2026 14:21
@AndreaCuneo
AndreaCuneo merged commit aa9031f into master Jul 25, 2026
7 checks passed
@AndreaCuneo
AndreaCuneo deleted the copilot/continue-mediator-framework-tasks branch July 25, 2026 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants