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
5 changes: 4 additions & 1 deletion .github/workflows/phone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ jobs:
timeout-minutes: 60
run: |
cargo test --locked -p octosense-wasm-host --no-run
cargo test --locked -p octosense-wasm-host --features pulley --no-run
cargo test --locked -p makepad-widgets --no-run
cargo test --locked -p makepad-script-std --no-run
- name: Test Wasm and runtime policy
Expand All @@ -196,7 +197,9 @@ jobs:
# Apps' WebAssembly functions: the runtime's own tests. The `wasm`
# service's (fresh state per call; resource, cancellation and
# admission bounds) run with the shell's above: `mobile-apps`
# includes `wasm-functions`.
# includes `wasm-functions`. Then the same tests in Pulley, the
# interpreter OpenHarmony and iOS use (ADR 0014).
cargo test --locked -p octosense-wasm-host
OCTOSENSE_WASM_PULLEY=1 cargo test --locked -p octosense-wasm-host --features pulley
cargo test --locked -p makepad-widgets splash_policy
cargo test --locked -p makepad-script-std gate::tests
50 changes: 50 additions & 0 deletions .github/workflows/wasm-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: WebAssembly on Windows

# Apps' own functions on Windows (ADR 0014): the runtime's tests
# (crates/wasm-host) and the shell compiled with the `wasm` service, which
# Windows desktop builds include. ci-local cannot run these (tools/ci_local.py,
# NOT_LOCAL), so a pull request that touches them merges on this run.

on:
push:
branches: [main]
pull_request:
paths:
- 'crates/wasm-host/**'
- 'crates/shell/src/wasm_service.rs'
- 'crates/shell/build.rs'
- 'crates/shell/Cargo.toml'
- 'Cargo.toml'
- 'Cargo.lock'
- '.github/workflows/wasm-windows.yml'

permissions:
contents: read

concurrency:
group: wasm-windows-${{ github.ref }}
cancel-in-progress: true

jobs:
windows:
runs-on: windows-2022
timeout-minutes: 55
env:
PYTHONUTF8: '1'
steps:
- name: Preserve runtime patch bytes
run: git config --global core.autocrlf false
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: '3.12'
- uses: dtolnay/rust-toolchain@stable
- run: python tools/setup.py
- uses: Swatinem/rust-cache@v2
with:
shared-key: wasm-windows
cache-on-failure: true
- name: The runtime's tests
run: cargo test --locked -p octosense-wasm-host
- name: The shell with the wasm service
run: cargo check --locked -p octosense-shell --features wasm-functions
39 changes: 34 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 8 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ octosense-reference = { path = "apps/reference" }
makepad-sheets = { git = "https://github.com/OctoSense-org/makepad.git", rev = "32d6415fb7476345ad36ee4f98d6f844d1f07fd2", default-features = false }
makepad-terminal = { git = "https://github.com/OctoSense-org/makepad.git", rev = "32d6415fb7476345ad36ee4f98d6f844d1f07fd2" }
octosense-appcard = { path = "apps/appcard/module" }
octosense-app-hub-app = { git = "https://github.com/OctoSense-org/OctoSense-App-Hub", rev = "28745c0f6fd71986820e9835183a3045f61baefc" }
octosense-app-hub-app = { git = "https://github.com/OctoSense-org/OctoSense-App-Hub", rev = "371f51aeb6ba90e9a214c5ddb6ccfc40a2e2a339" }
makepad-calculator = { git = "https://github.com/OctoSense-org/makepad.git", rev = "32d6415fb7476345ad36ee4f98d6f844d1f07fd2", default-features = false }
makepad-clock = { git = "https://github.com/OctoSense-org/makepad.git", rev = "32d6415fb7476345ad36ee4f98d6f844d1f07fd2", default-features = false }
makepad-notes = { git = "https://github.com/OctoSense-org/makepad.git", rev = "32d6415fb7476345ad36ee4f98d6f844d1f07fd2", default-features = false }
Expand Down Expand Up @@ -130,12 +130,12 @@ octoscript-makepad = { git = "https://github.com/OctoSense-org/Octoscript-Makepa
octoscript-node = { git = "https://github.com/OctoSense-org/Octoscript-Makepad.git", rev = "33dea2f1f3ad3f1346a219aa8cf6e91b31361e23" }
# --- App Hub's host service registry the Mail and llm services register
# into; the same revision as App Hub's app crate (a native app, above).
octosense-appstore = { git = "https://github.com/OctoSense-org/OctoSense-App-Hub", rev = "28745c0f6fd71986820e9835183a3045f61baefc" }
octosense-appstore = { git = "https://github.com/OctoSense-org/OctoSense-App-Hub", rev = "371f51aeb6ba90e9a214c5ddb6ccfc40a2e2a339" }
# The app policy (resolution, isolate settings, the Splash adapter) and the
# Hub client the Card runner resolves an app's policy with; the shell's
# glance tiles run cards under it (crates/shell/src/glance_card.rs).
octosense-app-policy = { git = "https://github.com/OctoSense-org/OctoSense-App-Hub", rev = "28745c0f6fd71986820e9835183a3045f61baefc" }
octosense-app-hub = { git = "https://github.com/OctoSense-org/OctoSense-App-Hub", rev = "28745c0f6fd71986820e9835183a3045f61baefc" }
octosense-app-policy = { git = "https://github.com/OctoSense-org/OctoSense-App-Hub", rev = "371f51aeb6ba90e9a214c5ddb6ccfc40a2e2a339" }
octosense-app-hub = { git = "https://github.com/OctoSense-org/OctoSense-App-Hub", rev = "371f51aeb6ba90e9a214c5ddb6ccfc40a2e2a339" }
# The app contract (ADR 0005), from crates.io by version: App Hub, the shell
# and Rinx all depend on `octosense-app-contract = "1"`, so Cargo links ONE
# 1.x for the whole build (Cargo.lock pins the exact version OctoSense ships)
Expand Down Expand Up @@ -313,9 +313,11 @@ log = "0.4"
# Developers' own functions compiled to WebAssembly, run for their app with
# a deadline and a memory cap (crates/wasm-host, ADR 0011). Cranelift compiles;
# no GC or threads. Components (ADR 0014) add the component model and a WASI
# 0.2 subset scoped to the app: `wasmtime-wasi`'s `p2` only.
# 0.2 subset scoped to the app: `wasmtime-wasi`'s `p2` only, and outgoing
# `wasi:http` to the app's own network hosts (rustls with ring, as the shell's).
wasmtime = { version = "49.0.2", default-features = false, features = ["cranelift", "runtime", "std", "parallel-compilation", "component-model"] }
wasmtime-wasi = { version = "49.0.2", default-features = false, features = ["p2"] }
wasmtime-wasi-http = { version = "49.0.2", default-features = false, features = ["p2", "default-send-request"] }

# Workspace-wide clippy policy for the crates that opt in (`[lints]
# workspace = true`, AppCard's): lints that are real but tracked elsewhere.
Expand Down Expand Up @@ -435,7 +437,7 @@ ruma = { git = "https://github.com/project-robius/ruma.git", branch = "tsp" }
# -i octos-core` still sees one octos source.
[patch.crates-io]
# Keep the contract identical to the pinned SDK for this release candidate.
octosense-app-contract = { git = "https://github.com/OctoSense-org/OctoSense-App-Hub", rev = "28745c0f6fd71986820e9835183a3045f61baefc" }
octosense-app-contract = { git = "https://github.com/OctoSense-org/OctoSense-App-Hub", rev = "371f51aeb6ba90e9a214c5ddb6ccfc40a2e2a339" }
nix = { git = "https://github.com/octos-org/octos.git", rev = "18fcd3f16e527d2b601d7ae244f056fb711bb6b8" }

# pdfcraft's bootstrap PDF stack: its workspace patches these five
Expand Down
13 changes: 7 additions & 6 deletions crates/shell/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,12 @@ octosense-calendar-service = { workspace = true }
octosense-ai-host = { workspace = true, features = ["llm"] }

# Apps' own WebAssembly functions (the `wasm` service, ADR 0011), compiled by
# Cranelift: only where an app may generate code and the runtime has been
# checked. Windows (not yet checked), iOS (no code generation for apps),
# OpenHarmony (its policy is unknown) and the browser leave it out; build.rs
# sets `wasm_functions` for the same targets.
[target.'cfg(any(target_os = "macos", target_os = "android", all(target_os = "linux", not(target_env = "ohos"))))'.dependencies]
# Cranelift where an app may generate code, and on OpenHarmony, until its
# policy is known, run in Pulley, Wasmtime's interpreter (ADR 0014; the
# runtime selects it there). Windows runs its tests in CI
# (.github/workflows/wasm-windows.yml). iOS (not yet built with it) and the
# browser leave it out; build.rs sets `wasm_functions` for the same targets.
[target.'cfg(any(target_os = "macos", target_os = "windows", target_os = "android", target_os = "linux"))'.dependencies]
octosense-wasm-host = { workspace = true, optional = true }

[features]
Expand Down Expand Up @@ -195,7 +196,7 @@ dev-mode = []
# The `wasm` host service (ADR 0011), which runs an app's own
# WebAssembly functions (crates/wasm-host). On in every standard shell
# build (tools/native_apps.py's BASE_DEFAULT); it runs where build.rs sets
# `wasm_functions`: macOS, Linux and Android.
# `wasm_functions`: macOS, Windows, Linux, Android and OpenHarmony.
wasm-functions = ["app-hub", "dep:octosense-wasm-host"]
# The feature's former name.
wasm-lab = ["wasm-functions"]
Expand Down
5 changes: 3 additions & 2 deletions crates/shell/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
//! `cfg!(native_mobile)`, never as the feature or the targets directly.
//!
//! `wasm_functions` marks a build that runs the `wasm` service (ADR 0011):
//! feature `wasm-functions` on macOS, Linux or Android, the targets
//! feature `wasm-functions` on macOS, Windows, Linux, Android or OpenHarmony
//! (there in Pulley, Wasmtime's interpreter: ADR 0014), the targets
//! Cargo.toml links its runtime for. Code reads `#[cfg(wasm_functions)]`.
//!
//! `dev_mode` marks a development build (ADR 0004 §13, `src/dev_mode.rs`):
Expand All @@ -35,7 +36,7 @@ fn main() {
println!("cargo:rustc-cfg=mobile_only");
}
println!("cargo:rustc-check-cfg=cfg(wasm_functions)");
let wasm_target = target_os == "macos" || target_os == "android" || (target_os == "linux" && target_env != "ohos");
let wasm_target = matches!(target_os.as_str(), "macos" | "windows" | "android" | "linux");
if wasm_target && std::env::var_os("CARGO_FEATURE_WASM_FUNCTIONS").is_some() {
println!("cargo:rustc-cfg=wasm_functions");
}
Expand Down
3 changes: 3 additions & 0 deletions crates/shell/src/host_tools/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ pub fn pump() {
let Ok(_pump) = PUMP.try_lock() else { return };
#[cfg(any(feature = "app-hub", native_mobile))]
script_apps::poll();
// Components' calls to their apps' host services (ADR 0014).
#[cfg(wasm_functions)]
crate::wasm_service::pump_host_calls();
for _ in 0..8 {
let events = std::mem::take(&mut *INBOX.lock().unwrap_or_else(|e| e.into_inner()));
if events.is_empty() {
Expand Down
3 changes: 3 additions & 0 deletions crates/shell/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6326,6 +6326,9 @@ impl MatchEvent for App {
self.installed_app_changed(cx, &id);
// Its tools, grants and kernel tools, as installed (ADR 0004 §7).
host_tools::script_app_installed(&id);
// Its own functions, compiled before its first call (ADR 0014).
#[cfg(wasm_functions)]
wasm_service::warm(&id);
}
self.drain_hub(cx);
self.drain_client_lines(cx);
Expand Down
Loading
Loading