-
Notifications
You must be signed in to change notification settings - Fork 1
Refactor module layout to use immutable name maps #493
Copy link
Copy link
Open
Labels
architectureArchitecture, module boundaries, or dependency directionArchitecture, module boundaries, or dependency directionquality-codeGenerated by Hermes Quality Code for small architecture refactorsGenerated by Hermes Quality Code for small architecture refactorsrefactorCode change that preserves behavior while improving structureCode change that preserves behavior while improving structure
Description
Activity
Metadata
Metadata
Assignees
Labels
architectureArchitecture, module boundaries, or dependency directionArchitecture, module boundaries, or dependency directionquality-codeGenerated by Hermes Quality Code for small architecture refactorsGenerated by Hermes Quality Code for small architecture refactorsrefactorCode change that preserves behavior while improving structureCode change that preserves behavior while improving structure
Problem
GeneratedModuleLayout directly reads mutable global NameMappings, while ProjectNameMappingFactory already produces immutable ProjectNameMaps and ProjectWriter receives those maps explicitly.
Why This Matters
Generation and tests depend on process-wide mutable state, which can leak between runs, complicate parallel execution, and make layout behavior harder to test with custom mappings.
Proposed Change
Thread ProjectNameMaps through the module-writing boundary and have GeneratedModuleLayout use the supplied maps instead of importing NameMappings. Preserve existing fallback names and generated paths.
Files
project-generator/src/main/kotlin/io/github/cdsap/projectgenerator/generator/GeneratedModuleLayout.ktproject-generator/src/main/kotlin/io/github/cdsap/projectgenerator/writer/ModulesWriter.ktproject-generator/src/main/kotlin/io/github/cdsap/projectgenerator/writer/ProjectWriter.ktproject-generator/src/main/kotlin/io/github/cdsap/projectgenerator/ProjectGenerator.ktConstraints
Acceptance Criteria
Validation
./gradlew :project-generator:unitTest./gradlew :cli:test./gradlew ktlintCheckNotes
ProjectNameMaps becomes the domain value passed through the generation boundary, while NameMappings remains isolated as legacy compatibility state during this incremental step.