Skip to content

fix: spell every ${mcpp.*} path token generically (#393) - #801

Open
ZheFeng7110 wants to merge 1 commit into
mcpp-community:mainfrom
ZheFeng7110:fix/393-generic-separator-in-engine-path-tokens
Open

ZheFeng7110 wants to merge 1 commit into
mcpp-community:mainfrom
ZheFeng7110:fix/393-generic-separator-in-engine-path-tokens

Conversation

@ZheFeng7110

Copy link
Copy Markdown
Member

Summary

  • Spell every ${mcpp.*} path token with forward slashes. Five sites in
    src/build/prepare/plan.cpp replaced a path with its native .string()
    while ${mcpp.target_file:} and ${mcpp.artifact:} were already
    .generic_string(), so the one closed vocabulary had two separator
    conventions.
  • A build program that wrote ${mcpp.out_dir}/gen/x.cppm therefore got
    C:\proj\target\…\gen/x.cppm on Windows: one argv token with a native prefix
    beside the author's / (fix: build action 的 ${mcpp.out_dir} 替换把原生拼写拼进用户正斜杠路径,产出混合分隔符 #393). ${mcpp.bin_dir}, ${mcpp.compile_db},
    ${mcpp.self} and ${mcpp.stage_dir} had the same shape.
  • The five sites now use .generic_string(), the spelling escape_ninja_path
    already gives every ninja node name and every tool path (the compiler, ar,
    mcpp itself), so the vocabulary agrees with the rest of the graph. POSIX
    output is byte-identical, so no existing edge changes there.
  • docs/30-build-mcpp.md and docs/zh/30-build-mcpp.md state the rule beside
    the vocabulary table; CHANGELOG.md records it.

Note on the issue's suggested fix: make_preferred on the replacement value is
a no-op here — ctx.plan.outputDir is built with operator/ throughout, so it
is already natively spelled. The mixed token comes from joining a native prefix
with the author's /; generic is what makes the two agree.

Test plan

  • mcpp test with the freshly built binary: 150 passed; 0 failed
  • tests/e2e/188_build_actions.sh with the freshly built MCPP (it drives
    ${mcpp.out_dir}, ${mcpp.bin_dir} and ${mcpp.target_file:} end to end)
  • tests/e2e/660_an_action_names_the_engine_through_mcpp_self.sh with the
    freshly built MCPP; it now also asserts the action rule's argv carries no
    backslash, which the windows-e2e shard this token exists for is what
    exercises (on POSIX the two spellings are equal, so that leg is a no-op)
  • bash .github/tools/check_docs_style.sh

Closes #393.

An action's `${mcpp.out_dir}`, `${mcpp.bin_dir}`, `${mcpp.compile_db}`,
`${mcpp.self}` and `${mcpp.stage_dir}` were replaced with the path's native
spelling, while `${mcpp.target_file:}` and `${mcpp.artifact:}` were already
generic. A build program that wrote `${mcpp.out_dir}/gen/x.cppm` therefore got
`C:\proj\target\...\gen/x.cppm` on Windows: one argv token carrying two
separator conventions.

The five sites use `generic_string()`, the spelling `escape_ninja_path` already
gives every ninja node name and the tool paths (the compiler, `ar`, `mcpp`
itself). POSIX output is byte-identical, so this changes no existing edge west
of Windows.

e2e 660, which runs on the Windows shard the `${mcpp.self}` token exists for,
now asserts the action rule's argv carries no backslash. docs/30 and docs/zh/30
state the rule beside the vocabulary table.

Closes mcpp-community#393.

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.

fix: build action 的 ${mcpp.out_dir} 替换把原生拼写拼进用户正斜杠路径,产出混合分隔符

1 participant