The slicer takes the slice's features (slice, lint, Source::closure/slice/lint; `--features` on the CLI). For each root package they are resolved through the root's own [features] with no default features: `dep:x` and `x/f` turn on the optional dependency x, `x?/f` does not, a plain name is a feature of the table (followed transitively) or the implicit feature of an optional dependency that no feature names as `dep:x`; a feature applies to every root that has it and one no root has is an error. Only a root's optional dependencies are filtered: which features a build enables in other crates is not followed, so their optional dependencies are all still sliced (the safe side). Cargo reads the manifest of every path dependency, optional or not, to load the workspace, so each optional dependency of a root that the features leave off (and that lies in the repository) ships as a placeholder package in its directory instead of its source: the package's name, version and feature names (so features naming it still resolve), no dependencies, an empty library, never built and not a member of the slice (Slice::placeholders, placeholder_manifest). Crate gains `version`, `optional`, `required` and `features`, with has_feature/enabled_optional/enabled_deps. Releases name no features (the server's source.json has none), so the CI slice tile, the Builder's publish and the server cut slices with none (tools/ci's smoke::SLICE_FEATURES), the tile's cargo check of the slice checkout now runs with --no-default-features, as the Builder builds it (with default features it would ask for the code behind Scope's `internal`, whose crates are placeholders), and the tile's summary names the placeholders. slices.json keeps its app -> roots lists: with no release features there is nothing more to say there. Checked on the Linux node: cargo test --release -p makepad-source-slice 10 passed (new: a root's optional dependency behind a default feature is left out; features turn it on through `dep:x` in a target table, `x/f`, an implicit feature and a chain of features, `x?/f` does not, an optional dependency named by `dep:` has no implicit feature, unknown features are refused, two roots; the slice's files, placeholders (manifest, empty library, its own optional dependency not followed) and members manifest follow; the fixture's Amp keeps milkdrop required and milkdrop's own dependency is optional, still followed); cargo test --release -p makepad-ci 50 passed; cargo check --release --all-targets -p makepad-source-slice -p makepad-ci -p makepad-loader clean. Scope's slice of makepad/commercial 1ba72d9 (Scope's `internal`): 5 crates (makepad-scope, code-atlas, code-graph, code-view, scope-worktrees) and 6 placeholders (agent-activity, scope-agents, scope-agents-ui, scope-history-index, lane-rows, lane-summaries), 451 files, 12.1 MB, lint clean; materialised into a Makepad checkout at apps/commercial, cargo check --release -p makepad-scope --no-default-features passes without warnings. Without the placeholders Cargo refused the workspace (the optional dependency's manifest missing). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
28 lines
990 B
Text
28 lines
990 B
Text
// One licensed app's slice of the commercial repository ships complete.
|
|
// tools/ci adds this script once per entry of apps/commercial/slices.json
|
|
// (`slice:<app>` tiles) with that entry's app and roots. The slice of the
|
|
// tested commercial commit is what the server packs for that license: the
|
|
// Cargo path-dependency closure of the roots as a release builds them (no
|
|
// default features, so a root's optional crates behind them stay out), their
|
|
// declared includes and a generated members Cargo.toml. It goes into a clean
|
|
// checkout of the tested Makepad commit at apps/commercial, as a customer's
|
|
// Builder has it, and is checked there with --no-default-features.
|
|
|
|
use mod.std.*
|
|
use mod.ci;
|
|
|
|
ci.step("slice", fn(){
|
|
ci.slice_checkout()
|
|
})
|
|
|
|
// References outside a crate (include_str!, crate_resource, build scripts)
|
|
// must be in its [package.metadata.commercial] include.
|
|
ci.step("lint", fn(){
|
|
ci.slice_lint()
|
|
})
|
|
|
|
ci.step("cargo check", fn(){
|
|
ci.slice_check()
|
|
})
|
|
|
|
nil
|