You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reworked WIT syncing to avoid retriggered builds on repeated cargo make build (#3670)
* Reworked WIT syncing to avoid retriggered builds on repeated `cargo make build`
* cleanups
* harden dir-mirror flag parsing
* test build tools as the "first step" before build, and not as a unit test
* portable diff-wit
* cleanups
Copy file name to clipboardExpand all lines: .agents/skills/modifying-wit-interfaces/SKILL.md
+7-6Lines changed: 7 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -82,15 +82,15 @@ Edit the relevant `.wit` file in the root `wit/` directory (e.g., `wit/host.wit`
82
82
cargo make wit
83
83
```
84
84
85
-
This removes all `wit/deps/`directories in sub-projects and re-copies the correct subset from the root.
85
+
This mirrors the correct subset of the root `wit/deps/`into each sub-project, idempotently (it rewrites only files whose bytes changed, so unchanged files keep their mtime — avoiding needless rebuilds).
86
86
87
87
### Step 3: Verify synchronization
88
88
89
89
```shell
90
90
cargo make check-wit
91
91
```
92
92
93
-
This re-runs the sync and then `git diff --exit-code witgolem-common/wit`to ensure the committed WIT files match what the sync produces. If this fails in CI, you forgot to run `cargo make wit` (or you hand-edited a generated sub-project copy).
93
+
This re-runs the sync and then `git status` over every per-crate `wit/deps` copy (golem-common, golem-cli, and all four SDKs) to ensure the committed WIT files match what the sync produces. CI runs this; if it fails, you forgot to run `cargo make wit` (or you hand-edited a generated sub-project copy).
94
94
95
95
### Step 4: Build and verify
96
96
@@ -110,10 +110,11 @@ truth — there is no `deps.toml` and nothing is fetched.
110
110
111
111
### Step 2: Wire it into the sync tasks
112
112
113
-
Edit `Makefile.toml` so the new package is copied where it's needed. The
114
-
`wit-sdks` task copies **all** root deps to every SDK automatically, but the
115
-
`wit-golem-common` and `wit-golem-cli` tasks copy an explicit subset — add a
116
-
`cp wit/deps/<package> <target>/wit/deps` line there if those crates need it.
113
+
Edit `Makefile.toml` so the new package is mirrored where it's needed. The
114
+
`wit-sdks` task mirrors **all** root deps to every SDK automatically, but the
115
+
`wit-golem-common` and `wit-golem-cli` tasks mirror an explicit subset — add a
116
+
`wit/deps/<package> <target>/wit/deps/<package>` source/target pair to the
# - `cargo make dev-flow` or just `cargo make`: runs a full development flow, including fixing format and clippy, building and running tests and generating OpenAPI specs
4
-
# - `cargo make wit`: fetches the WIT dependencies based on wit/deps.toml
5
-
# - `cargo make check-wit`: deletes then fetches the WIT dependencies based on wit/deps.toml, then checks if it's up-to-date
4
+
# - `cargo make wit`: syncs the per-crate wit/deps copies from the canonical top-level wit/deps
5
+
# - `cargo make check-wit`: re-syncs the per-crate wit/deps and fails if the committed copies are out of date
6
6
# - `cargo make build`: builds everything in debug mode
7
7
# - `cargo make build-release`: builds everything in release mode. customizable with PLATFORM_OVERRIDE env variable for docker builds
8
8
# - `cargo make check`: runs rustfmt and clippy checks without applying any fix
@@ -72,11 +72,17 @@ dependencies = [
72
72
]
73
73
74
74
# WIT DEPENDENCIES
75
+
#
76
+
# Sync the per-crate wit/deps copies from the canonical top-level wit/deps with the
77
+
# dir-mirror tool (dev-tools/dir-mirror) rather than cp: it preserves the mtime of
78
+
# unchanged files, so cargo (which tracks these .wit files via rerun-if-changed from
79
+
# bindgen!) doesn't rebuild the workspace on every run. The <source> <target> pairs
80
+
# below replace the old cp/glob_cp lines one-for-one. golem-common/cli take a per-subdir
81
+
# subset of the deps, so removing a dep means also removing its pair here.
75
82
[tasks.wit]
76
-
description = "Fetches the WIT dependencies based on wit/deps.toml"
83
+
description = "Syncs the per-crate WIT dependency copies from the canonical wit/deps"
0 commit comments