Repository navigation
test(maven): 模型回归隔离本机 Maven 设置(#36) - #43
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #36
根因
scripts/test.mjs的主模型和扩展 Boot 模型使用run()调 Maven,却未显式指定-gs、-s;本机~/.m2/settings.xml若含额外 profile,model.optionValues.profiles就会多出用户配置,导致原有["ci", "release"]断言失败。readProfileModel原来已有隔离设置,行为不一致。此外,prepareRuns、verifyExtendedBootAndProvided通过lithe-maven-provider.jar启动的 Maven 进程,以及scripts/compiler/test.mjs中的 Maven 调用也会受到MAVEN_ARGS和本机~/.m2/settings.xml影响。修复
run()调用通过modelSettings()指定全局和用户设置;覆盖主模型、依赖、扩展模型和测试命令。readProfileModel复用 helper,保留测试指定的settings.xml覆盖值。prepareRuns与verifyExtendedBootAndProvided启动BackendClient时清除MAVEN_ARGS,并在lithe/build/prepareRun的optionArguments中传入modelSettings(),隔离 provider 内部拉起的 Maven 进程。scripts/compiler/test.mjs的 Mavenmodel()与compile调用同样使用空设置文件并清除MAVEN_ARGS。MAVEN_ARGS,防止环境参数污染。settings.xml检查作为回归断言。本地验证(macOS arm64, JDK 17.0.18, Apache Maven 3.9.14, Node v24.14.0)
node scripts/test-process.mjs— 9/9 通过node scripts/package.mjs— 通过,打包dist/maven-build-1.0.3-{darwin,linux,windows}.zipMAVEN_ARGS="--invalid-flag-from-env" node scripts/test.mjs— 全部通过(验证环境变量污染被完全隔离)node --test --test-timeout=15000 scripts/compiler/process.test.mjs— 2 通过, 1 Windows 专用跳过(macOS 预期)MAVEN_ARGS="--invalid-flag-from-env" node scripts/compiler/test.mjs— 5/5 通过node --test --test-timeout=60000 scripts/package/*.test.mjs— 3/3 通过