Skip to content

feat(generator)!: support multi-assembly component composition#1188

Open
kimpenhaus wants to merge 6 commits into
mainfrom
feature/generator-ref-assemblies-optimizations
Open

feat(generator)!: support multi-assembly component composition#1188
kimpenhaus wants to merge 6 commits into
mainfrom
feature/generator-ref-assemblies-optimizations

Conversation

@kimpenhaus

@kimpenhaus kimpenhaus commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

Enable controllers and finalizers from referenced class libraries to be registered automatically.

  • Discover generated registrations across transitive assembly references.
  • Register each assembly’s own components exactly once.
  • Add the opt-in KubeOpsGeneratorNamespace MSBuild property to prevent generated-name conflicts.
  • Add warning KOG002 for conflicting registration class names.
  • Generate registration and definition classes only when required.
  • Generate RegisterComponents when the project references KubeOps.Operator or contains referenced components.
  • Deduplicate partial component declarations independently of source location.
  • Package the generator only under analyzers/dotnet/cs; remove the redundant lib/netstandard2.0 asset.
  • Update generator, migration, and troubleshooting documentation.

Breaking changes

OperatorBuilderExtensions.RegisterComponents and EntityInitializer.Initialize are now generated as internal.

Code that calls these generated extensions from another assembly will no longer compile. Reference KubeOps.Generator in the calling project so it generates its own extensions.

The generator assembly is no longer available through lib/netstandard2.0. Consumers must load it through the standard analyzer asset provided by the NuGet package.

…es and improved deduplication

- Added support for namespace configuration via the `KubeOpsGeneratorNamespace` MSBuild property to avoid name conflicts in multi-assembly scenarios.
- Improved deduplication by grouping registrations (controllers, finalizers) while ignoring location information.
- Introduced additional file tracking for analyzer releases and warnings for conflicting registration class names.
- Updated test cases to align with these changes.
- Removed unnecessary XML documentation from `GeneratorSyntaxExtensions`.
- Deleted unused `AnalyzerReleases.Shipped.md` and `AnalyzerReleases.Unshipped.md` entries from the project file to reduce clutter.
… operator reference

- Updated `OperatorBuilderGenerator` to skip generating `RegisterComponents` when no components are present or `KubeOps.Operator` is not referenced.
- Improved logic to ensure empty aggregations are only generated if necessary.
- Revised associated test cases to validate the new conditional behavior.
- Updated migration documentation to reflect changes in `RegisterComponents` generation logic.
- Updated `EntityDefinitionGenerator` to exclude entities from referenced assemblies in generated metadata.
- Added tests to verify definitions are only generated for locally declared entities.
- Revised README and migration documentation to clarify changes in entity metadata generation logic.
@kimpenhaus kimpenhaus changed the title feat(generator): enhance source generation with multi-assembly composition feat(generator)!: support multi-assembly component composition Jul 10, 2026
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.

1 participant