Skip to content

Commit

Permalink
fix misguided attempt to disambiguate version specifiers
Browse files Browse the repository at this point in the history
The problem is the original way of specifying crates for remote
download is the same that Rust uses to specify a version of a crate
(e.g. the @ symbol), and so I could not differentiate between the
two cases.

Switch to using a ^ symbol for remote download crates. Hopefully
that doesn't have conflicts??
  • Loading branch information
bunnie committed Jan 31, 2024
1 parent b6133bf commit d03fbfe
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions xtask/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ impl CrateSpec {
}
impl From<&str> for CrateSpec {
fn from(spec: &str) -> CrateSpec {
// remote crates are specified as "name@version", i.e. "xous-names@0.9.9"
if spec.contains('@') {
let (name, version) = spec.split_once('@').expect("couldn't parse crate specifier");
// remote crates are specified as "name^version", i.e. "xous-names^0.9.9"
if spec.contains('^') {
let (name, version) = spec.split_once('^').expect("couldn't parse crate specifier");
CrateSpec::CratesIo(name.to_string(), version.to_string(), false)
// prebuilt crates are specified as "name#url"
// i.e. "espeak-embedded#https://ci.betrusted.io/job/espeak-embedded/lastSuccessfulBuild/artifact/target/riscv32imac-unknown-xous-elf/release/"
Expand Down Expand Up @@ -331,27 +331,18 @@ impl Builder {
false
}

/// Add just one service. Services can only be local.
/// Add just one service
pub fn add_service<'a>(&'a mut self, service_spec: &str, xip: bool) -> &'a mut Builder {
let spec = CrateSpec::Local(service_spec.to_owned(), xip);
self.services.push(spec);
self
}

/// Add just one service. This one, if it contains the `@` specifier, will be interpreted as a crates.io
/// domiciled service
#[allow(dead_code)]
pub fn add_remote_service<'a>(&'a mut self, service_spec: &str, xip: bool) -> &'a mut Builder {
let mut spec: CrateSpec = service_spec.into();
spec.set_xip(xip);
self.services.push(spec);
self
}

/// Add a list of services. Services can only be local.
/// Add a list of services
pub fn add_services<'a>(&'a mut self, service_list: &Vec<String>) -> &'a mut Builder {
for service in service_list {
self.services.push(CrateSpec::Local(service.to_string(), false));
self.services.push(service.as_str().into());
}
self
}
Expand Down

0 comments on commit d03fbfe

Please sign in to comment.