Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
7d0a8df
feat: pass $TARGET triple to crate at compile time
lima-limon-inc Nov 3, 2025
0eb3380
feat: initial TargetTriple implementation
lima-limon-inc Nov 4, 2025
52e6b2c
feat: add Artifacts to Component
lima-limon-inc Jan 12, 2026
0c974e8
feat: create lib and bin directories before executing the install script
lima-limon-inc Nov 4, 2025
db93ae5
feat: install_artifacts function
lima-limon-inc Jan 12, 2026
2947434
feat: add file// support for artifacts
lima-limon-inc Nov 5, 2025
0d2e6ce
refactor: move install_artifact to cargo script
lima-limon-inc Nov 5, 2025
f7c4a60
feat: obtain curl version from Cargo.toml instead of hardcoding it
lima-limon-inc Nov 6, 2025
4eab0d8
refactor: make installation pipeline more linear with booleans
lima-limon-inc Nov 6, 2025
04113b8
feat: save downloaded file in .tmp, then rename it when finished
lima-limon-inc Nov 6, 2025
af585d5
feat: fail in debug builds, continue in release mode
lima-limon-inc Nov 6, 2025
a2d94bc
feat: add artifact support in libraries
lima-limon-inc Nov 6, 2025
ce8aa71
refactor: simplify Triplet struct, use cargo's triplet output as-is
lima-limon-inc Nov 6, 2025
851d1bb
refactor: replace triplet - Artifact mapping in favor of URI list
lima-limon-inc Nov 14, 2025
ecd0363
refactor: add support for MidenVM artifacts (.masp Libraries)
lima-limon-inc Nov 14, 2025
0df687b
refactor: remove target from artifact, obtain it from the link itself
lima-limon-inc Nov 25, 2025
23fd7e4
refactor: remove Artifact::contains, in favor of Artifact::get_uri_for
lima-limon-inc Nov 25, 2025
43ef387
nit: remove pub indicator from Artifact
lima-limon-inc Nov 25, 2025
8877199
docs: expand Artifact documentation
lima-limon-inc Nov 25, 2025
a85fb79
feat: add debugger with its artifact URI
lima-limon-inc Jan 12, 2026
4d295a2
refactor: don't check if the name matches, only check the triplet
lima-limon-inc Jan 12, 2026
819ab9f
review: change debugger component name to "debug"
lima-limon-inc Jan 13, 2026
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
255 changes: 198 additions & 57 deletions Cargo.lock

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ upon = { version = "0.9.0", default-features = false, features = [
] }
colored = "3.0.0"

[build-dependencies]
cargo_toml = "0.22.3"

[dev-dependencies]
tempdir = "0.3.7"

Expand Down
28 changes: 28 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,34 @@
use std::process::Command;

use cargo_toml::Manifest;

fn main() {
let toml_contents = std::fs::read("Cargo.toml").expect("Failed to find Cargo.toml");
let manifest =
Manifest::from_slice(&toml_contents).expect("Failed to parse Cargo.toml as Manifest");
let curl_version = {
let curl = manifest
.dependencies
.get("curl")
.expect("Couldn't find curl in parsed manifest");
match curl {
cargo_toml::Dependency::Simple(ver) => ver,
cargo_toml::Dependency::Detailed(detail) => &detail.version.as_ref().unwrap().clone(),
// This case should not happen since we are reading the root Cargo.toml
cargo_toml::Dependency::Inherited(_) => {
panic!("Couldn't determine curl version since it appears as inherited.")
},
}
};
// Pass the $CURL_VERSION to the crate at compile time.
println!("cargo:rustc-env=CURL_VERSION={}", curl_version);

// Pass the $TARGET to the crate at compile time.
println!(
"cargo:rustc-env=TARGET={}",
std::env::var("TARGET").expect("Failed to obtain $TARGET triple constant.")
);

// Generated by cargo at runtime when the build script is run:
// https://doc.rust-lang.org/cargo/reference/environment-variables.html#environment-variables-cargo-sets-for-build-scripts
let build_script = std::env::var("OUT_DIR").unwrap();
Expand Down
9 changes: 9 additions & 0 deletions manifest/channel-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,15 @@
"aliases": {
"start-node": ["executable", "bundled", "start", "--data-directory", "var_path", "data", "--rpc.url", "http://0.0.0.0:57291"]
}
},
{
"name": "debug",
"package": "miden-debug",
"version": "0.4.4",
"installed_executable": "miden-debug",
"artifacts": [
"https://github.com/0xMiden/miden-debug/releases/download/v0.4.4/miden-debug-aarch64-apple-darwin"
]
}
]
}
Expand Down
66 changes: 66 additions & 0 deletions src/artifact.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
use serde::{Deserialize, Serialize};

/// All the artifacts that the [[Component]] contains.
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Artifacts {
artifacts: Vec<Artifact>,
}

impl Artifacts {
/// Get a URI to download an artifact that's valid for [target].
pub fn get_uri_for(&self, target: &TargetTriple) -> Option<String> {
self.artifacts.iter().find_map(|artifact| artifact.get_uri_for(target))
}
}

/// Holds a URI used to fetch an artifact. These URIs have the following format:
/// (https://|file://)<path>/<component name>(-<triplet>|.masp)
#[derive(Serialize, Deserialize, Debug, Clone)]
struct Artifact(String);

#[derive(Debug, PartialEq)]
pub enum TargetTriple {
/// Custom triplet used by cargo. Since we use the same triplets as cargo, we
/// simply copy them as-is, without any type of parsing.
Custom(String),
/// Used for .masp Libraries that are used in the MidenVM. Components that
/// have these libraries as artifacts only have one entry in
/// [[Artifacts::artifacts]].
MidenVM,
}

impl TargetTriple {
fn get_uri_extension(&self) -> String {
match &self {
Self::MidenVM => String::from(".masp"),
Self::Custom(triplet) => triplet.to_string(),
}
}
}

impl Artifact {
/// Returns the URI for the specified component + triplet if it has it.
///
/// NOTE: The component name is required to separate the triplet from the
/// filename in the URI.
fn get_uri_for(&self, target: &TargetTriple) -> Option<String> {
let path = if let Some(file_path) = self.0.strip_prefix("file://") {
file_path
} else if let Some(url_path) = self.0.strip_prefix("https://") {
url_path
} else {
return None;
};

// <component name>(-<triplet>|.masp)
let uri_extension = path.split("/").last()?;

let wanted_uri_extension = target.get_uri_extension();

if uri_extension.contains(&wanted_uri_extension) {
Some(self.0.clone())
} else {
None
}
}
}
24 changes: 23 additions & 1 deletion src/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::{
collections::HashMap,
fmt::{self, Display},
hash::{Hash, Hasher},
path::PathBuf,
path::{Path, PathBuf},
};

use anyhow::{Context, bail};
Expand All @@ -12,6 +12,7 @@ use serde::{Deserialize, Serialize};

use crate::{
Config,
artifact::{Artifacts, TargetTriple},
toolchain::{Toolchain, ToolchainJustification},
utils,
version::{Authority, GitTarget},
Expand Down Expand Up @@ -349,6 +350,14 @@ impl InstalledFile {
InstalledFile::Library { library_struct, .. } => Some(library_struct),
}
}
pub fn get_path_from(&self, toolchain_dir: &Path) -> PathBuf {
match &self {
exe @ InstalledFile::Executable { .. } => {
toolchain_dir.join("bin").join(exe.to_string())
},
lib @ InstalledFile::Library { .. } => toolchain_dir.join("lib").join(lib.to_string()),
}
}
}

impl Display for InstalledFile {
Expand Down Expand Up @@ -521,6 +530,12 @@ pub struct Component {
#[serde(default)]
#[serde(skip_serializing_if = "Option::is_none")]
symlink_name: Option<String>,
#[serde(default)]
#[serde(skip_serializing_if = "Vec::is_empty")]
pub initialization: Vec<String>,
/// Pre-built artifact.
#[serde(flatten)]
artifacts: Option<Artifacts>,
}

impl Component {
Expand All @@ -535,6 +550,8 @@ impl Component {
installed_file: None,
aliases: HashMap::new(),
symlink_name: None,
initialization: Vec::new(),
artifacts: None,
}
}

Expand Down Expand Up @@ -698,6 +715,11 @@ impl Component {
self.call_format.clone()
}
}

/// Returns the URI for a given [target] (if available).
pub fn get_artifact_uri(&self, target: &TargetTriple) -> Option<String> {
self.artifacts.as_ref().and_then(|artifacts| artifacts.get_uri_for(target))
}
}

/// User-facing channel reference. The main difference with this and [Channel]
Expand Down
Loading