Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated dependencies #95

Merged
merged 1 commit into from
Jan 13, 2020
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
337 changes: 202 additions & 135 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions cargo-dinghy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ travis-ci = { repository = "snipsco/dinghy" }

[dependencies]
dinghy-lib = { path = "../dinghy-lib" }
error-chain = "0.11"
error-chain = "0.12"
log = "0.4"
pretty_env_logger = "0.3"
clap = "2.32"
cargo = "0.32"
cargo = "0.41"
itertools = "0.8"
2 changes: 1 addition & 1 deletion dinghy-build/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ categories = [ "development-tools::cargo-plugins", "development-tools::testing"

[dependencies]
bindgen = { version = "0", optional = true }
error-chain = { version = "0.11.0", default-features = false }
error-chain = { version = "0.12.0", default-features = false }
cc = "1"
log="0.4"

Expand Down
15 changes: 8 additions & 7 deletions dinghy-lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,28 @@ readme = "../README.md"
[dependencies]
dinghy-build = { path = "../dinghy-build" }
dirs = "1.0.4"
error-chain = "0.11"
error-chain = "0.12"
failure = "0.1.6"
filetime = "0.2"
log = "0.4"
pretty_env_logger = "0.3"
clap = "2.32"
cargo = "0.32"
clap = "2.33"
cargo = "0.41"
atty = "0.2"
itertools = "0.8"
plist = "0.4"
plist = "0.5"
regex = "1.0"
json = "0.11"
ignore = "0.4"
serde = "1.0"
serde_derive = "1.0"
toml = "0.4"
toml = "0.5"
shell-escape = "0.1"
walkdir = "2.0"
which = "2.0"
which = "3.0"

[target.'cfg(target_os="macos")'.dependencies]
core-foundation = "0.5"
core-foundation-sys = "0.5"
libc = "=0.2.64" # 0.2.65 can not download from crates
libc = "0.2.66"
tempdir = "0.3"
63 changes: 43 additions & 20 deletions dinghy-lib/src/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use cargo::core::compiler as CargoCoreCompiler;
use cargo::core::compiler::Compilation;
pub use cargo::core::compiler::CompileMode;
use cargo::core::compiler::MessageFormat;
use cargo::core::compiler::ProfileKind;
use cargo::core::Workspace;
use cargo::ops as CargoOps;
use cargo::ops::CleanOptions;
Expand Down Expand Up @@ -112,15 +113,21 @@ fn create_build_command(
let lib_only = matches.is_present("LIB");
let no_default_features = matches.is_present("NO_DEFAULT_FEATURES");
let packages = arg_as_string_vec(matches, "SPEC");

let release = matches.is_present("RELEASE");
let offline = matches.is_present("OFFLINE");
let verbosity = matches.occurrences_of("VERBOSE") as u32;
let tests = arg_as_string_vec(matches, "TEST");
let bearded = matches.is_present("BEARDED");

Box::new(move |rustc_triple: Option<&str>, build_args: &BuildArgs| {
let release = build_args.compile_mode == CompileMode::Bench || release;
let profile_kind = if release {
ProfileKind::Release
} else {
ProfileKind::Dev
};
let mut config = CompileConfig::default()?;
config.configure(verbosity, None, &None, false, false, &None, &[])?;
config.configure(verbosity, None, &None, false, false, offline, &None, &[])?;
let workspace = Workspace::new(&find_root_manifest_for_wd(&current_dir()?)?, &config)?;

let project_metadata_list = workskpace_metadata(&workspace)?;
Expand Down Expand Up @@ -155,7 +162,7 @@ fn create_build_command(
};

let build_config = CargoCoreCompiler::BuildConfig {
release,
profile_kind,
message_format: MessageFormat::Human,
..CargoCoreCompiler::BuildConfig::new(
&config,
Expand All @@ -172,7 +179,7 @@ fn create_build_command(
all_features,
no_default_features,
spec: CompilePackages::from_flags(all, excludes, packages)?,
filter: CompileFilter::new(
filter: CompileFilter::from_raw_arguments(
lib_only,
bins.clone(),
false,
Expand Down Expand Up @@ -203,16 +210,32 @@ fn create_build_command(
fn create_clean_command(matches: &ArgMatches) -> Box<dyn Fn(Option<&str>) -> Result<()>> {
let packages = arg_as_string_vec(matches, "SPEC");
let release = matches.is_present("RELEASE");
let offline = matches.is_present("OFFLINE");
let verbosity = matches.occurrences_of("VERBOSE") as u32;

Box::new(move |rustc_triple: Option<&str>| {
let mut config = CompileConfig::default()?;
config.configure(verbosity, None, &None, false, false, &None, &[])?;
config.configure(
verbosity,
None,
&None,
false,
false,
offline,
&None,
&[],
)?;
let workspace = Workspace::new(&find_root_manifest_for_wd(&current_dir()?)?, &config)?;
let profile_kind = if release {
ProfileKind::Release
} else {
ProfileKind::Dev
};

let options = CleanOptions {
config: &config,
release,
profile_specified: false,
profile_kind,
spec: packages.clone(),
target: rustc_triple.map(str::to_string),
doc: false,
Expand Down Expand Up @@ -242,16 +265,17 @@ fn create_run_command(
let lib_only = matches.is_present("LIB");
let no_default_features = matches.is_present("NO_DEFAULT_FEATURES");
let packages = arg_as_string_vec(matches, "SPEC");

let release = matches.is_present("RELEASE");
let verbosity = matches.occurrences_of("VERBOSE") as u32;
let tests = arg_as_string_vec(matches, "TEST");
let bearded = matches.is_present("BEARDED");
let offline = matches.is_present("OFFLINE");

Box::new(
move |rustc_triple: Option<&str>, build_args: &BuildArgs, args: &[&str]| {
let release = build_args.compile_mode == CompileMode::Bench || release;
let mut config = CompileConfig::default()?;
config.configure(verbosity, None, &None, false, false, &None, &[])?;
config.configure(verbosity, None, &None, false, false, offline, &None, &[])?;
let workspace = Workspace::new(&find_root_manifest_for_wd(&current_dir()?)?, &config)?;

let project_metadata_list = workskpace_metadata(&workspace)?;
Expand All @@ -264,9 +288,14 @@ fn create_run_command(
} else {
excludes.clone()
};
let profile_kind = if release {
ProfileKind::Release
} else {
ProfileKind::Dev
};

let build_config = CargoCoreCompiler::BuildConfig {
release,
profile_kind,
message_format: MessageFormat::Human,
..CargoCoreCompiler::BuildConfig::new(
&config,
Expand All @@ -283,7 +312,7 @@ fn create_run_command(
all_features,
no_default_features,
spec: CompilePackages::from_flags(all, excludes, packages.clone())?,
filter: CompileFilter::new(
filter: CompileFilter::from_raw_arguments(
lib_only,
bins.clone(),
false,
Expand Down Expand Up @@ -316,10 +345,7 @@ fn create_run_command(
if let Some(err) = CargoOps::run_benches(
&workspace,
&test_options,
args.into_iter()
.map(|it| it.to_string())
.collect_vec()
.as_slice(),
args,
)? {
bail!("An error occured: {:?}", err);
};
Expand All @@ -329,7 +355,7 @@ fn create_run_command(
&workspace,
&test_options.compile_opts,
args.into_iter()
.map(|it| it.to_string())
.map(|it| OsString::from(it))
.collect_vec()
.as_slice(),
)? {
Expand All @@ -340,10 +366,7 @@ fn create_run_command(
if let Some(err) = CargoOps::run_tests(
&workspace,
&test_options,
args.into_iter()
.map(|it| it.to_string())
.collect_vec()
.as_slice(),
args,
)? {
bail!("An error occured: {:?}", err);
};
Expand Down Expand Up @@ -455,7 +478,7 @@ fn to_build(
runnables: compilation
.tests
.iter()
.map(|&(ref pkg, _, _, ref exe_path)| {
.map(|&(ref pkg, _, ref exe_path)| {
Ok(Runnable {
exe: exe_path.clone(),
id: exe_path
Expand Down
10 changes: 5 additions & 5 deletions dinghy-lib/src/errors.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use failure;
error_chain! {
foreign_links {
Io(::std::io::Error);
Expand All @@ -15,15 +16,14 @@ error_chain! {
description("Cannot compile selected packages for the selected platform")
display("{:?} cannot be compiled for the selected platform (see project's [package.metadata.dinghy] in Cargo.toml)", packages)
}
Cargo(err: ::cargo::CargoError) {
Cargo(err: String) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could probably be renamed from Cargo because it's technically from failure but given that the cargo crate is the only thing passing up failure errors, it's arguably accurate.

description("A cargo error")
display("{:?}", err)
}
}
}

impl From<::cargo::CargoError> for Error {
fn from(err: ::cargo::CargoError) -> Error {
Error::from_kind(ErrorKind::Cargo(err))
impl From<failure::Error> for Error {
fn from(err: failure::Error) -> Error {
Error::from_kind(ErrorKind::Cargo(err.to_string()))
}
}
10 changes: 5 additions & 5 deletions dinghy-lib/src/ios/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl IosManager {
}

impl PlatformManager for IosManager {
fn devices(&self) -> Result<Vec<Box<Device>>> {
fn devices(&self) -> Result<Vec<Box<dyn Device>>> {
let sims_list = ::std::process::Command::new("xcrun")
.args(&["simctl", "list", "--json", "devices"])
.output()?;
Expand All @@ -84,7 +84,7 @@ impl PlatformManager for IosManager {
}
let sims_list = String::from_utf8(sims_list.stdout)?;
let sims_list = ::json::parse(&sims_list)?;
let mut sims: Vec<Box<Device>> = vec![];
let mut sims: Vec<Box<dyn Device>> = vec![];
for (ref k, ref v) in sims_list["devices"].entries() {
for ref sim in v.members() {
if sim["state"] == "Booted" {
Expand All @@ -105,12 +105,12 @@ impl PlatformManager for IosManager {
let devices = self.devices.lock().map_err(|_| "poisoned lock")?;
Ok(devices
.iter()
.map(|d| Box::new(d.clone()) as Box<Device>)
.map(|d| Box::new(d.clone()) as Box<dyn Device>)
.chain(sims.into_iter())
.collect())
}

fn platforms(&self) -> Result<Vec<Box<Platform>>> {
fn platforms(&self) -> Result<Vec<Box<dyn Platform>>> {
["armv7", "armv7s", "aarch64", "i386", "x86_64"]
.iter()
.map(|arch| {
Expand All @@ -122,7 +122,7 @@ impl PlatformManager for IosManager {
&self.compiler,
::config::PlatformConfiguration::default(),
)
.map(|pf| pf as Box<Platform>)
.map(|pf| pf as Box<dyn Platform>)
})
.collect()
}
Expand Down
4 changes: 2 additions & 2 deletions dinghy-lib/src/ios/platform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl IosPlatform {
rustc_triple: &str,
compiler: &Arc<Compiler>,
configuration: PlatformConfiguration,
) -> Result<Box<Platform>> {
) -> Result<Box<dyn Platform>> {
Ok(Box::new(IosPlatform {
id,
sim: rustc_triple.contains("86"),
Expand Down Expand Up @@ -75,7 +75,7 @@ impl Platform for IosPlatform {
self.id.to_string()
}

fn is_compatible_with(&self, device: &Device) -> bool {
fn is_compatible_with(&self, device: &dyn Device) -> bool {
device.is_compatible_with_ios_platform(self)
}

Expand Down
1 change: 1 addition & 0 deletions dinghy-lib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ extern crate dinghy_build;
extern crate dirs;
#[macro_use]
extern crate error_chain;
extern crate failure;
extern crate filetime;
extern crate ignore;
extern crate itertools;
Expand Down