Skip to content

Commit 43f5439

Browse files
authored
Merge pull request #378 from boozook/upd-cargo
Update cargo
2 parents d2017b6 + 980da84 commit 43f5439

File tree

15 files changed

+151
-138
lines changed

15 files changed

+151
-138
lines changed

Cargo.lock

Lines changed: 106 additions & 97 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cargo/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "cargo-playdate"
3-
version = "0.5.0-beta.2"
3+
version = "0.5.0-beta.3"
44
readme = "README.md"
55
description = "Build tool for neat yellow console."
66
keywords = ["playdate", "build", "cargo", "plugin", "cargo-subcommand"]
@@ -31,10 +31,10 @@ clap_lex = "0.7"
3131
dirs.workspace = true
3232
fs_extra.workspace = true
3333

34-
cargo = "0.78"
34+
cargo = "0.79"
3535
cargo-util = "0.2.11"
3636
cargo-platform = "0.1.8"
37-
cargo-util-schemas = "0.2.0"
37+
cargo-util-schemas = "0.3.0"
3838

3939
semver.workspace = true
4040
serde = { workspace = true, features = ["derive"] }

cargo/src/assets/mod.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,14 @@ pub mod proto {
130130

131131
// clean layout if needed:
132132
if !cfg.dry_run && cfg.compile_options.build_config.force_rebuild {
133-
if !matches!(cfg.workspace.config().shell().verbosity(), Verbosity::Quiet) {
133+
if !matches!(cfg.workspace.gctx().shell().verbosity(), Verbosity::Quiet) {
134134
cfg.log().status("Clean", format!("assets for {}", key.id));
135135
}
136136
layout.clean()?;
137137
}
138138

139139

140-
let mut locked = layout.lock_mut(cfg.workspace.config())?;
140+
let mut locked = layout.lock_mut(cfg.workspace.gctx())?;
141141
locked.prepare()?;
142142

143143
// path of build-plan file:
@@ -425,7 +425,7 @@ pub fn build<'cfg>(config: &'cfg Config) -> CargoResult<AssetsArtifacts<'cfg>> {
425425
let mut options = HashMap::new();
426426

427427
if !config.dry_run && config.compile_options.build_config.force_rebuild {
428-
if !matches!(config.workspace.config().shell().verbosity(), Verbosity::Quiet) {
428+
if !matches!(config.workspace.gctx().shell().verbosity(), Verbosity::Quiet) {
429429
config.log()
430430
.status("Clean", format!("assets for {}", package.package_id()));
431431
}
@@ -470,7 +470,7 @@ pub fn build<'cfg>(config: &'cfg Config) -> CargoResult<AssetsArtifacts<'cfg>> {
470470
// TODO: list deps in the plan
471471

472472
for (package, metadata) in packages {
473-
let locked = layout.lock_mut(config.workspace.config())?;
473+
let locked = layout.lock_mut(config.workspace.gctx())?;
474474
let dev = has_dev && package.package_id() == target_pid;
475475
let err_msg = |err| format!("{err}, caused when planning assets for {}.", package.package_id());
476476

@@ -517,12 +517,12 @@ pub fn build<'cfg>(config: &'cfg Config) -> CargoResult<AssetsArtifacts<'cfg>> {
517517
.chain(plan.dev.as_ref().into_iter().map(|plan| (plan, AssetKind::Dev)))
518518
{
519519
let message = plan.printable_serializable(package.package_id(), kind);
520-
config.workspace.config().shell().print_json(&message)?;
520+
config.workspace.gctx().shell().print_json(&message)?;
521521
}
522522
}
523523
} else {
524524
config.workspace
525-
.config()
525+
.gctx()
526526
.shell()
527527
.verbose(|shell| {
528528
for (package, plan) in plans.iter() {
@@ -605,7 +605,7 @@ pub fn build<'cfg>(config: &'cfg Config) -> CargoResult<AssetsArtifacts<'cfg>> {
605605

606606
// finally apply plans:
607607
if !config.dry_run && !config.compile_options.build_config.build_plan && !plans.is_empty() {
608-
let mut locked = layout.lock_mut(config.workspace.config())?;
608+
let mut locked = layout.lock_mut(config.workspace.gctx())?;
609609
locked.prepare()?;
610610

611611
for (dependency, mut plan) in plans.into_iter() {
@@ -764,8 +764,8 @@ pub fn build<'cfg>(config: &'cfg Config) -> CargoResult<AssetsArtifacts<'cfg>> {
764764

765765

766766
if config.compile_options.build_config.build_plan {
767-
config.workspace.config().shell().out().flush()?;
768-
config.workspace.config().shell().err().flush()?;
767+
config.workspace.gctx().shell().out().flush()?;
768+
config.workspace.gctx().shell().err().flush()?;
769769
std::process::exit(0);
770770
}
771771

cargo/src/build/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ pub fn build<'cfg>(config: &'cfg Config<'cfg>) -> CargoResult<Vec<BuildProduct<'
125125

126126

127127
for (path, ct, inv) in mapping {
128-
let layout = config.layout_for(inv.kind)?.lock(config.workspace.config())?;
128+
let layout = config.layout_for(inv.kind)?.lock(config.workspace.gctx())?;
129129
let artifact = CargoArtifact { package,
130130
path,
131131
name: art.target.name,
@@ -395,7 +395,7 @@ fn build_binary<'cfg, Layout, S>(config: &'cfg Config,
395395
layout.as_ref(),
396396
package_crate_name,
397397
Some(artifact.name.as_ref()),
398-
).lock(config.workspace.config())?;
398+
).lock(config.workspace.gctx())?;
399399
pdl.as_mut().prepare()?;
400400

401401
let product = if artifact.ck.is_playdate() {
@@ -445,7 +445,7 @@ fn build_library<'cfg, Layout, S>(config: &'cfg Config,
445445
"{} of {}{}",
446446
artifact.ct,
447447
artifact.package,
448-
if config.workspace.config().extra_verbose() {
448+
if config.workspace.gctx().extra_verbose() {
449449
format!(" from {}", artifact.path.as_relative_to_root(config).display())
450450
} else {
451451
Default::default()
@@ -464,7 +464,7 @@ fn build_library<'cfg, Layout, S>(config: &'cfg Config,
464464
layout.as_ref(),
465465
package_crate_name,
466466
Some(artifact.name.as_ref()),
467-
).lock(config.workspace.config())?;
467+
).lock(config.workspace.gctx())?;
468468
pdl.as_mut().prepare()?;
469469

470470
let product = if artifact.ck.is_playdate() {
@@ -511,8 +511,8 @@ fn build_library<'cfg, Layout, S>(config: &'cfg Config,
511511
});
512512

513513
// Print gcc's output in verbose mode only!
514-
let quiet = config.workspace.config().shell().verbosity() == Verbosity::Quiet;
515-
let extra_verbose = config.workspace.config().extra_verbose();
514+
let quiet = config.workspace.gctx().shell().verbosity() == Verbosity::Quiet;
515+
let extra_verbose = config.workspace.gctx().extra_verbose();
516516
gcc.stderr(if quiet { Stdio::null() } else { Stdio::inherit() });
517517
gcc.stdout(if extra_verbose {
518518
Stdio::inherit()

cargo/src/build/rustflags.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ impl Rustflags {
5252
if config.no_gcc {
5353
// export LINK MAP:
5454
let target_dir = config.workspace
55-
.config()
55+
.gctx()
5656
.target_dir()
5757
.unwrap_or_default()
5858
.unwrap_or_else(|| Filesystem::new("target".into()))
@@ -103,7 +103,7 @@ impl Rustflags {
103103
let existing = [&device_target, &config.host_target].into_iter()
104104
.filter_map(|ck| {
105105
config.workspace
106-
.config()
106+
.gctx()
107107
.target_cfg_triple(ck.short_name())
108108
.ok()
109109
.and_then(|tcfg| tcfg.rustflags)

cargo/src/cli/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use cargo::core::{Workspace, VirtualManifest, WorkspaceConfig, WorkspaceRootConf
1717
use cargo::core::compiler::{CompileTarget, CompileKind};
1818
use cargo::ops::CompileOptions;
1919
use cargo::util::command_prelude::{ArgMatchesExt, CompileMode, ProfileChecking};
20-
use cargo::util::Config as CargoConfig;
20+
use cargo::util::GlobalContext as CargoConfig;
2121
use cargo::util::CargoResult;
2222
use clap_lex::SeekFrom;
2323

@@ -196,7 +196,7 @@ pub fn initialize_from(args: impl IntoIterator<Item = impl Into<OsString> + AsRe
196196
matches.check_optional_opts(&workspace, &compile_options)?;
197197
}
198198

199-
let rustc = workspace.config().load_global_rustc(Some(&workspace))?;
199+
let rustc = workspace.gctx().load_global_rustc(Some(&workspace))?;
200200
let host_target = CompileTarget::new(&rustc.host)?;
201201

202202

@@ -365,15 +365,15 @@ fn presented_dangerous_global_args_values<'m>(matches: &'m ArgMatches,
365365

366366

367367
fn compile_options(cmd: &Cmd, matches: &ArgMatches, ws: &Workspace<'_>) -> CargoResult<CompileOptions> {
368-
let cfg = ws.config();
368+
let cfg = ws.gctx();
369369
let mut compile_options = match cmd {
370370
// allow multiple crates:
371371
Cmd::Build | Cmd::Package | Cmd::Migrate | Cmd::Assets => {
372372
matches.compile_options(cfg, CompileMode::Build, Some(ws), ProfileChecking::Custom)?
373373
},
374374

375375
Cmd::New | Cmd::Init => {
376-
let mut opts = CompileOptions::new(ws.config(), CompileMode::Check { test: false })?;
376+
let mut opts = CompileOptions::new(ws.gctx(), CompileMode::Check { test: false })?;
377377
opts.build_config
378378
.requested_kinds
379379
.push(PlaydateTarget::Device.into());

cargo/src/layout/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ mod cargo;
55
mod playdate;
66

77
use ::cargo::CargoResult;
8-
use ::cargo::Config;
8+
use ::cargo::GlobalContext as Config;
99
use ::cargo::util::FileLock;
1010
use ::cargo::util::Filesystem;
1111

cargo/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use std::borrow::Cow;
1313
use anyhow::bail;
1414
use cargo::core::Verbosity;
1515
use cargo::core::compiler::{CrateType, CompileKind};
16-
use cargo::util::{CargoResult, Config as CargoConfig};
16+
use cargo::util::{CargoResult, GlobalContext as CargoConfig};
1717
use config::Config;
1818
use anstyle::AnsiColor as Color;
1919

@@ -42,7 +42,7 @@ fn main() -> CargoResult<()> {
4242
|err| {
4343
#[cfg(debug_assertions)]
4444
eprintln!("Error: {err:?}");
45-
let config = config.workspace.config();
45+
let config = config.workspace.gctx();
4646
config.shell().set_verbosity(Verbosity::Normal);
4747
config.shell().error(err).ok();
4848
std::process::exit(1);

cargo/src/package/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ fn package_multi_target<'p>(config: &Config,
238238
let layout_target_name = Name::with_names(package.name().as_str(), products.first().map(|p| &p.name));
239239
let mut layout =
240240
CrossTargetLayout::new(config, package.package_id(), Some(layout_target_name))?.lock(config.workspace
241-
.config())?;
241+
.gctx())?;
242242
if let Some(assets) = assets {
243243
debug_assert_eq!(
244244
layout.as_ref().assets_layout(config).root(),

cargo/src/proc/logging.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,14 @@ pub fn cmd_logged(config: &Config, mut cmd: Command) -> CargoResult<Command> {
6868
if let Ok(error) = std::str::from_utf8(stderr) {
6969
config.log().status_err(format!("{tool} stderr:\n{error}"));
7070
} else {
71-
config.workspace.config().shell().status_header(&tool)?;
71+
config.workspace.gctx().shell().status_header(&tool)?;
7272
config.workspace
73-
.config()
73+
.gctx()
7474
.shell()
7575
.err()
7676
.write_all("stderr:\n".as_bytes())?;
77-
config.workspace.config().shell().err().write_all(stderr)?;
78-
config.workspace.config().shell().err().write_all(b"\n")?;
77+
config.workspace.gctx().shell().err().write_all(stderr)?;
78+
config.workspace.gctx().shell().err().write_all(b"\n")?;
7979
}
8080
}
8181

cargo/src/proc/utils.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub fn cargo_proxy_with<S: AsRef<OsStr>>(cfg: &Config,
4242
pub fn cargo(cfg: Option<&Config>) -> CargoResult<std::process::Command> {
4343
let mut proc = cargo_cmd(cfg);
4444

45-
if let Some(cfg) = cfg.map(|cfg| cfg.workspace.config()) {
45+
if let Some(cfg) = cfg.map(|cfg| cfg.workspace.gctx()) {
4646
// transparent env:
4747
cfg.env_config()?.iter().for_each(|(k, v)| {
4848
let value = v.resolve(cfg);
@@ -72,7 +72,7 @@ pub fn cargo(cfg: Option<&Config>) -> CargoResult<std::process::Command> {
7272
pub fn cargo_cmd(cfg: Option<&Config>) -> std::process::Command {
7373
fn cargo_path<'t>(cfg: Option<&'t Config<'t>>) -> (Cow<'t, Path>, Option<&str>) {
7474
if let Some(cfg) = cfg {
75-
let path = cfg.workspace.config().cargo_exe().log_err().ok().map(Cow::from);
75+
let path = cfg.workspace.gctx().cargo_exe().log_err().ok().map(Cow::from);
7676
if path.is_some() && path == std::env::current_exe().log_err().ok().map(Into::into) {
7777
// Seems to we're in standalone mode.
7878
cargo_path(None)
@@ -115,7 +115,7 @@ pub fn read_cargo_json<T: DeserializeOwned>(cfg: &Config, mut cmd: Command) -> C
115115

116116
let output = cmd.output()?;
117117
if !output.status.success() {
118-
cfg.workspace.config().shell().err().write_all(&output.stderr)?;
118+
cfg.workspace.gctx().shell().err().write_all(&output.stderr)?;
119119
output.status.exit_ok()?;
120120
}
121121

cargo/src/utils/logging.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,14 @@ impl Config<'_> {
127127
#[must_use]
128128
pub fn log(&self) -> CargoLogger<RefMut<'_, Shell>> {
129129
CargoLogger(
130-
self.workspace.config().shell(),
130+
self.workspace.gctx().shell(),
131131
self.compile_options.build_config.emit_json(),
132132
)
133133
}
134134

135135
pub fn log_extra_verbose<F>(&self, mut callback: F)
136136
where F: FnMut(CargoLogger<RefMut<'_, Shell>>) {
137-
if self.workspace.config().extra_verbose() {
137+
if self.workspace.gctx().extra_verbose() {
138138
callback(self.log())
139139
}
140140
}

cargo/src/utils/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub struct LazyBuildContext<'a, 'cfg> {
2727

2828
impl<'a, 'cfg> LazyBuildContext<'a, 'cfg> {
2929
pub fn new(config: &'cfg Config) -> CargoResult<Self> {
30-
let options = CompileOptions::new(config.workspace.config(), CompileMode::Check { test: false })?;
30+
let options = CompileOptions::new(config.workspace.gctx(), CompileMode::Check { test: false })?;
3131
Ok(Self { bcx: Lazy::new(),
3232
interner: UnitInterner::new(),
3333
workspace: &config.workspace,

cargo/src/utils/workspace.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ impl<'t> Config<'t> {
2424
Ok(members)
2525
}
2626

27+
#[deprecated(since = "0.5", note = "TODO: use unit_graph instead")]
2728
/// Returns a list of targets that are requested by the user.
2829
/// Resolved by requested spec initially, with fallback to all possible targets.
2930
pub fn possible_targets_ext(&'t self) -> CargoResult<Vec<PossibleTargets<'t>>> {
@@ -37,13 +38,15 @@ impl<'t> Config<'t> {
3738
Ok(possible)
3839
}
3940

41+
#[deprecated(since = "0.5", note = "TODO: use unit_graph instead")]
4042
/// Returns a list of potential targets that are requested by the user.
4143
pub fn possible_targets(&'t self) -> CargoResult<impl Iterator<Item = PossibleTargets<'t>>> {
4244
let packages = self.members_with_features()?.into_iter().map(|(p, _)| p);
4345
let members = self.possible_targets_with(packages);
4446
Ok(members)
4547
}
4648

49+
#[deprecated(since = "0.5", note = "TODO: use unit_graph instead")]
4750
pub fn possible_targets_with(&'t self,
4851
members: impl IntoIterator<Item = &'t Package>)
4952
-> impl Iterator<Item = PossibleTargets<'t>> {
@@ -57,6 +60,7 @@ impl<'t> Config<'t> {
5760
})
5861
}
5962

63+
#[deprecated(since = "0.5", note = "TODO: determine from unit_graph instead")]
6064
pub fn possible_compile_kinds(&'t self) -> CargoResult<Vec<CompileKind>> {
6165
let member_kinds = self.members_with_features()?.into_iter().flat_map(|(p, _)| {
6266
p.manifest()
@@ -79,7 +83,7 @@ impl<'t> Config<'t> {
7983

8084
pub fn target_info(&self, kind: CompileKind) -> CargoResult<TargetInfo> {
8185
TargetInfo::new(
82-
self.workspace.config(),
86+
self.workspace.gctx(),
8387
&self.possible_compile_kinds()?,
8488
&self.rustc,
8589
kind,

support/addr2line/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "playdate-symbolize"
3-
version = "0.1.2"
3+
version = "0.1.3"
44
readme = "README.md"
55
description = "Tools for symbolise addresses from bin (pdex.elf) and Playdate's trace or crashlog."
66
keywords = ["playdate", "bin", "elf", "addr2line", "utility"]
@@ -48,7 +48,7 @@ workspace = true
4848
optional = true
4949

5050
[dependencies.rusqlite]
51-
version = "0.30"
51+
version = "0.31"
5252
features = ["bundled"]
5353

5454
[dependencies.utils]

0 commit comments

Comments
 (0)