Skip to content

devcontainer: allow BUILDROOT_OUTPUT to be overridden - #31

Merged
colemancda merged 1 commit into
masterfrom
feature/prebuilt-host-swift
Aug 1, 2026
Merged

colemancda merged 1 commit into
masterfrom
feature/prebuilt-host-swift

Conversation

@colemancda

Copy link
Copy Markdown
Member

swift-define computed BUILDROOT_OUTPUT unconditionally from WORKING_DIR and SWIFT_TARGET_ARCH, so a caller whose output tree lives elsewhere could not use install-swift.sh at all.

The toolchain CI builds into a persistent directory on the self-hosted runner's own disk (O=/mnt/br/shared), which no combination of those two variables can spell. This gives BUILDROOT_OUTPUT the same "${VAR:=default}" treatment the other configurables already have — the existing layout stays the default.

Why

This unblocks using the prebuilt Swift toolchain in CI instead of building host-swift from source, which takes 5–6 hours and has now failed four separate ways (wasi-libc pin mismatch, stale-checkout API mismatch, -index-store-path on the distro clang, and scattered CMake cache corruption from resumed builds).

Verified end-to-end inside colemancda/buildroot-swift:latest:

$ BUILDROOT_OUTPUT=/out SWIFT_BUILDROOT=/tmp/ext bash .devcontainer/library-scripts/install-swift.sh
Download https://download.swift.org/swift-6.3.3-release/debian12/swift-6.3.3-RELEASE/swift-6.3.3-RELEASE-debian12.tar.gz
Install LLVM

$ swiftc --version
Swift version 6.3.3 (swift-6.3.3-RELEASE)

$ clang --version
clang version 21.0.0 (https://github.com/swiftlang/llvm-project.git 82cdc19fa54d566969527b56f587ea8ea30bef51)

$ clang -index-store-path /tmp/idx -c t.c -o t.o   # the flag that broke CI
$ echo $?
0

The prebuilt clang is the same swiftlang/llvm-project commit the source build was producing, and it supports -index-store-path — so it also resolves that failure directly.

HOST_SWIFT_BUILD_CMDS is already guarded by if [ ! -d "$(SWIFT_LLVM_DIR)" ], so populating build/usr and build/llvm makes build-script skip entirely; no change to swift.mk is needed.

swift-define computed BUILDROOT_OUTPUT unconditionally from WORKING_DIR and
SWIFT_TARGET_ARCH, so a caller whose output tree is somewhere else could not
use install-swift.sh at all. The toolchain CI builds into a persistent
directory on the runner's own disk (O=/mnt/br/shared), which no combination
of those two variables can spell.

Give it the same "${VAR:=default}" treatment the other configurables already
have, so the existing layout stays the default and CI can point the script at
the tree it actually builds into.
@colemancda
colemancda merged commit 0657e3c into master Aug 1, 2026
8 checks passed
@colemancda
colemancda deleted the feature/prebuilt-host-swift branch August 1, 2026 09:28
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.

1 participant