Skip to content

Commit 160b1aa

Browse files
committed
Implemented something resembling offline mode.
This will address rust-lang#26 once we can merge this into master, until a `cargo` with offline mode hits stable/crates.io this branch can be used instead.
1 parent 0595417 commit 160b1aa

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ name = "rust-semver-public"
2727
path = "src/bin/rust_semver_public.rs"
2828

2929
[dependencies]
30-
cargo = "0.36"
30+
cargo = { git = "https://github.com/rust-lang/cargo", branch = "master" }
3131
crates-io = "0.24"
3232
curl = "0.4.21"
3333
env_logger = "0.6"

src/bin/cargo_semver.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ fn main() {
8383
&None, // color
8484
false, // frozen
8585
false, // locked
86-
// matches.opt_present("offline"),
86+
matches.opt_present("offline"),
8787
&None, // target_dir
8888
&[], // unstable_flags
8989
);
@@ -441,7 +441,10 @@ impl<'a> WorkInfo<'a> {
441441

442442
debug!("source id loaded: {:?}", source_id);
443443

444-
source.update()?;
444+
if !config.offline() {
445+
let _lock = config.acquire_package_cache_lock()?;
446+
source.update()?;
447+
}
445448

446449
Box::new(source)
447450
};

0 commit comments

Comments
 (0)