build: route .ww directories as packages

This commit is contained in:
2026-08-22 23:39:06 +09:00
parent 2e5451a601
commit ca0e533c13
5 changed files with 683 additions and 30 deletions

View File

@@ -358,6 +358,22 @@ ImportPath = ident { "." ident } .
symbol, `.wwi`, publication, or persistence identity. Build workdir format
remains 18, test workdir format remains 19, and semantic storage format
remains 3.
- A local literal passed to `ww build` whose requested final basename ends
`.ww` remains a directory request when ordinary `stat` reports a directory,
including when the spelling is a symlink or ends `_test.ww`. The directory
target therefore bypasses raw named-source prefix and test-source
classification and enters ordinary directory enumeration. Actual eligible
production entries, package declarations, imports, graph actions, producers,
output policy, publication, persistence, invalidation, rollback, and cleanup
are exactly those of the existing directory package route. The requested
spelling and physical target are loader/presentation metadata only and create
no new package, dotted-import, graph, action, symbol, artifact, `.wwi`,
publication, or persistence identity. Raw `ww test`, `ww test -c`, and
`ww test -S` already use the same directory classification and are unchanged.
`ww run` retains its separate named-operand front door. Multiple operands,
recursive and logical requests, regular and non-regular source targets, and
dangling symlinks are not changed. Build workdir format remains 18, test
workdir format remains 19, and semantic storage format remains 3.
- `import acme.codec;` loads the canonical package `acme.codec`. If that
package declares `package wire;`, the importing file sees its exported names
as `wire.Name`; `codec.Name` is not an additional binding. An explicit alias
@@ -465,14 +481,24 @@ ImportPath = ident { "." ident } .
the action list; non-main command dependencies retain ordinary actions, and
a selection containing no command rejects before tools or output creation.
A raw command-line `.ww` source uses its source basename without `.ww`, and
a raw non-main source is the same no-command rejection. Missing
trailing-slash hierarchies are created transactionally from `0777`, filtered
by the caller's umask.
a raw non-main source is the same no-command rejection. An existing
directory whose requested basename ends `.ww` is not such a raw source: it
retains directory-package output naming. With no `-o`, its requested leaf
is used verbatim (for example, `directory_test.ww`); with an existing
output-directory `-o`, publication instead uses the canonical selected
target leaf (for example, `directory-target`).
Missing trailing-slash hierarchies are created transactionally from `0777`,
filtered by the caller's umask.
Loading and package/import diagnostics precede no-main, derived-path,
duplicate-destination, implicit-default, and other output preflight; all of
those checks precede creation. Producer failure or interruption preserves
existing directory contents and removes only request-created prefixes and
stages. A non-directory output retains the single-product file/archive rule.
those checks precede creation. Producer failure and coordinator-owned
interruption preserve existing directory contents and remove only
request-created prefixes and stages. Direct external `SIGTERM` of a build
driver is a verified-open exception: both stages preserve public and
committed work bytes and reap their process group, but may leave `.new`
staging files that make a later persistent-work request reject until those
files are removed. A non-directory output retains the single-product
file/archive rule.
If a lone
command's synthesized default basename already names a directory, loading
and graph validation complete and the build rejects before tools without