Skip to content

codegen: extract codegen-core + codegen-roaster modules (phase 1) - #368

Open
igel-devin-ai wants to merge 29 commits into
java-helpers:mainfrom
igel-devin-ai:devin/1792742307-simple-codegen-moves
Open

igel-devin-ai wants to merge 29 commits into
java-helpers:mainfrom
igel-devin-ai:devin/1792742307-simple-codegen-moves

Conversation

@igel-devin-ai

@igel-devin-ai igel-devin-ai commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Phase 1 of the codegen extraction (#233): the decoupled generic layer moves out of processor into two new Maven artifacts, preserving git history via renames.

New modules

  • io.github.java-helpers.codegen:codegen-core — framework-agnostic processing/codegen layer, package root org.javahelpers.codegen:
    • codegen — the SPI (ClassCodeGenerator, SourceFormatter, GenerationEnvironment, GenerationIssueReporter, GenerationPhases, CodeGenerationException)
    • codegen.processing — AnnotationProcessingContext, AnnotationProcessingOptions, CompilerOption
    • codegen.analysis — JavaLangAnalyser, JavaLangMapper, TypeMappingContext, TypeNameAnalyser, FieldAnnotationExtractor, GeneratedTypes
    • codegen.model — the shared generation model (TypeName family, DTOs, imports, javadoc, PackageScopes, …)
    • codegen.logging — ProcessingLogger, PerformanceTracker/Active/NoOp, PhaseHierarchy
    • codegen.util — ImportCollector
    • codegen.enums — mirrors of AccessModifier/OptionState/FormattingMode (see below)
  • io.github.java-helpers.codegen:codegen-roaster — the Roaster backend (codegen.roaster: RoasterCodeGenerator, RoasterMapper, RoasterSourceFormatter, RoasterMapperException)

Dependency direction is strictly processor → codegen-roaster → codegen-core: codegen links to nothing in simple-builders (opposite direction comes later). To cut the simple-builders-core link, the three enums the model/config types carry are mirrored into codegen.enums; OptionValueParsers was already the string→enum boundary, so annotation/compiler-arg values now land directly as codegen types. core references remain only where processor code names types emitted into generated source (TrackedValue).

Move discipline

One commit per move so git log --follow keeps history: module skeletons → logging → model → classgen SPI/roaster/util → enum mirror → processing generics → analysis → tests → sonar/docs → poms/CI → the org.javahelpers.simple.codegen → org.javahelpers.codegen package/artifact rename (all git mv-tracked). BuilderScopeResolver, OptionValueParsers, the builder model (BuilderFieldDto, BuilderDefinitionDto, BuilderConfiguration, ResolvedBuilder, BuilderMethodDto, …) and all of generators/mapstruct/processing's builder plumbing stay processor-side (per issue body: no backwards dependencies).

Tests / wiring

  • Dependency-free unit tests moved with their classes (TypeNameTest, PackageScopesTest, NoOpPerformanceTrackerTest); tests exercising codegen classes through processor fixtures stay processor-side.
  • META-INF/services unchanged — RoasterCodeGenerator is wired explicitly, the Generator SPI is processor's own.
  • sonar.java.binaries now covers all four modules.

Verification

  • mvn clean install: 509 processor + 19 codegen-core + 32 codegen-roaster + 32 example — all green
  • Regenerated example/generated-example-builder is byte-identical (git status clean after regen against installed artifacts)

Closes #349. Preparatory work for #363 (own repository), #364 (perf-optimized backend), #365 (shaded consumption), #366 (backend priority).

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Dependency Review

The following issues were found:

  • ✅ 0 vulnerable package(s)
  • ❌ 12 package(s) with incompatible licenses
  • ✅ 0 package(s) with invalid SPDX license definitions
  • ⚠️ 8 package(s) with unknown licenses.

View full job summary

@devin-ai-integration
devin-ai-integration Bot force-pushed the devin/1792742307-simple-codegen-moves branch 2 times, most recently from d75412b to bd7f0c9 Compare October 24, 2026 11:18
@igel-devin-ai igel-devin-ai changed the title codegen: extract simple-codegen + simple-codegen-roaster modules (phase 1) codegen: extract codegen-core + codegen-roaster modules (phase 1) Oct 25, 2026
@igel-devin-ai

Copy link
Copy Markdown
Contributor Author

Heads-up on ordering: this move waits for #378 / PR #379 (the generic AbstractCodegenProcessor driver landing inside processor first). After that merges, this branch gets reworked to carry a third artifact — io.github.java-helpers.codegen:annotation-processing — alongside codegen-core and codegen-roaster, split at the javax.lang.model boundary (context/options/analysis + driver on the JSR-269 side; model/enums/SPI javax-free on the other).

Details on issue #349.

@devin-ai-integration
devin-ai-integration Bot force-pushed the devin/1792742307-simple-codegen-moves branch 2 times, most recently from 5ae4941 to 55e3959 Compare November 1, 2026 14:34
…enums so codegen has no simple-builders dependency
…eateFormatterResolver become required hooks; SourceFormatterResolver moves to codegen.roaster behind the FormatterResolver SPI
…sonar config

* processor, example-custom-generator and codegen-roaster get their new module dependencies
* moved sources re-import what stayed behind in the processor domain; text-block test
  snippets keep their simple-builders imports
* formatter profile resources move to codegen-roaster; roaster test moves with its
  package-private access
* ActivePerformanceTrackerTest stays in the processor test tree under its new
  codegen.logging package — codegen-testing cannot come back into simple-processor
  (Maven dep cycle)
* sonar binaries/tests/jacoco paths cover the four new modules
* maven.yml collects classes, test-classes and jacoco reports for the
  four new modules alongside core/processor
* fork-sonar.yml restores them and scans them; coverage exclusions mirror
  the jacoco config (codegen model is the same DTO boilerplate)
* sonar-project.properties and pom sonar.* properties list all modules
SBOM, reproducible-build timestamp and the staging deploy now cover all
deployable modules — publishing processor alone would ship a pom
referencing codegen artifacts that don't exist on Central.
ClassCodeGenerator/SourceFormatter/GenerationIssueReporter/GenerationPhases/
CodeGenerationException/FormatterResolver and the logging contracts
(PerformanceTracker, ActivePerformanceTracker, NoOpPerformanceTracker,
PhaseHierarchy) have no javax.* references — they belong to the SPI that
backends implement, so they drop to codegen-core. GenerationEnvironment and
ProcessingLogger still carry javax types; they split in the next commit.
…vax boundary — javax-free contracts in codegen-core, Messager/annotation-processing impls in simple-processor
…re, simple-processor wires it as the default backend
…utoService/MapStruct/Jackson/compile-testing comments dropped, JaCoCo 'processor module only' reworded
@devin-ai-integration
devin-ai-integration Bot force-pushed the devin/1792742307-simple-codegen-moves branch from 4d0abee to 88c3ff4 Compare November 1, 2026 15:20

This branch has not been deployed

No deployments
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.

Move generic classes into codegen + codegen-roaster modules (phase 1)

1 participant