Skip to content

Commit 67e1aaa

Browse files
committed
Bump cargo version
1 parent 1395afb commit 67e1aaa

File tree

8 files changed

+38
-43
lines changed

8 files changed

+38
-43
lines changed

Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "cargo-c"
3-
version = "0.9.31+cargo-0.78.0"
3+
version = "0.9.31+cargo-0.79.0"
44
authors = ["Luca Barbato <[email protected]>"]
55
description = "Helper program to build and install c-like libraries"
66
license = "MIT"
@@ -28,7 +28,7 @@ name = "cargo-ctest"
2828
path = "src/bin/ctest.rs"
2929

3030
[dependencies]
31-
cargo = "0.78.0"
31+
cargo = "0.79.0"
3232
cargo-util = "0.2"
3333
semver = "1.0.3"
3434
log = "0.4"

src/bin/capi.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@ use cargo_c::install::cinstall;
55

66
use cargo::util::command_prelude::flag;
77
use cargo::util::command_prelude::ArgMatchesExt;
8-
use cargo::CliResult;
9-
use cargo::Config;
8+
use cargo::{CliResult, GlobalContext};
109

1110
use clap::*;
1211

1312
fn main() -> CliResult {
14-
let mut config = Config::default()?;
13+
let mut config = GlobalContext::default()?;
1514

1615
let cli_build = subcommand_build("build", "Build the crate C-API");
1716
let cli_install = subcommand_install("install", "Install the crate C-API");
@@ -60,7 +59,7 @@ fn main() -> CliResult {
6059
return Ok(());
6160
}
6261

63-
config_configure(&mut config, subcommand_args)?;
62+
global_context_configure(&mut config, subcommand_args)?;
6463

6564
let mut ws = subcommand_args.workspace(&config)?;
6665

src/bin/cbuild.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
use cargo::util::command_prelude::ArgMatchesExt;
22
use cargo::CliResult;
3-
use cargo::Config;
3+
use cargo::GlobalContext;
44

55
use cargo_c::build::*;
66
use cargo_c::cli::run_cargo_fallback;
77
use cargo_c::cli::subcommand_build;
88
use cargo_c::config::*;
99

1010
fn main() -> CliResult {
11-
let mut config = Config::default()?;
11+
let mut config = GlobalContext::default()?;
1212

1313
let subcommand = subcommand_build("cbuild", "Build the crate C-API");
1414
let mut app = clap::command!()
@@ -35,7 +35,7 @@ fn main() -> CliResult {
3535
return Ok(());
3636
}
3737

38-
config_configure(&mut config, subcommand_args)?;
38+
global_context_configure(&mut config, subcommand_args)?;
3939

4040
let mut ws = subcommand_args.workspace(&config)?;
4141

src/bin/cinstall.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
use cargo::util::command_prelude::ArgMatchesExt;
22
use cargo::CliResult;
3-
use cargo::Config;
3+
use cargo::GlobalContext;
44

55
use cargo_c::build::cbuild;
66
use cargo_c::cli::run_cargo_fallback;
77
use cargo_c::cli::subcommand_install;
8-
use cargo_c::config::config_configure;
8+
use cargo_c::config::global_context_configure;
99
use cargo_c::install::cinstall;
1010

1111
fn main() -> CliResult {
12-
let mut config = Config::default()?;
12+
let mut config = GlobalContext::default()?;
1313

1414
let subcommand = subcommand_install("cinstall", "Install the crate C-API");
1515
let mut app = clap::command!()
@@ -36,7 +36,7 @@ fn main() -> CliResult {
3636
return Ok(());
3737
}
3838

39-
config_configure(&mut config, subcommand_args)?;
39+
global_context_configure(&mut config, subcommand_args)?;
4040

4141
let mut ws = subcommand_args.workspace(&config)?;
4242

src/bin/ctest.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use cargo_c::cli::subcommand_test;
66
use cargo_c::config::*;
77

88
fn main() -> CliResult {
9-
let mut config = Config::default()?;
9+
let mut config = GlobalContext::default()?;
1010

1111
let subcommand = subcommand_test("ctest");
1212

@@ -34,7 +34,7 @@ fn main() -> CliResult {
3434
return Ok(());
3535
}
3636

37-
config_configure(&mut config, subcommand_args)?;
37+
global_context_configure(&mut config, subcommand_args)?;
3838

3939
let mut ws = subcommand_args.workspace(&config)?;
4040

src/build.rs

+15-17
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use cargo::core::{FeatureValue, Package, PackageId, Target, TargetKind, Workspac
1010
use cargo::ops::{self, CompileFilter, CompileOptions, FilterRule, LibRule};
1111
use cargo::util::command_prelude::{ArgMatches, ArgMatchesExt, CompileMode, ProfileChecking};
1212
use cargo::util::interning::InternedString;
13-
use cargo::{CliResult, Config};
13+
use cargo::{CliResult, GlobalContext};
1414

1515
use anyhow::Context as _;
1616
use cargo_util::paths::{copy, create, create_dir_all, open, read, read_bytes, write};
@@ -29,7 +29,7 @@ fn build_include_file(
2929
root_output: &Path,
3030
root_path: &Path,
3131
) -> anyhow::Result<()> {
32-
ws.config()
32+
ws.gctx()
3333
.shell()
3434
.status("Building", "header file using cbindgen")?;
3535
let mut header_name = PathBuf::from(name);
@@ -64,7 +64,7 @@ fn copy_prebuilt_include_file(
6464
build_targets: &BuildTargets,
6565
root_output: &Path,
6666
) -> anyhow::Result<()> {
67-
let mut shell = ws.config().shell();
67+
let mut shell = ws.gctx().shell();
6868
shell.status("Populating", "uninstalled header directory")?;
6969
let path = &format!("PKG_CONFIG_PATH=\"{}\"", root_output.display());
7070
shell.verbose(move |s| s.note(path))?;
@@ -90,7 +90,7 @@ fn build_pc_files(
9090
root_output: &Path,
9191
pc: &PkgConfig,
9292
) -> anyhow::Result<()> {
93-
ws.config().shell().status("Building", "pkg-config files")?;
93+
ws.gctx().shell().status("Building", "pkg-config files")?;
9494
build_pc_file(filename, root_output, pc)?;
9595
let pc_uninstalled = pc.uninstalled(root_output);
9696
build_pc_file(
@@ -140,7 +140,7 @@ fn build_def_file(
140140
let env = &target.env;
141141

142142
if os == "windows" && env == "msvc" {
143-
ws.config()
143+
ws.gctx()
144144
.shell()
145145
.status("Building", ".def file using dumpbin")?;
146146

@@ -213,7 +213,7 @@ fn build_implib_file(
213213
if os == "windows" {
214214
let arch = &target.arch;
215215
if env == "gnu" {
216-
ws.config()
216+
ws.gctx()
217217
.shell()
218218
.status("Building", "implib using dlltool")?;
219219

@@ -242,7 +242,7 @@ fn build_implib_file(
242242
Err(anyhow::anyhow!("Command failed {:?}", dlltool_command))
243243
}
244244
} else {
245-
ws.config().shell().status("Building", "implib using lib")?;
245+
ws.gctx().shell().status("Building", "implib using lib")?;
246246
let target_str = format!("{}-pc-windows-msvc", &target.arch);
247247
let mut lib = match cc::windows_registry::find(&target_str, "lib.exe") {
248248
Some(command) => command,
@@ -802,14 +802,14 @@ fn load_manifest_capi_config(
802802

803803
fn compile_options(
804804
ws: &Workspace,
805-
config: &Config,
805+
gctx: &GlobalContext,
806806
args: &ArgMatches,
807807
profile: InternedString,
808808
compile_mode: CompileMode,
809809
) -> anyhow::Result<CompileOptions> {
810810
use cargo::core::compiler::CompileKind;
811811
let mut compile_opts =
812-
args.compile_options(config, compile_mode, Some(ws), ProfileChecking::Custom)?;
812+
args.compile_options(gctx, compile_mode, Some(ws), ProfileChecking::Custom)?;
813813

814814
compile_opts.build_config.requested_profile = profile;
815815

@@ -827,12 +827,12 @@ fn compile_options(
827827

828828
compile_opts.build_config.unit_graph = false;
829829

830-
let rustc = config.load_global_rustc(Some(ws))?;
830+
let rustc = gctx.load_global_rustc(Some(ws))?;
831831

832832
// Always set the target, requested_kinds is a vec of a single element.
833833
if compile_opts.build_config.requested_kinds[0].is_host() {
834834
compile_opts.build_config.requested_kinds =
835-
CompileKind::from_requested_targets(config, &[rustc.host.to_string()])?
835+
CompileKind::from_requested_targets(gctx, &[rustc.host.to_string()])?
836836
}
837837

838838
Ok(compile_opts)
@@ -893,7 +893,6 @@ impl Executor for Exec {
893893

894894
use cargo::core::compiler::{unit_graph, UnitInterner};
895895
use cargo::ops::create_bcx;
896-
use cargo::util::profile;
897896

898897
fn set_deps_args(
899898
dep: &UnitDep,
@@ -959,11 +958,10 @@ fn compile_with_exec(
959958
}
960959

961960
if options.build_config.unit_graph {
962-
unit_graph::emit_serialized_unit_graph(&bcx.roots, &bcx.unit_graph, ws.config())?;
961+
unit_graph::emit_serialized_unit_graph(&bcx.roots, &bcx.unit_graph, ws.gctx())?;
963962
return Ok(HashMap::new());
964963
}
965-
let _p = profile::start("compiling");
966-
let cx = cargo::core::compiler::Context::new(&bcx)?;
964+
let cx = cargo::core::compiler::BuildRunner::new(&bcx)?;
967965

968966
let r = cx.compile(exec)?;
969967

@@ -1039,7 +1037,7 @@ impl CPackage {
10391037

10401038
pub fn cbuild(
10411039
ws: &mut Workspace,
1042-
config: &Config,
1040+
config: &GlobalContext,
10431041
args: &ArgMatches,
10441042
default_profile: &str,
10451043
) -> anyhow::Result<(Vec<CPackage>, CompileOptions)> {
@@ -1240,7 +1238,7 @@ pub fn cbuild(
12401238

12411239
pub fn ctest(
12421240
ws: &Workspace,
1243-
config: &Config,
1241+
config: &GlobalContext,
12441242
args: &ArgMatches,
12451243
packages: &[CPackage],
12461244
mut compile_opts: CompileOptions,

src/config.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::env;
22

33
use cargo::util::command_prelude::{ArgMatches, ArgMatchesExt};
4-
use cargo::{CliResult, Config};
4+
use cargo::{CliResult, GlobalContext};
55

66
// Take the original cargo instance and save it as a separate env var if not already set.
77
fn setup_env() {
@@ -12,14 +12,14 @@ fn setup_env() {
1212
}
1313
}
1414

15-
pub fn config_configure(config: &mut Config, args: &ArgMatches) -> CliResult {
16-
let arg_target_dir = &args.value_of_path("target-dir", config);
15+
pub fn global_context_configure(gctx: &mut GlobalContext, args: &ArgMatches) -> CliResult {
16+
let arg_target_dir = &args.value_of_path("target-dir", gctx);
1717
let config_args: Vec<_> = args
1818
.get_many::<String>("config")
1919
.unwrap_or_default()
2020
.map(|s| s.to_owned())
2121
.collect();
22-
config.configure(
22+
gctx.configure(
2323
args.verbose(),
2424
args.flag("quiet"),
2525
args.get_one::<String>("color").map(String::as_str),

src/install.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -198,17 +198,15 @@ pub fn cinstall(ws: &Workspace, packages: &[CPackage]) -> anyhow::Result<()> {
198198
create_dir_all(&install_path_lib)?;
199199
create_dir_all(&install_path_pc)?;
200200

201-
ws.config()
202-
.shell()
203-
.status("Installing", "pkg-config file")?;
201+
ws.gctx().shell().status("Installing", "pkg-config file")?;
204202

205203
copy(
206204
&build_targets.pc,
207205
install_path_pc.join(build_targets.pc.file_name().unwrap()),
208206
)?;
209207

210208
if capi_config.header.enabled {
211-
ws.config().shell().status("Installing", "header file")?;
209+
ws.gctx().shell().status("Installing", "header file")?;
212210
for (from, to) in build_targets.extra.include.iter() {
213211
let to = install_path_include.join(to);
214212
create_dir_all(to.parent().unwrap())?;
@@ -217,7 +215,7 @@ pub fn cinstall(ws: &Workspace, packages: &[CPackage]) -> anyhow::Result<()> {
217215
}
218216

219217
if !build_targets.extra.data.is_empty() {
220-
ws.config().shell().status("Installing", "data file")?;
218+
ws.gctx().shell().status("Installing", "data file")?;
221219
for (from, to) in build_targets.extra.data.iter() {
222220
let to = install_path_data.join(to);
223221
create_dir_all(to.parent().unwrap())?;
@@ -226,15 +224,15 @@ pub fn cinstall(ws: &Workspace, packages: &[CPackage]) -> anyhow::Result<()> {
226224
}
227225

228226
if let Some(ref static_lib) = build_targets.static_lib {
229-
ws.config().shell().status("Installing", "static library")?;
227+
ws.gctx().shell().status("Installing", "static library")?;
230228
copy(
231229
static_lib,
232230
install_path_lib.join(static_lib.file_name().unwrap()),
233231
)?;
234232
}
235233

236234
if let Some(ref shared_lib) = build_targets.shared_lib {
237-
ws.config().shell().status("Installing", "shared library")?;
235+
ws.gctx().shell().status("Installing", "shared library")?;
238236

239237
let lib_type = LibType::from_build_targets(build_targets);
240238
match lib_type {

0 commit comments

Comments
 (0)