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
23 changes: 0 additions & 23 deletions rust/Cargo.lock

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

11 changes: 5 additions & 6 deletions rust/contracts/application-boundary.md
Original file line number Diff line number Diff line change
Expand Up @@ -429,19 +429,18 @@ replace those channels or swallow real source changes mixed with build output.
Run configuration behavior is exposed through the `runConfig.*` commands.
Platform clients coordinate inspection, generation, resolution, typed document
edits, and launch planning, but must not implement a second JSON merger,
toolchain matcher, ID generator, or argument parser. Ecosystem-specific
ID generator, or argument parser. Ecosystem-specific
arguments are built by the plugin that declared the run. Opening a project inspects existing files without writing; generation
is an explicit user action. Shared project overrides stay in
`.lithe/run/configurations.json`. Machine-local overrides may live in
`.lithe/run/local.json` or in a host-owned document supplied as
`localDocument`; absolute toolchain paths belong only in that local layer and
are excluded from project visibility and Git by default. Generic runtime
executables such as Node are selected in `.lithe/toolchains/local.json`; this
machine-local document is also excluded from Git by default. Missing or
incompatible toolchains block only configurations that consume the affected
toolchain, while diagnostics without a configuration ID apply to the project.
Runtime consumption is declared by the detector from the actual command rather
than inferred from the provider namespace. An automatically discovered runtime
machine-local document is also excluded from Git by default. Core discovers
no runnable entries and infers no runtime: generated configurations are the runs
build provider plugins declare, and a runtime binding is one a saved
configuration declares. An automatically discovered runtime
path is session-effective: validation and launch share it, but persistence
still requires an explicit user selection.

Expand Down
11 changes: 1 addition & 10 deletions rust/contracts/run-configuration-v2.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,8 @@
"version": { "const": 2 },
"generator": {
"type": "object",
"required": ["fingerprint"],
"properties": {
"fingerprint": { "type": "string", "pattern": "^sha256:" },
"providerFingerprint": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
"providerRunFingerprint": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
"unreadablePaths": { "type": "array", "items": { "type": "string" }, "uniqueItems": true },
"inputs": {
"type": "object",
"propertyNames": { "type": "string", "minLength": 1 },
"additionalProperties": { "type": "string", "pattern": "^(sha256:.+|path)$" }
}
"providerRunFingerprint": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" }
},
"additionalProperties": false
},
Expand Down
177 changes: 69 additions & 108 deletions rust/contracts/rust-core-api.md

Large diffs are not rendered by default.

28 changes: 0 additions & 28 deletions rust/contracts/toolchain-requirements-v1.schema.json

This file was deleted.

2 changes: 1 addition & 1 deletion rust/crates/core/src/protocol/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ pub enum RunConfigCommand {
Inspect,
/// Reads effective saved tool paths for one Provider root (`runConfig.projectToolchain`).
ProjectToolchain,
/// Regenerates detected run configurations (`runConfig.generate`).
/// Regenerates the provider run configurations (`runConfig.generate`).
Generate,
/// Formats argument vectors as reversible editor text (`runConfig.argumentText`).
ArgumentText,
Expand Down
79 changes: 32 additions & 47 deletions rust/crates/core/src/tests/build_systems.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,23 +190,6 @@ fn detect(workspace: &TemporaryWorkspace, manifests: Vec<Value>, options: Value)
outcome["detection"].clone()
}

fn generated_configurations(workspace: &TemporaryWorkspace) -> Vec<Value> {
let response: Value = serde_json::from_str(&crate::execute_json(
&json!({
"id": "generate",
"command": "runConfig.generate",
"payload": { "root": workspace.root() },
})
.to_string(),
))
.unwrap();
assert_eq!(response["ok"], true, "{response}");
response["data"]["generated"]["configurations"]
.as_array()
.cloned()
.unwrap()
}

fn instance<'a>(detection: &'a Value, id: &str) -> &'a Value {
detection["instances"]
.as_array()
Expand Down Expand Up @@ -367,9 +350,6 @@ fn instance_options_drive_static_run_entries_without_crossing_roots_or_scopes()
assert_eq!(options["options"]["options"][0]["scope"], "instance");
}

/// The Cargo plugin reproduces the built-in Cargo detector's run entries
/// field for field, so moving Cargo onto the plugin model keeps every stored
/// run configuration.
#[test]
fn provider_test_reports_are_inline_bounded_and_keep_project_identity() {
let workspace = TemporaryWorkspace::new("provider-test-reports");
Expand Down Expand Up @@ -537,9 +517,11 @@ fn opaque_test_selectors_require_a_declared_namespace_and_never_become_host_filt
);
}

/// A static-file provider plans one run entry per binary target, carrying the
/// root, command and source each entry needs, beside the rest of the model.
#[test]
fn cargo_run_entries_match_the_builtin_detector() {
let workspace = TemporaryWorkspace::new("build-cargo-parity");
fn static_cargo_model_plans_a_run_entry_per_binary_target() {
let workspace = TemporaryWorkspace::new("build-cargo-run-entries");
workspace
.write(
"rust/Cargo.toml",
Expand All @@ -561,32 +543,35 @@ fn cargo_run_entries_match_the_builtin_detector() {
.iter()
.flat_map(|instance| instance["model"]["run"].as_array().unwrap().clone())
.collect();
let mut builtin: Vec<Value> = generated_configurations(&workspace)
.into_iter()
.filter(|configuration| configuration["provider"] == "cargo.binary")
.collect();
planned.sort_by_key(|entry| entry["id"].to_string());
builtin.sort_by_key(|entry| entry["id"].to_string());
assert_eq!(planned.len(), 3, "{planned:?}");
assert_eq!(planned.len(), builtin.len(), "{planned:?} vs {builtin:?}");
for (plan, configuration) in planned.iter().zip(&builtin) {
for field in [
"id",
"name",
"provider",
"execution",
"command",
"args",
"cwd",
"env",
"source",
"extensions",
] {
assert_eq!(
plan[field], configuration[field],
"{field}: {plan} vs {configuration}"
);
}
let expected = [
("rust", "rust-app", "cargo:rust/rust-app"),
("tools", "gen", "cargo:tools/tools"),
("tools", "lint", "cargo:tools/tools"),
];
assert_eq!(planned.len(), expected.len(), "{planned:?}");
for (entry, (root, bin, project)) in planned.iter().zip(expected) {
assert_eq!(entry["id"], format!("cargo.binary:{root}/{bin}"), "{entry}");
assert_eq!(entry["name"], bin, "{entry}");
assert_eq!(entry["provider"], "cargo.binary", "{entry}");
assert_eq!(entry["execution"], "application", "{entry}");
assert_eq!(entry["command"], "cargo", "{entry}");
assert_eq!(entry["args"], json!(["run", "--bin", bin]), "{entry}");
assert_eq!(entry["cwd"], root, "{entry}");
assert_eq!(entry["env"], json!({}), "{entry}");
assert_eq!(entry["source"], format!("{root}/Cargo.toml"), "{entry}");
assert_eq!(
entry["extensions"],
json!({"cargo": {"bin": bin}}),
"{entry}"
);
assert_eq!(entry["buildSystem"]["root"], root, "{entry}");
assert_eq!(entry["buildSystem"]["projectID"], project, "{entry}");
assert_eq!(
entry["buildSystem"]["targetID"],
format!("cargo.application:{root}/{bin}"),
"{entry}"
);
}

let rust = instance(&detection, "cargo:rust");
Expand Down
Loading
Loading