helidon-io / helidon-build-tools

Build tools for the Helidon Project
https://helidon.io
Apache License 2.0
35 stars 35 forks source link

Archetype - popped global scopes are incorrectly resolved #1069

Open romain-grecourt opened 1 month ago

romain-grecourt commented 1 month ago

Problem

Popped global scopes are incorrectly resolved.

Because strict parenting is enforced when pushing scope, a previously popped global scope cannot be resolved otherwise it may result into errors if it is pushed from a different path.

E.g.

push flavor global=true
push app-type global=true
push media global=false
pop media
pop app-type
push media global=false

The last push fails because flavor.app-type.media is resolved instead of creating flavor.media and flavor.app-type.media is not a direct child of flavor.

Fix

We need to update Context.popScope to clear the edge and merge the values in the parent scope.

Compatibility

If this issue impacts older releases of the engine, we will need to start processing the archetypes at build time to produce compatibles scripts.