ww output: match Go exact -o parsing

This commit is contained in:
2026-08-22 01:59:02 +09:00
parent 4b9968e4e6
commit d61805262e
7 changed files with 701 additions and 36 deletions

View File

@@ -344,7 +344,19 @@ ImportPath = ident { "." ident } .
arguments and result; this rule does not adopt Go's source signature. An
ordinary import of a package declared `main` is rejected, except for the
toolchain's colocated external-test wiring.
- For `ww build`, an explicit `-o` names an output directory when ordinary
- For `ww build`, the output-option name is exactly `o`. The accepted forms are
`-o VALUE`, `--o VALUE`, `-o=VALUE`, and `--o=VALUE`. An equals form splits
at its first `=` and preserves every later byte, including further `=`
characters; an empty value is valid. Repetition is last-value-wins, and a
final empty value means that there is no effective explicit output, so the
ordinary default-output or no-public-output rule applies. A concatenated
spelling such as `-oVALUE` or `--oVALUE` is an unknown flag, not an output
option. Build option parsing stops at the first package or source operand;
later flag-like arguments remain operands and are not reparsed as `-o`.
These spelling and placement rules select only caller-visible output
disposition and never supply package, import, graph, action, symbol,
artifact, `.wwi`, or persistence identity.
A nonempty effective `-o` names an output directory when ordinary
`stat` reports an existing directory (following symlinks) or its spelling
ends in `/`. This classification is independent of whether one or many
package roots were requested. Each selected command is published beneath
@@ -771,11 +783,22 @@ coordinator reports that successful validation exactly as
`? <package> [no test files]\n`.
Every test-bearing directory product links one request-private runnable.
`-c` retains an executable copy and suppresses its execution; `-o` retains a
copy at the named destination and still executes unless `-c` is present. With
no explicit output, `-c` writes `<import-leaf>.test` in the invocation
directory. An output ending in `/` or naming an existing directory receives
that basename and may have missing parent directories created. One
The test output-option name is exactly `o`, with the accepted forms `-o VALUE`,
`--o VALUE`, `-o=VALUE`, and `--o=VALUE`. Equals forms split only at their
first `=` and preserve an empty value or any additional `=` bytes. Repeated
occurrences are last-value-wins. A final empty value means no effective
explicit output and therefore requests no running-test retention; with `-c`,
the ordinary default retained name applies. A concatenated `-oVALUE` or
`--oVALUE` is unknown. Unlike build option parsing, known test options,
including these exact output forms, are recognized before or after package
operands. Invalid output-option names reject before package loading, product
construction, execution, or publication.
`-c` retains an executable copy and suppresses its execution; a nonempty
effective `-o` retains a copy at the named destination and still executes
unless `-c` is present. With no effective explicit output, `-c` writes
`<import-leaf>.test` in the invocation directory. An output ending in `/` or
naming an existing directory receives that basename and may have missing
parent directories created. One
non-directory output may name only one package. Multiple packages whose
visible import leaves would produce the same test-binary name reject before
tools or output creation; exact `/dev/null` is the discard exception. It keeps