nigig-org/crates/pageflipnav/makepad-superapp-depth1-check.md

111 lines
5.9 KiB
Markdown

# Makepad super-app + depth-1 `work` checkout — repo check (2026-09-25)
Checked `makepad/makepad` @ branch `work` (verified by doing a real `--depth 1`
clone of `work`: 423 MB / 8,238 files, HEAD `5f99533 "Merge branch 'wm-fixes'
into work"`).
## Short answer
**Yes on both counts, but they are two different crates.**
- The **super-app** is `apps/wm` (`makepad-wm`) and its two siblings
`apps/wm-all` (`makepad-wm-all`, iOS/in-process) and `apps/wm-dyn`
(`makepad-wm-dyn`, Android, apps compiled on the phone).
- The **depth-1 shallow clone of `work`** is *not* inside the super-app. It
lives in the installer/bootstrap: `tools/makepad_builder` (crate
`makepad-loader`, bins `makepad-builder` / `makepad-builder-cli`).
## The super-app
| Crate | What it is |
| --- | --- |
| `apps/wm` → `makepad-wm` | The desk / window manager. Nested mode: wm owns one OS window, hosts every app in the checkout as child processes over the studio protocol. Library for the other two. |
| `apps/wm-all` → `makepad-wm-all` | iOS + web build: same desk, every app linked in as a MODULE (`libs/app_module`), one splash isolate each, drawn into the desk's own texture. |
| `apps/wm-dyn` + `apps/wm-dyn/engine` | **Android super-app**: apps are *not* linked in. Opening a tile runs `cargo rustc --crate-type dylib` against the packaged checkout and `dlopen`s it into `ModuleHost`. Whole graph built with `RUSTFLAGS="-C prefer-dynamic"` so the engine is one shared dylib. Packed by `cargo makepad android dyn-pack`. |
wm itself never clones anything. It finds a checkout by
`MAKEPAD_WM_ROOT`, else the checkout above the running exe
(`target/<profile>/wm`), else the checkout at/above cwd —
`apps/wm/src/clients.rs:341-362`.
On Android the tree is not cloned at all: it ships inside the APK.
`tools/cargo_makepad/src/android/dyn_pack/stage.rs` stages a *relocatable*
tree (git-tracked + untracked-not-ignored files of every reachable package,
registry crates vendored and re-pointed as `[patch.crates-io]` PATH packages,
mtimes normalised), and `libs/ondevice_build::provision`
(`libs/ondevice_build/src/lib.rs:139`) unpacks toolchain + checkout +
cross-built `target/` into the app's files dir on first tile open
(`apps/wm/src/dylib_host.rs:458-460`), with a stamp for once-per-pack runs.
## The depth-1 `work` clone
`tools/makepad_builder/src/gitclone.rs:11` — `clone_depth1(url, dest, branch)`:
1. `info/refs` → resolve HEAD/branch
2. `upload-pack` with depth `Some(1)` (prints `git upload-pack depth=1`, line 52)
3. `apply_pack_and_checkout` → write files + index
4. clones into a temp sibling `.{name}.clone-tmp`, then renames into place;
refuses to overwrite an existing directory that is not a complete checkout
Defaults (`tools/makepad_builder/src/lib.rs:45-46`):
```rust
git_url: "https://github.com/makepad/makepad".to_string(),
branch: Some("work".to_string()),
```
Progress line `lib.rs:222` — `clone {} (depth 1, work)`; call at `lib.rs:225`
(`--skip-git` reuses an existing checkout, `--branch NAME` overrides).
The CLI (`makepad-builder-cli`) accepts `--root/--git/--branch/-p
[--skip-git|--skip-build|--skip-cuda]`.
Underneath it uses the repo's own pure-Rust git stack `libs/git`:
- `libs/git/src/http_sync.rs:327-369` — `deepen <n>` negotiation, `shallow`
capability check, shallow-boundary aware walks
- `libs/git/src/clone.rs:100` — `local_clone_depth1` (local depth-1 clone via
git alternates, parallel blob checkout)
- `libs/git/src/http_checkout.rs` — bounded parallel checkout writers
Distribution/identity layer: `libs/loader_bundle` — a `makepad-builder.json`
bootstrap (email + app name) that gets streamed into a personalised ZIP
("Makepad Loader"), used by `makepad-loader`/`makepad-builder`.
## What is *not* there yet (vs. the rikarends chat plan)
- **No login / entitlement / commercial-app gating.** Grep for
`license|entitlement|signin|account|commercial|paid|purchase` across
`apps/wm`, `libs/workspace`, `libs/app_module`, `libs/wm_api`,
`libs/ondevice_build` → nothing (only demo invoice text in
`apps/wm/src/demo_home.rs:73`). "Run the makepad app, log in, get access to
commercial apps" is not implemented.
- **No crates.io publishing of the super-app.** `makepad-wm` is a path-only
workspace member; every `crates.io` mention in the tree is a dependency
reference. The in-tree distribution path is makepad-builder (depth-1 git +
toolchain provisioning) plus the Android dyn-pack.
- **wm does not fetch more apps over the network at runtime.** Extra apps must
already be in its checkout; the optional private ones
(`apps/scope`, `apps/sandbox`, `apps/source-library`, `apps/stage`,
`libs/terminal_core`, `libs/ai`, …) are `workspace.exclude` entries and are
hand-cloned. So the "super app does the rest using a shallow git checkout"
idea is currently the *builder's* job, done once at install time, not a
runtime feature of the app.
- No `cargo install makepad`-style entry point; the two entry points are
`makepad-builder` / `makepad-builder-cli` and `cargo makepad`
(`tools/cargo_makepad`).
## Key files
```
apps/wm/src/clients.rs:341 checkout root resolution (MAKEPAD_WM_ROOT / exe / cwd)
apps/wm/src/dylib_host.rs:1 Android super-app on-device dylib host + provisioning
apps/wm/src/apps.rs:58 super-app lists packaged crates before the checkout exists
apps/wm-dyn/Cargo.toml:1 Android super-app header comment (design + pack command)
tools/makepad_builder/src/gitclone.rs:11 clone_depth1()
tools/makepad_builder/src/lib.rs:45 default url + branch "work"
libs/git/src/http_sync.rs:327 depth/deepen negotiation
libs/git/src/clone.rs:100 local_clone_depth1
libs/ondevice_build/src/lib.rs:139 provision() (APK assets → files dir)
tools/cargo_makepad/src/android/dyn_pack/stage.rs:1 relocatable staged checkout
libs/loader_bundle/src/lib.rs makepad-builder.json bootstrap + ZIP personalisation
```