Tests stage their fixtures under fixed names in the temp directory,
fs::temp_directory_path() / "crafter-build-<name>", and two runs at
once staged into the same ones: natively every process shares the
machine's /tmp, and every sandbox of crafter-build's Flatpak shares the
one the app has, whatever checkout it runs in. A test of one run could
find what it had staged removed or written over by the same test of the
other run, which removes the directory as it starts and stages its copy
anew.
RunTests now makes a directory for the run in the temp directory, a
PrivateDirectory, and runs each test with TMPDIR naming <run>/<name>,
so that fs::temp_directory_path() in the test names it and the fixed
names are the run's alone. The second test of one name in a run, as two
configurations or two targets may each have one, gets <name>-2, so that
removing one's directory does not take the other's. RunSingleTest takes
the directory as a new last parameter and puts TMPDIR into the env
prefix of the test's command, beside a Wayland test's WAYLAND_DISPLAY.
env's command is sh, which execs the test's words, as for a Wayland
test's: env takes a word with an '=' in it ahead of its command for an
assignment, a binary's path among them, and with no command left it
printed its environment and exited 0, a pass for a test that never ran.
What a test that passes or skips leaves is removed when it ends. What
one that fails, crashes or times out leaves is kept for a look, its log
says where, as does what is printed of a test that fails or crashes,
and the run's directory then outlives the run, unlocked, for a later
run to remove a minute after, or, where the run was killed, a minute
after its last change to it; PrivateDirectory gains Keep() for that. A
test's logs, build/test-logs/<name>.log and <name>.compositor.log, are
named as its TMPDIR is, <name>-2 for a later test of one name, so that
two failing tests of one name each keep their own, and with it where
what each left is kept: with one log for both, the second's was written
over the first's. The README's line on the logs says so. The directory
is dated as it is let go of, since the removal of abandoned directories
goes by its date, which is that of what was last made or removed in it:
for the run of a test that fails after a minute, as one that times out
at the default 60 s does, a minute old already, and the next run would
remove it at once. The removal now reads a directory's date only once
it holds the directory's lock: a date read before could be one the
holder replaced as it let go.
The directory is the run's, not a pass's: every pass of a sweep over
targets shares it, so it is made and its surroundings swept once, and
let go of once the last pass is done. A pass that made one of its own
would have made it once the passes before had let go of theirs, and
making it would have removed any of those that had not changed for a
minute: a kept one, after a pass of that long, while its test's output
said where it was. RunTests becomes the wrapper that holds the run's
directory around RunTestsWith, the passes it recurses into, and the
directory is kept the moment a test keeps something in it, by the
worker that ran the test, so that a later pass that throws, as one does
for a target whose runner CRAFTER_BUILD_RUNNER_ gives wrong, or a
worker that cannot be started does not take it with it; Keep() may be
called from several workers at once.
TMPDIR reaches the test where its runner hands it on, as running it
directly and qemu-user do. Under wine a Windows test does not get
TMPDIR, and takes the Wine prefix's TMP, TEMP and temp directory, and
wasmtime gives a test no environment at all; RunSingleTest's comment
says so. A test under `host` gets its TMPDIR as any test does, so that
comment and HostDisplay's now say that `host` leaves the test the
display, not the whole environment, as it is.
In the runner rather than in each of the 74 tests whose main.cpp uses
the temp directory at this commit: a project's own tests are covered
the same way, where their runner hands them TMPDIR. Of the 74 only
SysrootStdModule has to change. It builds against a sysroot it stages
there, and the std module's cache directory is keyed on the sysroot's
path, which is a new one every run now, so every run left one more
directory, with its lock, in the real cache; it keeps its cache in its
scratch directory now, as the tests that have crafter-build fetch a
repository they stage do. AGENTS.template.md says what changes for the
tests: HostFlatpak, whose /tmp is no longer the temp directory a test
is given, is a second test that writes elsewhere, and under
`crafter-build test` a staged copy goes with the test's TMPDIR rather
than at the test's next run.
The README's Tests section gains "Tests that open windows": a test that
sets Test::wayland, or .Wayland() on what AddTest returns, runs with a
headless compositor of its own instead of the session's display. It
says what crafter-build gives the compositor and the test and what it
does afterwards; the default weston command, weston 12 as the first
release that takes its --renderer=, and what its renderer and two
options are for; how CRAFTER_BUILD_COMPOSITOR, --compositor= and
`host` choose another; when the compositor fails the test, how a test
that may run without weston is skipped, and where the compositor's
output goes; and what a crafter-build that is killed leaves.
The CLI examples gain --compositor=host, and examples/tests/README.md's
list of the builder's methods gains .Wayland().
The README said that crafter-build reads the imports of a
configuration's sources from their text without compiling them, so that
one in a string literal, in a comment that spans lines or under #if 0
counted, and that a configuration whose interface units import each
other is refused before anything of it is built. It now says that
clang-scan-deps reads what a .cppm or .cpp declares and imports, with
the command the source is compiled with, as the compiler reads it, once
the configuration's dependencies are built; where the build keeps what
it read, as it keeps objects; that such a configuration is refused once
its sources are read, before any of its .cppm and .cpp is compiled; and
that the scans are among the steps a build runs at most as many of at
once as the machine has hardware threads.
The README's sentence on a project that two paths load with different
lists now names the projects the build stops for, those that export
modules, since DuplicateModuleError refuses a module built twice and
nothing else, and says that such a project is built once where both
lists give it one build directory, as two orders of the same flags of
its own can. The README and the contributor guide also stop naming
nlohmann/json among the vendored headers in lib/, which it left in
4af9280.
The README's "Writing a project.cpp" says that a .cpp, .c or .cu of a
configuration is compiled into an object named from its path, under
objects/ in the build directory at the source's path from cfg.path, or
under objects-outside/ at its whole path for a source outside
cfg.path; that two sources may therefore have the same file name in
different directories, and a .c lie beside a .cpp or a .cu of its
name; that the progress line of such a source's compile names it by
that path; and that the link and a static library's archive step read
their objects from <outputName>.objects in the build directory.
The contributor guide gains two rules beside the one on output paths.
ObjectPath() names an object, which is not to be named from its
source's file name, and a step that takes every object of a
configuration reads them from a response file. And a static library's
archive and the list of a step's objects are written under another
name beside them and renamed into place, as anything else that a link
or archive step of another crafter-build may be reading is to be: two
crafter-builds can build a project loaded with GitProject at once, in
the clone the cache keeps for its source.
The README's opening and the start of "Writing a project.cpp" say that a
project file returns one configuration or several, and so does the
description in the Flatpak's metainfo. The README has a "Several
configurations" section in "Writing a project.cpp":
CrafterBuildConfigurations with an example, how the configurations it
returns have to be kept, and what a build, test, run, lint, format, -r,
install and bundle do with several. "Dependencies" says how a GitProject
or LocalProject spec picks one of a sibling's configurations, and that a
`#pragma crafter dependency` gets the first; its sentences on the args a
sibling gets, on where to make a spec and on IsTopLevelProject() speak
of a project file's entry point, where they named CrafterBuildProject.
"Dependency notes for agents" says how the dependencyNotes of several
configurations combine, and which runs leave AGENTS.md alone now that a
list of configurations can be refused before a build starts: its
sentence on that said that a build that fails still has the notes, and
named an `install` or `bundle` refused before building as the one
refusal that writes none. The table of ScriptContext says that a
script's `project` is the configuration it is declared on.
The README says in "Writing a project.cpp" that a build runs at most as
many of its steps at once as the machine has hardware threads, which
steps those are, and that an ExternalDependency's CMake build and the
tests are not among them. Under Tests, --jobs= is named as what counts
the tests, and --jobs=1 as one test at a time where it said "serial
mode": the steps of that one test's build still run side by side.
The README says in "Writing a project.cpp" that a unit is built after
the modules and partitions it imports, that interface units of one
configuration that import each other are refused with an error naming
them, and that the imports are read from the source text without
compiling it, so one in a string literal, in a comment that spans lines
or under #if 0 counts too and can make such a round in a project the
compiler accepts.
cfg.cuda had no section of its own, only mentions in passing. The new
one says how sources are listed and linked, where the toolkit is found
and what the Flatpak sees of it, what cfg.cudaArch picks, and what nvcc
is not given: the include paths, defines and compile flags of the C and
C++ compiles, and -g. The Flatpak output section's advice for other
machines names a --cuda-arch= other than native, such as all-major,
beside --march=x86-64-v3.
The README's Flatpak section shows share entries in its picture of the
bin directory and in the cfg.flatpak example, and says what they are
for, that files/share is kept to what is listed, that the ../share
lookup works under -r as well, that flatpak exports what it exports of
them by its own rules, and what build-export checks of that, that an
entry may not take a field's file, that the app's desktop entry is
checked whichever placed it, and which directories an entry may not
copy: those that hold what the build writes or lie in it.
AGENTS.template.md lists them among what FlatpakApp holds.
The README's Flatpak section brings in `crafter-build install` and
`bundle` after -r, where the sentence on what build-finish writes was,
says how they make the app, crafter-build writing the build directory's
metadata and the host's flatpak build-finish adding the command and the
permissions to it and writing export/, and where that directory is, for
trying the app on the host without installing it, says where the repo
and remote live and how two installs of one app-id take turns on the
remote, where `install` takes the runtime from, what to install where no
installation has it and that an app with modules needs the Sdk too, how
they ask the host whether it sees the project's bin/ and build/ and
refuse a project it does not and who in the sandbox holds the permission
they run with, and describes cfg.flatpak.runtime,
cfg.flatpak.permissions, which install and bundle print and build-finish
judges, and cfg.flatpak.modules; it names install and bundle among the
invocations that write AGENTS.md. AGENTS.template.md names what :Flatpak
holds now, and says that org.freedesktop.Flatpak is the whole sandbox's
while crafter-build's own code uses it only in the host helper, why the
trust model allows it, how a test reaches the host without touching the
user's installation, and the trap in probing a tool with `command -v`
through RunCommandWithTimeout, whose `timeout` cannot run a shell
builtin, and lists the locks install keeps on the user's remotes among
what goes in ~/.cache/crafter.build/, found by HOME, so that native and
Flatpak crafter-builds share them.
A section on packaging a program as a Flatpak: how to ask for it, what
its bin directory holds and what flatpak build-finish adds to it, what
cfg.flatpak describes, what cannot be a Flatpak and why, and -march for
other machines. It also says where a program finds its files once
installed, which is not the working directory -r gives it. --help lists
the standard flags with --packaging= among them, says how -r runs a
program, one for the host in its own directory, a wasm32 one under
wasmtime or wasmer and one built for the browser served from its
directory, and names CRAFTER_BUILD_FLATPAK_INFO. The package script
example tars ProgramDir(), the program and its files.
The README's Dependencies section never said how a dependency's headers
reach the projects built on it, so the fix's rule had nowhere to be
stated: its directory and every include/ in its tree are on their
include path, except under a directory named bin or build, and a header
kept under one of those needs an -I of its own in cfg.compileFlags.
The README offered master builds as the `beta` branch, AGENTS.template.md
described the `latest` tag CI force-pushed, a release as a tag pushed
after master, and CI as running on every push to master, and the
repo-better-solution lens told reviewers that users get master through
`beta`.
The README now says that releases go to `stable`, the branch its install
commands pick even while the repo still holds the old `beta` branch.
AGENTS.template.md says that every pushed range adds a release entry and
goes out in one push with a signed tag on the commit master receives,
its last commit or, on the pull-request path, the merge, how to write
the entry, what every run checks before building and what a tag run also
checks, publishes and creates, what follows when one fails, what CI runs
for, and what becomes of `beta`; the lens says users get master through
releases on `stable`. The entry's rules are the owner's: at most three
sections, New, Fixes and Breaking, the most important item first and
nothing after them, and a version that is a major for a Breaking
section, a minor for New items and a patch for Fixes alone. The release
paragraph also gets the blank line that keeps it apart from the one on
local builds.
Crafter.Graphics' PushConstantRewrite and UIFusedShader tests require
tool:spirv-val, and the Sdk has no spirv-val, so inside the Flatpak they
are skipped. The spirv-tools module the validation layer needs built
only the libraries, and removed them afterwards.
It now builds the programs as well, spirv-val, spirv-opt, spirv-dis and
the rest, which link SPIRV-Tools statically, and ships them. The
headers, the static libraries, the CMake and pkg-config files and
libSPIRV-Tools-shared.so, which nothing here links, are still removed,
and a post-install step runs spirv-val --version.
flatpak run becomes bubblewrap, and without --die-with-parent the
sandbox outlives it. With crafter-build started through the alias in an
interactive bash or zsh on a terminal, SIGKILL to its flatpak run
process alone left a -r program running and a build writing into bin/
and build/. With the flag, both ended with it.
bubblewrap kills the sandbox when flatpak run or its parent dies, and
for crafter-build typed at the prompt, in the foreground or with &, that
parent is the shell: with the flag, the sandbox also ended when the
shell was SIGKILLed, or exited after a disown. In a (crafter-build -r &)
subshell, flatpak run outlives the subshell and is adopted by another
process, so its sandbox outlived the shell with the flag as well. Ctrl-C
ended the program either way.
The README's alias gets the flag, and the paragraph after it says what
that changes: a program started through the alias, as crafter-build ...
or crafter-build ... & at a bash or zsh prompt, ends with its shell,
even after a disown.
The README gets a Debugging section: the debugging tools the sandbox
carries, that a program to debug needs cfg.debug (which --debug sets
where the project calls ApplyStandardArgs), how to start the tools with
--command, why a debugger in one flatpak run cannot see a program that
another one started (each has process IDs of its own), and flatpak
enter as the way into a running program's sandbox, with the ptrace
opt-in that takes where ptrace_scope is 1. It warns off lldb's
gdb-remote from a second sandbox: when a process in lldb's own sandbox
has the remote program's process ID, lldb takes that process's
executable for the program's. And it shows which variables turn the
layer and GPU-AV on from the environment, and that VK_LAYER_PATH and
VK_ADD_LAYER_PATH do not reach the sandbox.
AGENTS.template.md gets the module layout and the rule that the layer
follows the Sdk's Vulkan loader. Its CI section says that a change to a
module's sources or build-commands builds it again and every module
after it, so that a new version of swig or libedit, which come before
LLVM, now rebuilds it too, and loses the cold-run time it gave, written
on 2026-10-03, before any of these modules were in the manifest.
The README said every prefix reached clang as a view of its
x86_64-w64-mingw32/ and lib/gcc/, in ~/.cache. It now says a prefix is
the sysroot as it is unless it also holds a Linux system, names
lib64/gcc/ as well, gives the view's place inside the Flatpak and the
XDG_RUNTIME_DIR fallback, and says messages name headers by their path
in the prefix.
AGENTS.template.md describes MingwSysroot's two outcomes and
MingwViewToPrefix, has the std PCM keyed on its flags in the cache
rule, lists StdPcmKey among what VariantId hashes, and gains two
gotchas: anything that changes how the std module is compiled goes into
StdPcmFlags, and a CMake external whose recorded configure inputs
differ is built again from an empty directory.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The README says which directories of a mingw-w64 prefix clang sees, and
why the rest of a prefix like /usr is kept out of a Windows build.
AGENTS.template.md names MingwSysroot in the :Toolchain partition, with
the reason the prefix itself is never a sysroot, counts the views among
what goes in the cache, and adds the mingw prefix to what VariantId
hashes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The dependency notes section now starts from the template: what to
commit and what to ignore, the two commands that move a project with a
committed AGENTS.md over, what a build writes, where the section goes,
and what becomes of an AGENTS.md no build wrote and of one that still
holds a section from 3.0.0.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
-mllvm -wasm-enable-sjlj, in every wasm compile because setjmp.h does
not compile without it, turns setjmp and longjmp into calls to
__wasm_setjmp, __wasm_setjmp_test and __wasm_longjmp and a throw of
the __c_longjmp tag, all of which live in wasi-libc's libsetjmp. The
driver does not link it, so a program that used setjmp, or a C library
that handles its errors that way, failed to link with undefined
__wasm_setjmp until the project put -lsetjmp in its linkFlags.
Build() adds it to every wasm link, next to -lunwind. A static archive
contributes only the members something references, so a program
without setjmp gets nothing from it, and every sysroot that passes the
exception check ships it. WasmExceptions drops its own -lsetjmp, and
its C fixture now fails to link without this.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The README called an exception escaping main a trap. It is an uncaught
WebAssembly exception, and nothing prints its type or what(); the
README says so now. It also lists what a wasm build refuses and why,
says that setjmp needs -lsetjmp and that a longjmp across a noexcept
function ends the program, that a wasmtime older than 47 needs
-W exceptions=y, and that an old wasm-opt on PATH breaks release links.
It documents exit and park in a page from EnableWasiBrowserRuntime,
with the declaration of the park import.
The wasi example still sent Arch users to wasi-libc++, which has no
exception-enabled libraries. It asks for a wasi-sdk 33 sysroot or the
Flatpak now, and names the browsers a page needs. AGENTS.md notes that
the runtime test needs node, so it runs in the native loop and not in
CI.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The README described the mingw target and said nothing about wasm. It
now says where the WASI sysroot comes from, that C++ exceptions work as
on the other targets and what that takes (-fwasm-exceptions in the
standardized form, the sysroot's exception-enabled libc++, -lunwind
added to the link), which engines run the result, and that an exception
escaping main ends the program without calling std::terminate.
AGENTS.md says where the wasm flags live, that VariantId and the std
PCM directory hash them, and that the wasm tests skip where the
distro's sysroot lacks the eh/ libraries, so they run in the Flatpak.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PR #42, fixes#41. Build() now refuses a configuration whose transitive
dependencies hold two configurations exporting a module of the same
name, such as one project loaded along two paths with different arg
lists, before it builds anything, and names both paths. Until now both
builds ended up in the one program, which compiled cleanly and then
read garbage. Merged cleanly on top of claude/forward-project-args;
the suite, with claude/dependency-notes' fixtures, passes under the
new check.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PR #40. GitProject and LocalProject default their args to the loading
project's own (ProjectArgs()), this tree lints with LintRules' lite
set, and the fixes from the branch's review: a project file gets its
args only for the CrafterBuildProject call, host tooling gets project
cache entries of its own, and `--` ends crafter-build's options.
The conflicts with claude/dependency-notes are all places both sides
added to:
- Platform.cppm and Platform.cpp: PragmaDependencies() beside
ProjectArgs() and LoadingHostTooling(), all three kept.
- LoadProject: the record PragmaDependencies() reads moves up with the
frame's dependencies, which this branch sets before dlopen. Left
where it was, it would have copied preDeps.configs after the vector
was moved into the frame, and recorded nothing.
- README: the pragma section's new last sentence goes before the new
"Dependency notes for agents" section.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The README and the spec comment said that a project two paths load with
different lists ends up in the program twice. They now say the build
stops, with an error that names both paths.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The README suggested giving one sibling a list without a flag only the
project reads, so that the sibling would not get a build directory of
its own. When another path loads the same sibling with the full list,
that filter is what gives it the second directory: two builds of one
project, both in the program (#41). It now says to build such a list
once and give it to every sibling. It also says the default is read
when the spec is made, so a spec made at namespace scope, on another
thread or in a script forwards nothing, and that cfg.projectArgs, the
part ApplyStandardArgs did not interpret, is no substitute: it drops
the target and the build type. The comments on ProjectArgs() and on
Configuration::projectArgs say the same.
The spec comment named --local as a flag the default carries down a
chain of siblings. Through a GitProject hop it breaks: the clone has no
checkouts beside it. The GitProject comment said the clone is keyed by
the args; only the Configuration is, and every arg list builds in the
one clone. AGENTS.md now notes that a stale harness gives no symptom
for a changed default member initialiser: project.cpp silently gets the
old default.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings in dependency notes: a crafter-build project that ships an
AGENTS.consumer.md beside its project.cpp has it kept in a marked
section of each consumer's AGENTS.md, refreshed by `crafter-build` and
`crafter-build test`, chosen by cfg.dependencyNotes (Transitive,
Direct, None). The new partition is Crafter.Build:Agents; the loader
records where each GitProject and LocalProject came from and what a
project file's pragmas resolved to.
The branch started before master's four external-fetch commits. Both
touch External.cpp, the Clang partition, project.cpp, README.md and
AGENTS.md, but in different places, so the merge needed no hand
reconciliation; the merged tree passes build.sh, the self-host build,
format --check and the test suite.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The README's section: notes are labelled by name, the file is written
in place, a project.cpp that fails to load gets no update, `test
--list` writes nothing, the section follows what the build loaded, and
tests' dependencies don't count. The AGENTS.md gotcha: an unpinned
dependency can change this file's section on any build here, and the
dirty tree then rebuilds crafter.build-lib under a new version.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The sibling-project example dropped its `.args = depArgs`, which no
longer has to be written, and says what a sibling receives instead: the
args the project file was loaded with, or whatever `.args` is set to,
with `{}` for nothing. It also says that releases up to 2.2.0 forward
nothing without `.args`, which matters for a project.cpp that has to
load on both.
The pragma section says that a project file's own dependency is built
for the host and gets none of the project's args, the one place the
default does not apply.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What a library ships and where, what a consumer's AGENTS.md gets and
when it is written, the section's format, and what cfg.dependencyNotes
selects.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Say how often an unpinned ExternalDependency is pulled now that the
configurations of a build share it, and list the target in the clone's
cache key, which it is part of.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Shaders record the files glslang opened (a depfile) and their settings
(source path, stage, entry point, defines, include directories) in the
build directory, and rebuild when an included file or a setting changes,
not only the shader's own source.
- An executable relinks when its link command changed, not only when an
object is newer: a link flag in project.cpp, or a dependency's library
that moved (an ExternalDependency built into a new cache directory). The
command is recorded beside the objects; its flags come from ordered sets,
so the order the dependency threads finish in can't change it.
- An external's newest artifact counts its libDirs and versioned .so names.
- Submodules are checked out at the revisions the fetched commit records,
from the URLs its .gitmodules gives, after every clone, switch, checkout
and pull, so a pinned commit builds against its own submodules, and one
moved by hand is put back; with no .gitmodules, git isn't asked.
- Each external clone's fetch and build hold a file lock: parallel builds
pulled into one clone at once ("cannot lock ref").
- mingw:
- -stdlib=libstdc++ always;
- the std module's source is found through libstdc++.modules.json in the
mingw toolchain's own library directories (the generic lib/ holds the
host's Linux one), asking the compiler once a run;
- a toolchain that isn't there is a build error saying where it looked,
not std::terminate;
- CRAFTER_MINGW_DIR names the prefix, the directory holding
x86_64-w64-mingw32/ and lib/gcc/;
- inside the Flatpak the host's /usr mingw is used.
- RunScript's exit-status check reads as the one range it is.
- Tests: ConcurrentExternalFetch, ExternalArtifactTime, GitSubmodules,
LinkFlagsChange, MingwMissing, ShaderIncludeChange; ShaderCompile and
ToolchainResolve extended.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The README still gave the output path as bin/<name>-<target>-<march>/,
which has not been its shape since the variant hash was introduced. It
now shows the real one and says what the hash stands for, including
that a compiler update starts a new directory and `clean` removes the
old. AGENTS.md lists the toolchain among VariantId()'s inputs and notes
that a glob over variant directories matches two after an update.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The README said a cross build precompiles the sysroot's own std.cppm,
which was never the whole story for sysroots that do not ship one. It
now states the order (the sysroot's, the toolchain's for the same major
release, the sources crafter-build carries for other releases), what
the failure looks like when nothing matches and how to resolve it, and
lists the new directory in the install layout.
AGENTS.md records the rule for the next LLVM bump: the release the
bundled toolchain leaves behind stays available as a module-source
module, because stable distros remain on it long after.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The README leads with the Flatpak install, keeps the native loop as the
way to build from source, and drops the tarball, musl and makepkg text
that no longer describes anything CI produces. The install layout shows
the /app tree and the per-app cache directory.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
README and AGENTS.md stop documenting build.cmd, LIBCXX_DIR, the
DLL-plus-launcher design rule and the cmd-over-SSH gotcha. The runner
section also drops Ssh, SshWin and Wsl, which were removed from the
code earlier but still had README entries, and the stale pointer to a
deleted cross-arch test. ci.yaml loses the commented-out Windows build,
staging and upload steps and the comments that counted them.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Brings in `#pragma crafter dependency`, the switch to Crafter.LintRules
for the house style, and the contributor guide in AGENTS.md.
The branch predates the musl host work on master, and both rewrote the
command that compiles project.so, so the merge reconciles them by hand:
- LoadProject compiles project.so for hostConfig.target (HostTarget(),
from master) with the pre-dependency module path and archives from
the branch. -fuse-ld=lld appears once, with both reasons in the
comment.
- ForceHostTooling added -fPIC only for the literal x86_64-pc-linux-gnu
triple. hostConfig now comes from HostTarget(), so on Alpine the host
is x86_64-alpine-linux-musl and the dependency archive would not have
been position-independent. It now matches any *-linux-gnu or
*-linux-musl host, as project.cpp and the cmake flags do since the
musl change, and its comment no longer argues against HostTarget().
- The ProjectDependency test compared the dependency's target against
the glibc triple, which the musl CI job would fail; it compares
against HostTarget().
- README keeps master's paragraph on the bootstrap triple. AGENTS.md
describes the test block as `if (linuxTarget)`, which is what
project.cpp has now.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
lint-rules.h moves to its own repo as the module Crafter.LintRules, which
project.cpp now imports through `#pragma crafter dependency`. Editing a
rule no longer needs `touch project.cpp`: the rebuilt dependency makes
project.so stale by itself. tests/HouseRules moves with the rules.
Building this checkout needs a crafter-build that understands the
directive (`./build.sh` bootstraps one) and the Crafter.LintRules repo on
Forgejo.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
A project.cpp could only import std and Crafter.Build, so anything shared
between build descriptions had to be a header every consumer copies. Now
#pragma crafter dependency "<source>" [branch "<b>" | commit "<sha>"] [project "<file>"]
names a sibling crafter-build project that project.cpp itself imports a
module from. LoadProject scans for the directive, resolves it through
GitProject (a URL) or LocalProject (a path relative to the project file),
forces the result into host-tooling mode (the host triple LoadProject's
own cache is keyed on, native march, no debug, -fPIC so the archive links
into a shared object), builds it, and puts its BMIs and archive on the
project.so command line. The dependency's own project.cpp goes through
the same loader, so its directives resolve recursively; a cycle between
project files is an error instead of unbounded recursion.
The dependency is built on every load, fresh or not: clang crashes rather
than erroring when it imports a BMI whose own imported PCM was rebuilt
underneath it, and the module depfile — which Module::Check already reads —
is what notices the host PCM cache was regenerated. Its artifact mtime is
an input to project.so's staleness check, so editing the dependency
recompiles project.cpp without touching it. The Linux link gains
-fuse-ld=lld because release archives hold ThinLTO bitcode.
ProjectDependency(name) hands the same Configuration* back from inside
CrafterBuildProject, by configuration name or exported module name, so a
test that links the module needn't spell the source twice. It reads a
thread_local frame stack that an RAII guard keeps for the whole of
LoadProject, which also provides the cycle check.
ExpectedOutput() is the link gate's artifact-path lambda hoisted into the
:Clang partition, so the staleness check and the -r runner share the one
rule. Windows branches are wired identically but unverified.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The Linux host code paths were gated on the x86_64_pc_linux_gnu target
define alone, and LoadProject hardcoded --target=x86_64-pc-linux-gnu when
compiling project.cpp and the module PCMs. Both break on musl hosts: the
glibc release launcher cannot run there at all (no glibc loader; gcompat
lacks libgcc_s and the __isoc23_* symbols), and a musl-built launcher
would still compile project.cpp for the wrong libc.
- The host gates test clang's __linux__ instead of one triple's define:
they mean "Linux host", whatever the libc (or, later, the CPU).
- LoadProject derives the host triple from HostTarget() (clang's
-print-target-triple), which is also more correct on glibc distros
whose triple isn't x86_64-pc-linux-gnu.
- project.cpp / the cmake libc++ flags treat any *-linux-gnu or
*-linux-musl target as Linux.
- build.sh targets the host toolchain's triple (CRAFTER_BUILD_TARGET
overrides) and derives the per-target define from it. On Arch this is
byte-for-byte the previous behaviour.
- CI: a release-musl job bootstraps on alpine:edge, runs the tests, and
attaches crafter-build-linux-x86_64-musl-v2.tar.gz to the rolling
latest release (via the API, so the glibc assets survive). Dynamic
against musl libc++: the launcher dlopens project.so, so it cannot be
fully static.
First consumer: imsd's package CI, which cross-compiles for aarch64 from
an Alpine container.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The staleness check compared an artifact against its own source and its
module imports. Headers were in neither set: the scanner reads `import`
lines, and a .cppm or .cpp keeps its mtime when a header it includes is
edited — so the build reported nothing to do and left objects compiled
against the previous contents. Same silent mixed-layout binary as issue
27, reached through #include instead of import.
Ask the compiler what it actually opened. Every C++ and C compile now
passes -MD -MF <artifact>.d, and Check reads that depfile back through
NewestPrerequisite, comparing every prerequisite's mtime against the
artifact. A missing depfile (an object from a crafter-build that wrote
none) or a prerequisite that no longer exists reads as "rebuild": neither
is evidence of freshness.
The parser unescapes make syntax rather than splitting on whitespace,
since clang wraps depfiles onto continuation lines and escapes spaces in
filenames.