Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .agents/docs/2026-09-26-deps-vcpkg-rules-qt-plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,19 @@ T1 mcpp#702 实现并发布(mcpp 侧)─────────┴──►
- `path` 包的宿主工具以整棵目录树的 stamp 为键,嵌套其中的消费方写出的文件改变该键(mcpp#705)。fixture
位于插件仓库之内,因此其安装位于 `target/` 之下,检查脚本的日志写入 `target/ci/`,第二次构建以
`--profile dev` 绕过快路径,使 Linux 与 Windows、macOS 走同一条规划路径。从索引取得插件的项目不受影响。

## 6. 0.14.0:运行时数据与精简 Qt(GalTranslPP 验证后的第二轮)

GalTranslPP 在 0.13.1 上构建成功后仍有两个手动步骤(解压嵌入式 Python、运行 `Release.py`),Qt 下载量为
完整基础包。第二轮把固定步骤程序化,并补齐 windeployqt 的 Qt 翻译:

| 交付 | 仓库 | 机制 |
|---|---|---|
| `deps-archive` | mcpp-plugins | 配置期读 zip 中央目录,一个 `artifact` action 解压并逐一命名输出(SPEC-007 R3.2),每个输出 `mcpp::deploy`;`mcpp run` 与 `mcpp pack` 均可见 |
| `deps-vcpkg` / `deps-cmake` 的 `deploy` | mcpp-plugins | 前缀中的文件由命名输出的复制 action 取出再部署;不依赖引擎「deploy 等待 prepare」 |
| `translations::qt_languages` | mcpp-plugins | `lconvert` 合并所链接模块的目录为 `qt_<lang>.qm`,即 windeployqt 的产物 |
| `rules-qt-xim-base` / `xim:qt-base` | mcpp-plugins、xim-pkgindex、xlings-res | qtbase + qttools + qttranslations + 单独重发布的 QtQml 库;下载量约为 `xim:qt` 的三分之一 |
| `libs/qtsdk.lua` | xim-pkgindex | qt、qt-base、qt-addons 共享的下载、镜像、解压与标记逻辑 |

实测:库包中的 `artifact` 输出经 `mcpp::deploy` 传播到依赖它的程序的 `bin/` 与 `mcpp pack` 目录;依赖包中无下游
消费者的 `artifact` action 随下游构建执行。
63 changes: 62 additions & 1 deletion .github/scripts/check-deps-and-qt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ vcpkg_consumer() {
"$MCPP" run | tee target/ci/run.log
grep -qE '^vcpkg-consumer: fmt [0-9]+ says 42$' target/ci/run.log || fail "the program did not print through fmt"
assert_not_rerun "$(stamp_of deps-vcpkg)"
# A file of the prefix the build program named in options::deploy.
find target -path '*/bin/licenses/fmt/copyright' | grep -q . ||
fail "share/fmt/copyright was not deployed beside the program"
echo "ok: a file of the prefix is deployed beside the program"

if is_windows; then
# The pack collects it from the runtime search directory.
Expand All @@ -74,6 +78,7 @@ vcpkg_consumer() {
fail "started from the build directory, the program did not find fmt.dll"
"$MCPP" pack --format dir | tee target/ci/pack.log
find target/dist -iname 'fmt.dll' | grep -q . || fail "the packed tree carries no fmt.dll"
find target/dist -path '*/licenses/fmt/copyright' | grep -q . || fail "the packed tree carries no deployed copyright"
echo "ok: the packed tree carries fmt.dll"
fi
}
Expand Down Expand Up @@ -128,6 +133,58 @@ cmake_consumer() {
echo "ok: a file added to the subproject re-ran its installation"
}

archive_consumer() {
cd "$ROOT/tests/archive-consumer"
rm -rf target
mkdir -p target/ci
# PLANNING EXTRACTS NOTHING. The listing is read from the archive's central
# directory; the extraction is an action.
"$MCPP" emit build-database --format json > target/ci/db.json 2> target/ci/emit.log ||
{ cat target/ci/emit.log; fail "emit build-database failed before any extraction"; }
[ -z "$(find target -path '*deps-archive*' -type f)" ] || fail "emit build-database extracted something"
echo "ok: emit planned the archive and extracted nothing"

"$MCPP" build 2>&1 | tee target/ci/build.log
"$MCPP" run | tee target/ci/run.log
grep -q "^archive-consumer: 'greetings from the archive', 'a file two levels down'$" target/ci/run.log ||
fail "the program did not read the archive's files from beside itself"
# The C++ file among the data `#error`s if compiled; the build succeeded,
# and the file is beside the program as data.
find target -path '*/bin/runtime/bundle/not-compiled.cpp' | grep -q . ||
fail "an archive member was not deployed beside the program"
echo "ok: the archive's tree is beside the program, a C++ member included, as data"

local copy
copy=$(find target -path '*deps-archive/bundle/bundle/greeting.txt' | head -1)
[ -n "$copy" ] || fail "no extracted copy under target/"
touch -r "$copy" target/ci/before-second-build
sleep 1
"$MCPP" build --profile dev > target/ci/second-build.log 2>&1 ||
{ cat target/ci/second-build.log; fail "the second build failed"; }
[ -z "$(find "$copy" -newer target/ci/before-second-build)" ] ||
fail "a second build with nothing changed extracted the archive again"
echo "ok: a second build with nothing changed did not extract the archive again"

touch assets/bundle.zip
"$MCPP" build --profile dev > target/ci/third-build.log 2>&1 ||
{ cat target/ci/third-build.log; fail "the build after touching the archive failed"; }
[ -n "$(find "$copy" -newer target/ci/before-second-build)" ] ||
fail "a changed archive was not extracted again"
echo "ok: a changed archive was extracted again"

"$MCPP" pack --format dir > target/ci/pack.log 2>&1 || { cat target/ci/pack.log; fail "mcpp pack failed"; }
find target/dist -path '*/runtime/bundle/nested/deep.txt' | grep -q . ||
fail "the packed tree does not carry the archive's files"
# A PE program sits at the root of the packed tree, an ELF or Mach-O one
# under bin/; the deployed files are beside it either way.
local packed
packed=$(find target/dist -type f \( -name archive-consumer -o -name archive-consumer.exe \) | head -1 || true)
[ -n "$packed" ] || fail "no packed program under target/dist"
"$packed" | grep -q "^archive-consumer: 'greetings from the archive'" ||
fail "the packed program did not read the archive's files"
echo "ok: the packed tree carries the archive's files, and the packed program reads them"
}

qt_consumer() {
cd "$ROOT/tests/qt-consumer"
rm -rf target
Expand All @@ -146,6 +203,9 @@ qt_consumer() {
fail "moc, rcc or lrelease did not reach the program"
find target -name 'qt_consumer_de.qm' | grep -q . || fail "no .qm was produced"
echo "ok: moc (header and inline), rcc and lrelease reached the program"
grep -q "Qt's own 'Abbrechen'$" target/ci/run.log ||
fail "Qt's own strings were not translated from the combined qt_de.qm"
echo "ok: lconvert combined Qt's catalogs into qt_de.qm, and the program loads it"
"$MCPP" build --profile dev -v > target/ci/second-build.log 2>&1 ||
{ cat target/ci/second-build.log; fail "the second build failed"; }
! grep -qE '/(lupdate|lrelease)[^ ]* ' target/ci/second-build.log ||
Expand Down Expand Up @@ -179,9 +239,10 @@ qt_widgets_consumer() {

case "${1:-}" in
vcpkg-consumer) vcpkg_consumer ;;
archive-consumer) archive_consumer ;;
vcpkg-workspace) vcpkg_workspace ;;
cmake-consumer) cmake_consumer ;;
qt-consumer) qt_consumer ;;
qt-widgets-consumer) qt_widgets_consumer ;;
*) echo "usage: $0 vcpkg-consumer|vcpkg-workspace|cmake-consumer|qt-consumer|qt-widgets-consumer"; exit 2 ;;
*) echo "usage: $0 vcpkg-consumer|archive-consumer|vcpkg-workspace|cmake-consumer|qt-consumer|qt-widgets-consumer"; exit 2 ;;
esac
10 changes: 8 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1650,6 +1650,9 @@ jobs:
- name: deps-vcpkg installs a manifest as an action, and planning installs nothing
run: bash .github/scripts/check-deps-and-qt.sh vcpkg-consumer

- name: deps-archive extracts a zip the project keeps and deploys its tree beside the program
run: bash .github/scripts/check-deps-and-qt.sh archive-consumer

- name: deps-vcpkg in two workspace members that share no dependency
run: bash .github/scripts/check-deps-and-qt.sh vcpkg-workspace

Expand All @@ -1659,7 +1662,7 @@ jobs:
# A console program: QtCore, which is what Linux is served for. QtGui
# loads libdbus, which the ecosystem does not publish, so the Widgets
# fixture runs on Windows only.
- name: rules-qt runs moc, rcc and lrelease, with the SDK from xim:qt
- name: rules-qt runs moc, rcc, lupdate and lrelease, with the SDK from xim:qt-base
run: bash .github/scripts/check-deps-and-qt.sh qt-consumer

# ── THE SAME RULE ON THE OTHER TWO PLATFORMS ────────────────────────────────
Expand Down Expand Up @@ -2325,13 +2328,16 @@ jobs:
- name: deps-vcpkg installs a manifest as an action, and planning installs nothing
run: bash .github/scripts/check-deps-and-qt.sh vcpkg-consumer

- name: deps-archive extracts a zip the project keeps and deploys its tree beside the program
run: bash .github/scripts/check-deps-and-qt.sh archive-consumer

- name: deps-vcpkg in two workspace members that share no dependency
run: bash .github/scripts/check-deps-and-qt.sh vcpkg-workspace

- name: deps-cmake builds a CMake subproject as an action and links it
run: bash .github/scripts/check-deps-and-qt.sh cmake-consumer

- name: rules-qt runs moc, rcc and lrelease, with the SDK from xim:qt
- name: rules-qt runs moc, rcc, lupdate and lrelease, with the SDK from xim:qt-base
run: bash .github/scripts/check-deps-and-qt.sh qt-consumer

# Windows and macOS: QtGui's dependencies are the system's there. On Linux
Expand Down
Loading
Loading