Skip to content

Commit 75c66d4

Browse files
committed
build(cli-rs): pin OpenTUI by git rev
opentui-rust is frozen at 5fb3c6e and its tree now lives in packages/rust of anomalyco/opentui (PR #1946). Take the crates from there at the merge commit instead of the local checkout. The deps guard reads OpenTUI's source from the workspace's opentui dependency, so it also passes when the gate swaps in an OpenTUI worktree by path.
1 parent dfdf44e commit 75c66d4

4 files changed

Lines changed: 19 additions & 18 deletions

File tree

‎packages/cli-rs/.cargo/config.toml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Native OpenTUI artifacts that match opentui-rust's bindings, in the shared directory that
2-
# native-hardening's abi-artifacts.py keeps at opentui-rust's pin. A value set in the shell wins.
1+
# Native OpenTUI artifacts whose opentui.h matches the bindings at the client's OpenTUI `rev`, in the shared
2+
# directory that native-hardening's abi-artifacts.py fills from that `rev`. A value set in the shell wins.
33
[env]
44
OPENTUI_LIB_DIR = { value = "/home/simon/.cache/opentui-native/x86_64-linux", force = false }

‎packages/cli-rs/Cargo.lock‎

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎packages/cli-rs/Cargo.toml‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ opencode-tui = { path = "crates/tui" }
2929
opencode-ui = { path = "crates/ui" }
3030
opencode-util = { path = "crates/util" }
3131

32-
# The local opentui-rust checkout on main; see README.md for the native library.
33-
opentui = { path = "/home/simon/src/opentui-rust/crates/opentui", features = ["static", "tokio", "tree-sitter"] }
32+
# OpenTUI's Rust crates (`packages/rust` of anomalyco/opentui), pinned by commit. The checkout has no native library;
33+
# see README.md.
34+
opentui = { git = "https://github.com/anomalyco/opentui", rev = "ee25e46b1d1615950275688147464fe70a924069", features = ["static", "tokio", "tree-sitter"] }
3435

3536
# Expected third-party crates, declared once so steps rarely edit manifests. A crate takes one with
3637
# `name.workspace = true` and adds features with `features = [...]`.

‎packages/cli-rs/crates/cli/tests/deps.rs‎

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ const SECTIONS: [&str; 2] = ["[tests]", "[optional]"];
1818

1919
/// OpenTUI's packages, first-party when they come from where the workspace takes OpenTUI.
2020
const OPENTUI: [&str; 2] = ["opentui", "opentui-sys"];
21-
/// `None`: the opentui-rust checkout the workspace's `opentui` path dependency is in. When the client pins OpenTUI by
22-
/// git `rev` (O-63), this becomes `Some("git+https://github.com/anomalyco/opentui")`.
23-
const OPENTUI_GIT: Option<&str> = None;
2421

2522
type Graph = BTreeMap<String, BTreeSet<&'static str>>;
2623

@@ -145,20 +142,21 @@ fn graph(manifest: &Path, metadata: &Value, selection: &[&str]) -> Graph {
145142
graph
146143
}
147144

148-
/// The package ID prefix of OpenTUI's packages: the git repository, or the root of the checkout the workspace's
149-
/// `opentui` path dependency is in (its `crates/opentui`, two levels down).
145+
/// The package ID prefix of OpenTUI's packages, from the workspace's `opentui` dependency: its git source and `rev`,
146+
/// or, for a path, the directory above its `crates/opentui` (an OpenTUI worktree's `packages/rust`).
150147
fn opentui_source(metadata: &Value) -> String {
151-
if let Some(url) = OPENTUI_GIT {
152-
return format!("{url}?");
153-
}
154-
let path = metadata["packages"]
148+
let dep = metadata["packages"]
155149
.as_array()
156150
.unwrap()
157151
.iter()
158152
.flat_map(|p| p["dependencies"].as_array().unwrap())
159-
.find_map(|dep| (dep["name"] == "opentui").then(|| dep["path"].as_str()).flatten())
160-
.expect("a workspace member takes opentui by path");
161-
let root = Path::new(path).parent().and_then(Path::parent).expect("opentui is at <checkout>/crates/opentui");
153+
.find(|dep| dep["name"] == "opentui")
154+
.expect("a workspace member takes opentui");
155+
if let Some(source) = dep["source"].as_str() {
156+
return format!("{source}#");
157+
}
158+
let path = dep["path"].as_str().expect("opentui comes from git or a path");
159+
let root = Path::new(path).parent().and_then(Path::parent).expect("opentui is at <root>/crates/opentui");
162160
format!("path+file://{}/", root.display())
163161
}
164162

0 commit comments

Comments
 (0)