Skip to content

Commit 4525537

Browse files
authored
0.10.0: dist-apk and dist-apple read the staged closure; dmg, aab and setup formats; rules-metal (mcpp#634) (#24)
The plugin half of mcpp#634, measured on the released mcpp 2026.9.14.2 (run 34831041382).
1 parent 9301832 commit 4525537

35 files changed

Lines changed: 2539 additions & 610 deletions
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#!/usr/bin/env bash
2+
# The mcpp a job's steps run, when that is not the released one.
3+
#
4+
# `MCPP_SOURCE_REF` names a branch or tag of mcpp-community/mcpp. Empty, the
5+
# steps run the release `MCPP_VERSION` names, which the step before this one
6+
# fetched into `$MCPP`. Set, this script builds mcpp at that reference with the
7+
# released mcpp and points `$MCPP` at the result, so that a change to the engine
8+
# is measured against this collection before either is released.
9+
#
10+
# A SCRIPT, NOT A STEP COPIED INTO EACH JOB. Two copies drift, and a job that
11+
# installs mcpp without this channel builds manifests written for the engine
12+
# under review with the released engine, which accepts a key it does not know
13+
# and proceeds without the semantics the key asks for.
14+
#
15+
# WHAT THIS SCRIPT WRITES IS NOT EVIDENCE THAT IT TOOK EFFECT. `GITHUB_ENV`
16+
# governs the steps that follow, so the job's next step compares what `$MCPP`
17+
# names and prints with what this script built.
18+
#
19+
# Environment: MCPP (the released mcpp), MCPP_SOURCE_REF, RUNNER_TEMP, GITHUB_ENV.
20+
set -euo pipefail
21+
22+
: "${MCPP:?the released mcpp, which the step before this one fetches}"
23+
: "${GITHUB_ENV:?}"
24+
: "${RUNNER_TEMP:?}"
25+
26+
echo "MCPP_RELEASED=$MCPP" >> "$GITHUB_ENV"
27+
if [ -z "${MCPP_SOURCE_REF:-}" ]; then
28+
echo "MCPP_SOURCE_REF is empty: the steps run the released $("$MCPP" --version | head -1)"
29+
exit 0
30+
fi
31+
32+
# In Git Bash on Windows `RUNNER_TEMP` is a Windows path (`D:\a\_temp`), and the
33+
# binary path this script exports is used by bash in every later step, so the
34+
# directory is spelled in bash's own syntax.
35+
temp="$RUNNER_TEMP"
36+
if command -v cygpath > /dev/null; then temp=$(cygpath -u "$temp"); fi
37+
src="$temp/mcpp-src"
38+
rm -rf "$src"
39+
git clone --quiet --depth 1 --branch "$MCPP_SOURCE_REF" \
40+
https://github.com/mcpp-community/mcpp.git "$src"
41+
echo "READING source: mcpp-community/mcpp $MCPP_SOURCE_REF at $(git -C "$src" rev-parse HEAD)"
42+
43+
# The clone's `.xlings.json` pins the mcpp that builds mcpp in that repository's
44+
# own CI, and the pin does not move with this job's release: a build inside the
45+
# checkout obeys it and installs a version this job did not choose. Removed, the
46+
# released mcpp above builds the source.
47+
rm -f "$src/.xlings.json"
48+
49+
(cd "$src" && "$MCPP" build)
50+
51+
# A fresh clone holds no earlier build, so what remains is this build's product;
52+
# the count is asserted rather than assumed.
53+
built=$(find "$src/target" -type f \( -name mcpp -o -name mcpp.exe \))
54+
count=$(printf '%s\n' "$built" | grep -c . || true)
55+
if [ "$count" != 1 ]; then
56+
echo "::error::expected one mcpp binary from $MCPP_SOURCE_REF, found $count"
57+
printf '%s\n' "$built" | sed 's/^/ /'
58+
exit 1
59+
fi
60+
version=$("$built" --version | head -1)
61+
echo "READING under review: $version at $built"
62+
{
63+
echo "MCPP=$built"
64+
echo "MCPP_UNDER_REVIEW=$built"
65+
echo "MCPP_UNDER_REVIEW_VERSION=$version"
66+
} >> "$GITHUB_ENV"

.github/workflows/ci.yml

Lines changed: 165 additions & 33 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 14 additions & 3 deletions
Large diffs are not rendered by default.

dist/apk.cppm

Lines changed: 420 additions & 413 deletions
Large diffs are not rendered by default.

dist/apple.cppm

Lines changed: 305 additions & 97 deletions
Large diffs are not rendered by default.

dist/wix.cppm

Lines changed: 212 additions & 43 deletions
Large diffs are not rendered by default.

mcpp.toml

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "plugins"
33
namespace = "mcpp"
4-
version = "0.9.3"
4+
version = "0.10.0"
55
description = "Official mcpp build plugins: rule packages under mcpp.rules.*, build-time utilities under mcpp.tools.*, each member selected by a feature"
66
license = "Apache-2.0"
77
authors = ["mcpp-community"]
@@ -84,6 +84,16 @@ implies = ["surface"]
8484
rule_module = "mcpp.rules.cuda"
8585
device_extensions = [".cu"]
8686

87+
# `.metal` shaders become Metal libraries through `xcrun metal` and `xcrun
88+
# metallib`, the toolchain Xcode carries. No payload is declared, for the reason
89+
# `dist-apple` gives for `codesign`: Xcode is not redistributable, so the rule
90+
# locates the toolchain and refuses naming the command that found nothing.
91+
[features.rules-metal]
92+
sources = ["rules/metal.cppm"]
93+
implies = ["surface"]
94+
rule_module = "mcpp.rules.metal"
95+
device_extensions = [".metal"]
96+
8797
[features.rules-hip]
8898
sources = ["rules/hip.cppm"]
8999
implies = ["surface"]
@@ -388,12 +398,28 @@ implies = ["surface"]
388398
# The per-host table stays the right shape only at the top level, where
389399
# platform keys select the HOST rather than restating a predicate the
390400
# section has already applied.
401+
#
402+
# 5.0.2-1, NOT 5.0.2, BECAUSE `--format setup` NEEDS THE EXTENSION. The recipe
403+
# revision adds `WixToolset.BootstrapperApplications.wixext` beside the tool,
404+
# and a bundle with WiX's stock bootstrapper application is refused without it
405+
# (WIX0200). An installation made under 5.0.2 keeps the payloads it fetched,
406+
# because xlings does not re-run the install hook of an installed version, so
407+
# the pin names the revision rather than the release.
391408
[target.windows.feature-xlings.dist-wix]
392-
"xim:wix" = "5.0.2"
409+
"xim:wix" = "5.0.2-1"
393410

394-
# `dist-apple` declares no payload for `codesign`: it is part of Xcode, which is
395-
# not redistributable, so the member locates it and says where it looked. The
396-
# open-source `rcodesign` is the package that would replace that lookup.
411+
# `dist-apple` declares no payload for `codesign`, `ditto` or `hdiutil`: they are
412+
# part of macOS and Xcode, which are not redistributable, so the member runs the
413+
# system's. The open-source `rcodesign` is the package that would replace the
414+
# `codesign` lookup.
415+
#
416+
# THE RUNNER IS A PAYLOAD, AND ONLY `mcpp run` NEEDS IT. `mcpp run --format app`
417+
# on macOS reaches the bundle through the runner named `app` this member
418+
# supplies, `macapp-run`, which executes the bundle's executable in the
419+
# foreground so that its output and exit status are the program's. `when =
420+
# "run"` keeps a build or a pack from installing it.
421+
[target.'cfg(os = "macos")'.feature-xlings.dist-apple]
422+
"xim:macapp-run" = { version = "0.1.0", when = "run" }
397423

398424
# ── The environment `dist-apk` needs ───────────────────────────────────────
399425
#
@@ -405,7 +431,7 @@ implies = ["surface"]
405431
# is downloaded" shape the accelerator rules use, applied to the target axis
406432
# instead.
407433
#
408-
# FOUR PACKAGES, EACH OWNED BY A DIFFERENT HALF OF THE PIPELINE. `aapt2`,
434+
# FOUR OF THE FIVE PACKAGES, EACH OWNED BY A DIFFERENT HALF OF THE PIPELINE. `aapt2`,
409435
# `zipalign`, and the `apksigner`/`d8` wrappers all live in one archive
410436
# (`xim:android-build-tools`); `android.jar` is versioned by API level on its
411437
# own (`xim:android-platform`) because that is the number a project pins, not
@@ -430,11 +456,17 @@ implies = ["surface"]
430456
# directory this entry resolves to (`api_level_from_platform_dir`), so an
431457
# alias that silently failed to resolve would surface as a build-time
432458
# refusal rather than a wrong number, but there is no reason to court it.
459+
#
460+
# `xim:bundletool` BUILDS `--format aab`. It is installed with the other four
461+
# for the reason `dist-appimage` gives above: provisioning runs before the
462+
# build program learns `--format`, so the format cannot gate a download. Its
463+
# launcher runs the JDK it was installed against, which is the one pinned here.
433464
[target.'cfg(env = "android")'.feature-xlings.dist-apk]
434465
"xim:android-build-tools" = ">=37.0.0"
435466
"xim:android-platform" = "36-r2"
436467
"xim:jdk-temurin" = "25.0.4+7"
437468
"xim:android-debug-keystore" = "1.0.0"
469+
"xim:bundletool" = "1.18.3"
438470

439471
[targets.plugins]
440472
kind = "lib"

0 commit comments

Comments
 (0)