Skip to content

Commit

Permalink
update deps of cargo-playdate, fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
boozook committed Mar 26, 2024
1 parent c7490c6 commit 15f5457
Show file tree
Hide file tree
Showing 11 changed files with 237 additions and 181 deletions.
334 changes: 193 additions & 141 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,4 @@ clap = "4.5"
serde = "1.0"
serde_json = "1.0"
toml = "0.8"
futures-lite = "2.3"
14 changes: 7 additions & 7 deletions cargo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ clap_lex = "0.7"
dirs.workspace = true
fs_extra.workspace = true

cargo = "=0.77.0"
cargo-util = "=0.2.9"
cargo-platform = "0.1.7"
cargo = "=0.78.0"
cargo-util = "=0.2.10"
cargo-platform = "0.1.8"
cargo-util-schemas = "0.2.0"

semver.workspace = true
serde = { workspace = true, features = ["derive"] }
Expand All @@ -51,14 +52,14 @@ anstyle = "1"
env_logger.workspace = true
log.workspace = true

futures-lite.workspace = true


[dependencies.build]
workspace = true
default-features = false
features = ["assets-report", "toml"]

# [dependencies.tool]
# workspace = true
# features = ["clap", "cli"]
[dependencies.device]
workspace = true
features = ["clap", "async", "tokio-serial", "tokio"]
Expand Down Expand Up @@ -92,4 +93,3 @@ nix = { version = "0.28", features = ["signal"] }

[features]
default = []
# usb = ["tool/usb"]
2 changes: 1 addition & 1 deletion cargo/src/build/plan/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ pub enum CompileModeProxy {
Bench,
/// A target that will be documented with `rustdoc`.
/// If `deps` is true, then it will also document all dependencies.
Doc { deps: bool },
Doc { deps: bool, json: bool },
/// A target that will be tested with `rustdoc`.
Doctest,
/// An example or library that will be scraped for function calls by `rustdoc`.
Expand Down
5 changes: 2 additions & 3 deletions cargo/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ use cargo::util::command_prelude::{ArgMatchesExt, CompileMode, ProfileChecking};
use cargo::util::Config as CargoConfig;
use cargo::util::CargoResult;
use clap_lex::SeekFrom;
use tool::cli::mount::Mount;

use crate::config::Config;
use crate::logger::LogErr;
Expand Down Expand Up @@ -220,7 +219,7 @@ pub fn initialize_from(args: impl IntoIterator<Item = impl Into<OsString> + AsRe
log::debug!("extra args: {extra:?}");
}

let no_wait = matches.flag("no-wait");
let no_read = matches.flag("no-read");
let mounting = matches!(cmd, Cmd::Run).then(|| Mount::from_arg_matches(&matches).ok())
.flatten();

Expand Down Expand Up @@ -289,7 +288,7 @@ pub fn initialize_from(args: impl IntoIterator<Item = impl Into<OsString> + AsRe
sdk_path,
gcc_path,
mounting,
no_wait,
no_read,
zip,
no_info_meta,
prevent_unwinding,
Expand Down
21 changes: 13 additions & 8 deletions cargo/src/cli/opts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ use clap::{Arg, ArgAction, value_parser, Args};
use clap::Command;
use playdate::consts::{SDK_ENV_VAR, DEVICE_TARGET};
use playdate::toolchain::gcc::ARM_GCC_PATH_ENV_VAR;
use tool::cli::run::DeviceDestination;
use tool::cli::mount::Mount;
// use tool::cli::mount::Mount;


use super::{Cmd, CMD_NAME, BIN_NAME};
Expand Down Expand Up @@ -48,7 +47,7 @@ pub fn special_args_for(cmd: &Cmd) -> Vec<Arg> {
Cmd::Run => {
let mut args = mount();
args.append(&mut shorthands_for(cmd));
args.push(flag_no_wait());
args.push(flag_no_read());
args.push(flag_no_info_file());
args.push(flag_pdc_skip_unknown());
args.push(flag_pdc_skip_prebuild());
Expand Down Expand Up @@ -231,6 +230,12 @@ fn init_crate() -> Command {
}


#[derive(clap::Parser, Debug, Clone, Default)]
pub struct Mount {
#[command(flatten)]
pub device: device::device::query::DeviceQuery,
}

fn mount() -> Vec<Arg> {
let mount: Command =
Mount::augment_args(Command::new("mount")).mut_arg("device", |arg| arg.long("device").num_args(0..=1));
Expand All @@ -240,11 +245,11 @@ fn mount() -> Vec<Arg> {
.collect()
}

fn flag_no_wait() -> Arg {
DeviceDestination::augment_args(Command::new("dest")).get_arguments()
.find(|arg| arg.get_id().as_str() == "no-wait")
.expect("Arg no-wait")
.to_owned()
fn flag_no_read() -> Arg {
flag(
"no-read",
"Do not wait & read the device's output after execution.",
)
}


Expand Down
8 changes: 4 additions & 4 deletions cargo/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use cargo::core::compiler::{CompileTarget, CompileKind, TargetInfo};
use cargo::ops::CompileOptions;
use playdate::toolchain::gcc::{ArmToolchain, Gcc};
use playdate::toolchain::sdk::Sdk;
use tool::cli::mount::Mount;
use try_lazy_init::Lazy;

use cargo::util::{CargoResult, Rustc};
Expand All @@ -16,6 +15,7 @@ use crate::build::rustflags::Rustflags;
use crate::cli::cmd::Cmd;
use crate::cli::deps::Dependency;
use crate::cli::ide::Ide;
use crate::cli::opts::Mount;
use crate::utils::LazyBuildContext;


Expand All @@ -39,7 +39,7 @@ pub struct Config<'cfg> {
pub gcc_path: Option<PathBuf>,

pub mounting: Option<Mount>,
pub no_wait: bool,
pub no_read: bool,

pub zip: bool,
pub no_info_meta: bool,
Expand Down Expand Up @@ -83,7 +83,7 @@ impl<'cfg> Config<'cfg> {
sdk_path: Option<PathBuf>,
gcc_path: Option<PathBuf>,
mounting: Option<Mount>,
no_wait: bool,
no_read: bool,
zip: bool,
no_info_meta: bool,
prevent_unwinding: bool,
Expand Down Expand Up @@ -111,7 +111,7 @@ impl<'cfg> Config<'cfg> {
sdk_path,
gcc_path,
mounting,
no_wait,
no_read,
zip,
no_info_meta,
prevent_unwinding,
Expand Down
27 changes: 13 additions & 14 deletions cargo/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,22 +203,21 @@ fn execute(config: &Config) -> CargoResult<()> {

// run:
{
use tool::cli::run::run;
use tool::cli::run::{Run, Destination, SimDestination, DeviceDestination};
use tool::cli::install::Install;

let destination = if ck.is_playdate() {
Destination::Device(DeviceDestination { install: Install { pdx: package.path.to_owned(),
mount: config.mounting
.clone()
.unwrap_or_default() },
no_install: false,
no_wait: config.no_wait })
use device::run::{run_on_device, run_with_sim};
use futures_lite::future::block_on;

if ck.is_playdate() {
let query = config.mounting.clone().unwrap_or_default().device;
let pdx = package.path.to_owned();
let no_install = false;
let no_read = config.no_read;
let force = false;
let fut = run_on_device(query, pdx, no_install, no_read, force);
block_on(fut)?;
} else {
Destination::Simulator(SimDestination { pdx: package.path.to_owned() })
let fut = run_with_sim(package.path.to_owned(), config.sdk_path.clone());
block_on(fut)?;
};

run(Run { destination })?;
}

std::process::exit(0)
Expand Down
2 changes: 1 addition & 1 deletion cargo/src/package/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ use std::process::Command;

use anyhow::anyhow;
use anyhow::bail;
use cargo::util_schemas::manifest::TomlDebugInfo;
use cargo::CargoResult;
use cargo::core::Package;
use cargo::core::compiler::CompileKind;
use cargo::core::compiler::CrateType;
use cargo::core::profiles::DebugInfo;
use cargo::core::profiles::Profiles;
use cargo_util_schemas::manifest::TomlDebugInfo;
use clap_lex::OsStrExt;
use playdate::io::soft_link_checked;
use playdate::layout::Layout;
Expand Down
2 changes: 1 addition & 1 deletion support/tool/src/cli/commands/mount.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::mount::mount_without_sdk;

/// Mount the device.
#[derive(Clone, Debug, clap::Parser)]
#[command(author, version, about, long_about = None, name = "install")]
#[command(author, version, about, long_about = None, name = "mount")]
pub struct Mount {
#[cfg_attr(feature = "cli", command(flatten))]
pub device: DeviceQuery,
Expand Down
2 changes: 1 addition & 1 deletion support/tool2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ name = "pdtool"
[dependencies]
# RT, async:
tokio = { version = "1.36", features = ["full"] }
futures-lite = { version = "2.3" }
futures = { version = "0.3" }
futures-lite.workspace = true

serde = { workspace = true, features = ["derive"] }
serde_json.workspace = true
Expand Down

0 comments on commit 15f5457

Please sign in to comment.