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

Bump cargo version #33

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
2,240 changes: 1,195 additions & 1,045 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions cargo-container-tools/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ publish = false
license = "MIT/Apache-2.0"

[dependencies]
cargo = "0.40"
cargo = "0.51"
clap = "2.33"
either = "1.5"
failure = "0.1"
anyhow = "1.0"
lazy_static = "1.4"
semver = "0.9"
semver = "0.10"
toml = "0.5"

serde = "1.0"
Expand Down
32 changes: 23 additions & 9 deletions cargo-container-tools/src/bin/cargo-build-plan/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,22 @@ use std::io::{copy, BufWriter};
use std::process::{exit, Command, Stdio};
use std::sync::Arc;

use cargo::core::compiler::{BuildConfig, CompileMode, DefaultExecutor, Executor};
use cargo::core::{Shell, Workspace};
use cargo::ops::{CompileFilter, CompileOptions, FilterRule, LibRule, Packages};
use cargo::util::{config::Config, CargoResult};
use cargo::{
core::compiler::{BuildConfig, CompileMode, DefaultExecutor, Executor},
util::interning::InternedString,
};

use anyhow::{bail, Context};
use clap::{crate_authors, crate_version, App, Arg, ArgMatches};
use failure::{bail, ResultExt};

fn main() {
let matches = get_cli_app().get_matches();

if let Err(error) = run(&matches) {
cargo::handle_error(&error, &mut Shell::new());
cargo::display_error(&error, &mut Shell::new());
exit(1);
}
}
Expand Down Expand Up @@ -123,13 +126,25 @@ fn run(matches: &ArgMatches<'static>) -> CargoResult<()> {

fn run_stdout(matches: &ArgMatches<'static>) -> CargoResult<()> {
let mut config = Config::default()?;
config.configure(0, None, &None, false, true, false, &None, &[])?;
config.configure(0, false, None, false, true, false, &None, &[], &[])?;

let mut build_config = BuildConfig::new(&config, Some(1), &None, CompileMode::Build)?;
build_config.release = matches.is_present("release");
let mut build_config = BuildConfig::new(
&config,
Some(1),
matches
.value_of("target")
.unwrap_or_default()
.split(",")
.map(String::from)
.collect::<Vec<_>>()
.as_slice(),
CompileMode::Build,
)?;
if matches.is_present("release") {
build_config.requested_profile = InternedString::new("release");
}
build_config.force_rebuild = true;
build_config.build_plan = true;
build_config.requested_target = matches.value_of("target").map(String::from);

let features = {
matches
Expand All @@ -140,7 +155,6 @@ fn run_stdout(matches: &ArgMatches<'static>) -> CargoResult<()> {
};

let options = CompileOptions {
config: &config,
build_config,

features,
Expand All @@ -160,7 +174,7 @@ fn run_stdout(matches: &ArgMatches<'static>) -> CargoResult<()> {
target_rustdoc_args: None,
target_rustc_args: None,
local_rustdoc_args: None,
export_dir: None,
rustdoc_document_private_items: false,
};

let executor: Arc<dyn Executor> = Arc::new(DefaultExecutor);
Expand Down
6 changes: 3 additions & 3 deletions cargo-container-tools/src/bin/cargo-buildscript-apply/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@

use std::process::{exit, Command, Stdio};

use anyhow::{bail, Context};
use cargo::core::Shell;
use cargo::util::CargoResult;
use clap::{crate_authors, crate_version, App, Arg, ArgMatches};
use failure::{bail, ResultExt};

use cargo_container_tools::BuildScriptOutput;

fn main() {
let matches = get_cli_app().get_matches();

if let Err(error) = run(&matches) {
cargo::handle_error(&error, &mut Shell::new());
cargo::display_error(&error, &mut Shell::new());
exit(1);
}
}
Expand Down Expand Up @@ -77,7 +77,7 @@ fn invoke_rustc<'a>(

let output = command
.output()
.with_context(|_| format!("Unable to spawn '{}'", bin_path))?;
.with_context(|| format!("Unable to spawn '{}'", bin_path))?;

if output.status.success() {
Ok(())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ use std::collections::BTreeMap;
use std::path::Path;
use std::process::{exit, Command, Stdio};

use anyhow::{bail, Context};
use cargo::core::{compiler::BuildOutput, Shell};
use cargo::util::CargoResult;
use clap::{crate_authors, crate_version, App, Arg, ArgMatches};
use failure::{bail, ResultExt};

use cargo_container_tools::{BuildScriptOutput, RuntimeEnv};

fn main() {
let matches = get_cli_app().get_matches();

if let Err(error) = run(&matches) {
cargo::handle_error(&error, &mut Shell::new());
cargo::display_error(&error, &mut Shell::new());
exit(1);
}
}
Expand Down Expand Up @@ -82,14 +82,15 @@ fn get_buildscript_output<'a>(
command
.args(bin_args)
.output()
.with_context(|_| format!("Unable to spawn '{}'", bin_path))?
.with_context(|| format!("Unable to spawn '{}'", bin_path))?
};

let cargo_output_result = BuildOutput::parse(
&output.stdout,
RuntimeEnv::package_name()?,
RuntimeEnv::output_dir()?,
RuntimeEnv::output_dir()?,
false,
);

let cargo_output = match cargo_output_result {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ fn main() {
let matches = get_cli_app().get_matches();

if let Err(error) = run(&matches) {
cargo::handle_error(&error, &mut Shell::new());
cargo::display_error(&error, &mut Shell::new());
exit(1);
}
}
Expand Down
4 changes: 2 additions & 2 deletions cargo-container-tools/src/bin/cargo-test-runner/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ use std::process::{exit, Command, Stdio};
use cargo::core::Shell;
use cargo::util::CargoResult;

use anyhow::{bail, Context};
use clap::{crate_authors, crate_version, App, Arg, ArgMatches};
use failure::{bail, ResultExt};

fn main() {
let matches = get_cli_app().get_matches();

if let Err(error) = run(&matches) {
cargo::handle_error(&error, &mut Shell::new());
cargo::display_error(&error, &mut Shell::new());
exit(1);
}
}
Expand Down
2 changes: 1 addition & 1 deletion cargo-container-tools/src/env.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use std::env;
use std::path::Path;

use anyhow::format_err;
use cargo::util::CargoResult;
use failure::format_err;
use lazy_static::*;

lazy_static! {
Expand Down
8 changes: 6 additions & 2 deletions cargo-container-tools/src/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ use std::fs::File;
use std::io::{BufReader, BufWriter};
use std::path::{Path, PathBuf};

use anyhow::Context;
use cargo::core::compiler::BuildOutput;
use cargo::util::CargoResult;
use failure::ResultExt;
use serde_derive::{Deserialize, Serialize};

use crate::env::RuntimeEnv;
Expand Down Expand Up @@ -65,7 +65,11 @@ impl From<BuildOutput> for BuildScriptOutput {
Self {
library_paths: output.library_paths,
library_links: output.library_links,
linker_args: output.linker_args,
linker_args: output
.linker_args
.into_iter()
.map(|(_ty, arg)| arg)
.collect(),
cfgs: output.cfgs,
env: output.env,
metadata: output.metadata,
Expand Down
2 changes: 1 addition & 1 deletion cargo-wharf-frontend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ lazy_static = "1.0"
log = "0.4"
petgraph = { version = "0.5", features = ["serde-1"] }
prost = "0.6"
semver = { version = "0.9", features = ["serde"] }
semver = { version = "0.10", features = ["serde"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
take_mut = "0.2"
Expand Down