Skip to content

Conversation

@romain-grecourt
Copy link
Contributor

@romain-grecourt romain-grecourt commented Aug 19, 2025

Archetype Engine V2 Updates

Fixes #1069
Fixes #1105

Reworked XML module (common/xml)

  • io.helidon.build.xml.XMLParser as an iterator (tokenizer style)
  • Added io.helidon.build.xml.XMLReader
  • Updated io.helidon.build.xml.XMLElement (improved API, read-only / read-write)
  • Renamed io.helidon.build.xml.XMLWriter to io.helidon.build.xml.XMLGenerator
  • Implemented pretty XML with idented nesting and multi-line attributes
  • Updated all usages
  • Added unit tests

Archetype Engine Refactoring

  • Re-wrote XML reader to be based on the new XML API
  • Removed all AST types in favor of a generic tree style
  • Added io.helidon.build.archetype.engine.v2.Node (the new simplified API for the tree)
  • Added io.helidon.build.archetype.engine.v2.Value to represent the type system with an API similar to java.util.Optional
  • Simplified traversal logic
  • Consolidated io.helidon.build.archetype.engine.v2.InputResolver
  • Consolidated io.helidon.build.archetype.engine.v2.Generator
  • Consolidated io.helidon.build.archetype.engine.v2.Context

Overall there are less moving parts, fewer classes although bigger.

ScriptCompiler

Build time processing ("compiling") of the archetype scripts to produce canonical archetypes compatible with the Helidon CLI v3.0.6.

Expression

  • Updated io.helidon.build.archetype.engine.v2.Expression significantly to support the pseudo compiler
  • Expression reduction (Quine–McCluskey)
  • Expression substitutions
  • Expression printing, to update the expressions in the generated files
  • Alternative symbols for operators (E.g. 'OR' 'AND' to avoid XML encoding)
  • New Operators (only usable outside of archetype scripts)

Input Flattening

  • Flatten all discrete steps (I.e. global steps or effectively global steps) at the top level and only nest inputs that use a dot notation.
  • Stub variables to workaround the eagger variable resolution of expression
  • Consolidated the input variations mechanism (better implementation, improved tracability, improved filters)
  • Added many tests to cover more of the expected behavior

Script Reader/Writer

  • Reworked the reader and writer mechanisms
  • Added io.helidon.build.archetype.engine.v2.XMLScriptReader
  • Added io.helidon.build.archetype.engine.v2.XMLScriptWriter
  • Added io.helidon.build.archetype.engine.v2.json.JsonScriptWriter

Misc

  • Added a Checksum (MD5) utility in the common module
  • Archetype V2 schema fixes
  • Renamed "Permutations" to "Variations"
  • Pin-down common Maven plugin versions in helidon-archetype-maven-plugin it tests
  • Derive artifactId from archetype in ArchetypeEngineV2
  • Replace .mustache file extensions with .hbs
  • Improved CLI functional tests (cli/tests/functional)

@romain-grecourt romain-grecourt added this to the 4.0.21 milestone Aug 19, 2025
@romain-grecourt romain-grecourt self-assigned this Aug 19, 2025
@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Aug 19, 2025
@romain-grecourt romain-grecourt merged commit 525335f into helidon-io:master Aug 19, 2025
24 checks passed
@romain-grecourt romain-grecourt deleted the archetype-engine-compiler branch August 19, 2025 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4.x archetype OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Archetype Engine Compiler/Transpiler to support 3.0.6 Archetype - popped global scopes are incorrectly resolved

2 participants