From 55ce8b7ebe153af9612d95c67ae2c53c32852338 Mon Sep 17 00:00:00 2001 From: David Date: Tue, 27 Feb 2024 22:31:40 +0700 Subject: [PATCH 1/4] fix: zip issue on windows, bump packages versions --- Cargo.toml | 2 +- crossbundle/cli/Cargo.toml | 18 ++++++++-------- crossbundle/cli/src/commands/build/android.rs | 4 ++-- crossbundle/cli/src/commands/build/apple.rs | 4 ++-- .../cli/src/commands/install/sdkmanager.rs | 4 ++-- crossbundle/cli/src/lib.rs | 4 ++-- crossbundle/tools/Cargo.toml | 21 +++++++++---------- .../src/commands/android/common/write_zip.rs | 5 ++--- .../tools/src/types/android/manifest.rs | 9 ++++---- 9 files changed, 35 insertions(+), 36 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index becebe8a..85b85c2e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,7 @@ displaydoc = "0.2" anyhow = "1.0" serde = { version = "1.0", features = ["derive"] } -android-manifest = { version = "0.1.10", optional = true } +android-manifest = { version = "0.2.0", optional = true } apple-bundle = { version = "0.1.4", optional = true } [target.'cfg(target_os = "android")'.dependencies] diff --git a/crossbundle/cli/Cargo.toml b/crossbundle/cli/Cargo.toml index 6996c5a6..5f5e6f07 100644 --- a/crossbundle/cli/Cargo.toml +++ b/crossbundle/cli/Cargo.toml @@ -21,25 +21,25 @@ path = "src/main.rs" crossbow = { path = "../../", version = "0.2.3", default-features = false, features = ["update-manifest"] } crossbundle-tools = { path = "../tools", version = "0.2.3", default-features = false } android-tools = { version = "0.2.11", optional = true } -clap = { version = "3.2", features = ["derive"] } +clap = { version = "4.5", features = ["derive"] } serde = { version = "1.0", features = ["derive"] } anyhow = "1.0" thiserror = "1.0" -colored = "2.0" +colored = "2.1" displaydoc = "0.2" -pretty_env_logger = "0.4" +pretty_env_logger = "0.5" log = "0.4" -fs_extra = "1.2" -dirs = "4.0" +fs_extra = "1.3" +dirs = "5.0" dunce = "1.0" -ureq = { version = "2.5", features = ["tls"] } -cargo = "0.63.1" -cargo-util = "0.2.0" +ureq = { version = "2.9", features = ["tls"] } +cargo = "0.77" +cargo-util = "0.2" [dev-dependencies] -tempfile = "3.3" +tempfile = "3.10" [features] default = ["android", "apple"] diff --git a/crossbundle/cli/src/commands/build/android.rs b/crossbundle/cli/src/commands/build/android.rs index fd8d9231..e353963c 100644 --- a/crossbundle/cli/src/commands/build/android.rs +++ b/crossbundle/cli/src/commands/build/android.rs @@ -2,7 +2,7 @@ use super::{BuildContext, SharedBuildCommand}; use crate::{error::*, types::CrossbowMetadata}; use android_manifest::AndroidManifest; use android_tools::java_tools::{JarSigner, Key}; -use clap::Parser; +use clap::{ArgAction, Parser}; use crossbundle_tools::{ commands::{android::*, combine_folders}, error::CommandExt, @@ -18,7 +18,7 @@ pub struct AndroidBuildCommand { /// Build for the given android architecture. /// Supported targets are: `armv7-linux-androideabi`, `aarch64-linux-android`, /// `i686-linux-android`, `x86_64-linux-android` - #[clap(long, short, multiple_values = true)] + #[clap(long, short, action = ArgAction::Append)] pub target: Vec, /// Build strategy specifies what and how to build Android application: with help of /// Gradle, or with our native approach. diff --git a/crossbundle/cli/src/commands/build/apple.rs b/crossbundle/cli/src/commands/build/apple.rs index e23c2b56..f0fcafad 100644 --- a/crossbundle/cli/src/commands/build/apple.rs +++ b/crossbundle/cli/src/commands/build/apple.rs @@ -1,7 +1,7 @@ use super::{BuildContext, SharedBuildCommand}; use crate::{error::*, types::CrossbowMetadata}; use apple_bundle::prelude::InfoPlist; -use clap::Parser; +use clap::{ArgAction, Parser}; use crossbundle_tools::{ commands::{apple, combine_folders}, types::*, @@ -18,7 +18,7 @@ pub struct IosBuildCommand { /// Build for the given apple architecture. /// Supported targets are: `aarch64-apple-ios`, `aarch64-apple-ios-sim`, /// `armv7-apple-ios`, `armv7s-apple-ios`, `i386-apple-ios`, `x86_64-apple-ios` - #[clap(long, short, multiple_values = true)] + #[clap(long, short, action = ArgAction::Append)] pub target: Vec, /// Build strategy specifies what and how to build iOS application: with help of /// XCode, or with our native approach. diff --git a/crossbundle/cli/src/commands/install/sdkmanager.rs b/crossbundle/cli/src/commands/install/sdkmanager.rs index 63478200..91b9ea18 100644 --- a/crossbundle/cli/src/commands/install/sdkmanager.rs +++ b/crossbundle/cli/src/commands/install/sdkmanager.rs @@ -1,4 +1,4 @@ -use clap::Parser; +use clap::{ArgAction, Parser}; use crossbundle_tools::{ error::{CommandExt, Result}, types::{android_sdk_path, Config}, @@ -19,7 +19,7 @@ pub struct SdkManagerInstallCommand { pub list: bool, /// Install package. To see all available packages use --list. /// Example: crossbundle install sdkmanager "ndk;23.1.7779620" - #[clap(long, short, multiple_values = true)] + #[clap(long, short, action = ArgAction::Append)] pub install: Option>, /// Android package that needs to be uninstalled #[clap(long)] diff --git a/crossbundle/cli/src/lib.rs b/crossbundle/cli/src/lib.rs index fe0e8726..f825f143 100644 --- a/crossbundle/cli/src/lib.rs +++ b/crossbundle/cli/src/lib.rs @@ -5,7 +5,7 @@ pub mod commands; pub mod error; pub mod types; -use clap::Parser; +use clap::{ArgAction, Parser}; use colored::Colorize; use commands::*; use crossbundle_tools::types::{Config, Shell, Verbosity}; @@ -18,7 +18,7 @@ pub struct Opts { #[clap(short, long)] pub current_dir: Option, /// A level of verbosity, and can be used multiple times - #[clap(short, long, parse(from_occurrences))] + #[clap(short, long, action = ArgAction::Count)] pub verbose: u32, /// No output printed to stdout #[clap(short, long)] diff --git a/crossbundle/tools/Cargo.toml b/crossbundle/tools/Cargo.toml index 256c924a..21d69303 100644 --- a/crossbundle/tools/Cargo.toml +++ b/crossbundle/tools/Cargo.toml @@ -15,30 +15,29 @@ crossbow-android = { version = "0.2.3", path = "../../platform/android", default apple-bundle = { version = "0.1.4", optional = true } simctl = { version = "0.1.1", package = "creator-simctl", optional = true } # Android crates -android-manifest = { version = "0.1.10", optional = true } +android-manifest = { version = "0.2.0", optional = true } android-tools = { version = "0.2.11", optional = true } serde = { version = "1.0", features = ["derive"] } serde_plain = "1.0" dunce = "1.0" -fs_extra = "1.2" -dirs = "4.0" -which = "4.2" -tempfile = "3.3" -zip = "0.5" -zip-extensions = "0.6.1" +fs_extra = "1.3" +dirs = "5.0" +which = "6.0" +tempfile = "3.10" +zip = "0.6" image = { version = "0.24.3", default-features = false, features = ["png", "jpeg"] } -itertools = "0.10" -cargo = "0.63.1" -cargo-util = "0.2.0" +itertools = "0.12" +cargo = "0.77" +cargo-util = "0.2" thiserror = "1.0" anyhow = "1.0" displaydoc = "0.2" log = "0.4" -termcolor = "1.1" +termcolor = "1.4" atty = "0.2" [target.'cfg(unix)'.dependencies] diff --git a/crossbundle/tools/src/commands/android/common/write_zip.rs b/crossbundle/tools/src/commands/android/common/write_zip.rs index 9d32eec3..ec19b6b7 100644 --- a/crossbundle/tools/src/commands/android/common/write_zip.rs +++ b/crossbundle/tools/src/commands/android/common/write_zip.rs @@ -1,12 +1,11 @@ use std::path::Path; -use zip::ZipWriter; -use zip_extensions::write::ZipWriterExtensions; +use zip::{write::FileOptions, ZipWriter}; /// Writing files into archive pub fn zip_write(source_path: &Path, archive_file: &Path) -> zip::result::ZipResult<()> { let file = std::fs::File::create(archive_file)?; let mut zip = ZipWriter::new(file); - zip.create_from_directory(&source_path.to_path_buf())?; + zip.add_directory(source_path.to_str().unwrap(), FileOptions::default())?; Ok(()) } diff --git a/crossbundle/tools/src/types/android/manifest.rs b/crossbundle/tools/src/types/android/manifest.rs index c8ee4d02..356af3c0 100644 --- a/crossbundle/tools/src/types/android/manifest.rs +++ b/crossbundle/tools/src/types/android/manifest.rs @@ -27,7 +27,8 @@ pub fn update_android_manifest_with_default( }); } if manifest.application.has_code.is_none() { - manifest.application.has_code = Some(strategy == AndroidStrategy::GradleApk); + manifest.application.has_code = + VarOrBool::Bool(strategy == AndroidStrategy::GradleApk).into(); } if manifest.application.label.is_none() { manifest.application.label = Some(StringResourceOrString::string( @@ -44,7 +45,7 @@ pub fn update_android_manifest_with_default( manifest.application.activity = vec![Activity::default()]; } if manifest.application.activity.len() == 1 { - let mut activity = manifest.application.activity.get_mut(0).unwrap(); + let activity = manifest.application.activity.get_mut(0).unwrap(); if activity.name.is_empty() { activity.name = match strategy == AndroidStrategy::GradleApk { true => "com.crossbow.game.CrossbowApp".to_string(), @@ -52,10 +53,10 @@ pub fn update_android_manifest_with_default( }; } if activity.resizeable_activity.is_none() { - activity.resizeable_activity = Some(true); + activity.resizeable_activity = VarOrBool::Bool(true).into(); } if activity.exported.is_none() { - activity.exported = Some(true); + activity.exported = VarOrBool::Bool(true).into(); } if !activity .meta_data From 4f4ba68128c04d7313994bbe70d6c2500849f5dc Mon Sep 17 00:00:00 2001 From: David Date: Wed, 28 Feb 2024 00:34:02 +0700 Subject: [PATCH 2/4] fix: try fix CI --- .github/workflows/ci.yml | 2 +- Cargo.toml | 6 +++--- examples/crossbow-plugins/Cargo.toml | 2 +- examples/macroquad-3d/Cargo.toml | 2 +- examples/macroquad-3d/src/main.rs | 14 ++++++++++---- examples/macroquad-permissions/Cargo.toml | 2 +- rustfmt.toml | 12 ++++++++++-- 7 files changed, 27 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1ca00d74..446d45be 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -116,7 +116,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: nightly + toolchain: stable components: rustfmt, clippy override: true - name: Check the format diff --git a/Cargo.toml b/Cargo.toml index 85b85c2e..51bed422 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,9 +26,9 @@ crossbow-android = { path = "platform/android", version = "0.2.3", optional = tr [target.'cfg(target_os = "ios")'.dependencies] crossbow-ios = { path = "platform/ios", version = "0.2.3", optional = true } -[patch.crates-io] -bevy = { git = "https://github.com/dodorare/bevy", rev = "732fc8c585ebd3a622153771a8c51ace93024a04" } -miniquad = { git = "https://github.com/not-fl3/miniquad", rev = "d67ffe6950cf73df307e2d23aaa4726f14399985" } +# [patch.crates-io] +# bevy = { git = "https://github.com/dodorare/bevy", rev = "732fc8c585ebd3a622153771a8c51ace93024a04" } +# miniquad = { git = "https://github.com/not-fl3/miniquad", rev = "d67ffe6950cf73df307e2d23aaa4726f14399985" } [features] default = ["android", "ios"] diff --git a/examples/crossbow-plugins/Cargo.toml b/examples/crossbow-plugins/Cargo.toml index 5954e021..a5209b94 100644 --- a/examples/crossbow-plugins/Cargo.toml +++ b/examples/crossbow-plugins/Cargo.toml @@ -8,7 +8,7 @@ edition = "2021" crossbow = { version = "0.2.3", path = "../../" } log = "0.4" anyhow = "1.0" -macroquad = "=0.3.7" +macroquad = "0.4.5" [target.'cfg(target_os = "android")'.dependencies] play-core = { version = "0.2.3", path = "../../plugins/play-core" } diff --git a/examples/macroquad-3d/Cargo.toml b/examples/macroquad-3d/Cargo.toml index 417fec51..dd137424 100644 --- a/examples/macroquad-3d/Cargo.toml +++ b/examples/macroquad-3d/Cargo.toml @@ -8,7 +8,7 @@ edition = "2021" crossbow = { version = "0.2.3", path = "../../" } log = "0.4" anyhow = "1.0" -macroquad = "=0.3.7" +macroquad = "0.4.5" [package.metadata] app_name = "Macroquad 3D" diff --git a/examples/macroquad-3d/src/main.rs b/examples/macroquad-3d/src/main.rs index 403f0953..5dbbc378 100644 --- a/examples/macroquad-3d/src/main.rs +++ b/examples/macroquad-3d/src/main.rs @@ -26,10 +26,15 @@ async fn main() -> anyhow::Result<()> { draw_cube_wires(vec3(0., 1., 6.), vec3(2., 2., 2.), DARKBLUE); draw_cube_wires(vec3(2., 1., 2.), vec3(2., 2., 2.), YELLOW); - draw_plane(vec3(-8., 0., -8.), vec2(5., 5.), rust_logo, WHITE); - - draw_cube(vec3(-5., 1., -2.), vec3(2., 2., 2.), rust_logo, WHITE); - draw_cube(vec3(-5., 1., 2.), vec3(2., 2., 2.), rust_logo, WHITE); + draw_plane(vec3(-8., 0., -8.), vec2(5., 5.), Some(&rust_logo), WHITE); + + draw_cube( + vec3(-5., 1., -2.), + vec3(2., 2., 2.), + Some(&rust_logo), + WHITE, + ); + draw_cube(vec3(-5., 1., 2.), vec3(2., 2., 2.), Some(&rust_logo), WHITE); draw_cube(vec3(2., 0., -2.), vec3(0.4, 0.4, 0.4), None, BLACK); draw_sphere(vec3(-8., 0., 0.), 1., None, BLUE); @@ -45,6 +50,7 @@ async fn main() -> anyhow::Result<()> { // Workaround. Failed to get assets on windows from the macroquad .load_texture() method // through the relative path to asset +#[cfg(not(target_os = "android"))] fn get_assets_from_path() -> String { let manifest_dir = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")); let assets_dir = manifest_dir.parent().unwrap().parent().unwrap(); diff --git a/examples/macroquad-permissions/Cargo.toml b/examples/macroquad-permissions/Cargo.toml index e0f46a61..4d03f716 100644 --- a/examples/macroquad-permissions/Cargo.toml +++ b/examples/macroquad-permissions/Cargo.toml @@ -8,7 +8,7 @@ edition = "2021" crossbow = { version = "0.2.3", path = "../../" } log = "0.4" anyhow = "1.0" -macroquad = "=0.3.7" +macroquad = "0.4.5" [target.'cfg(target_os = "android")'.dependencies] admob-android = { version = "0.2.3", path = "../../plugins/admob-android" } diff --git a/rustfmt.toml b/rustfmt.toml index 139f7e36..11fa61c0 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1,2 +1,10 @@ -comment_width = 90 -wrap_comments = true +use_field_init_shorthand = true +newline_style = "Unix" + +# The following lines may be uncommented on nightly Rust. +# Once these features have stabilized, they should be added to the always-enabled options above. +# unstable_features = true +# imports_granularity = "Crate" +# wrap_comments = true +# comment_width = 100 +# normalize_comments = true From fc4558abf9615a6d25538ca6c11288ec37bc010a Mon Sep 17 00:00:00 2001 From: David Date: Wed, 28 Feb 2024 01:34:37 +0700 Subject: [PATCH 3/4] fix: another try --- .github/workflows/ci.yml | 2 +- .../commands/android/common/rust_compile/gen_tmp_lib_file.rs | 2 +- .../commands/android/common/rust_compile/rust_compiler.rs | 4 ++-- .../commands/android/common/rust_compile/set_linker_args.rs | 2 +- crossbundle/tools/src/commands/android/common/write_zip.rs | 2 +- .../src/commands/android/native/apk/add_libs_into_apk.rs | 4 ++-- .../tools/src/commands/common/gen_minimal_project/consts.rs | 5 +---- 7 files changed, 9 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 446d45be..26959bdc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -122,7 +122,7 @@ jobs: - name: Check the format run: | cd crossbundle/cli/ - cargo +nightly fmt --all -- --check + cargo fmt --all -- --check - name: Run clippy run: | cd crossbundle/cli/ diff --git a/crossbundle/tools/src/commands/android/common/rust_compile/gen_tmp_lib_file.rs b/crossbundle/tools/src/commands/android/common/rust_compile/gen_tmp_lib_file.rs index 8880da23..dddadab9 100644 --- a/crossbundle/tools/src/commands/android/common/rust_compile/gen_tmp_lib_file.rs +++ b/crossbundle/tools/src/commands/android/common/rust_compile/gen_tmp_lib_file.rs @@ -12,7 +12,7 @@ pub fn generate_lib_file(path: &Path, extra_code: &'static str) -> CargoResult fs_extra::error::Result<()> { } let mut options = fs_extra::file::CopyOptions::new(); options.overwrite = true; - fs_extra::file::move_file(&path, &manifest_path.join("AndroidManifest.xml"), &options)?; + fs_extra::file::move_file(&path, manifest_path.join("AndroidManifest.xml"), &options)?; } Ok(()) } diff --git a/crossbundle/tools/src/commands/android/native/apk/add_libs_into_apk.rs b/crossbundle/tools/src/commands/android/native/apk/add_libs_into_apk.rs index f94ab59c..8000929b 100644 --- a/crossbundle/tools/src/commands/android/native/apk/add_libs_into_apk.rs +++ b/crossbundle/tools/src/commands/android/native/apk/add_libs_into_apk.rs @@ -65,10 +65,10 @@ fn aapt_add_lib( } std::fs::create_dir_all(out_dir)?; let file_name = lib_path.file_name().unwrap(); - std::fs::copy(lib_path, &out_dir.join(file_name))?; + std::fs::copy(lib_path, out_dir.join(file_name))?; let native_lib_path = apk_path.parent().unwrap().join("lib").join(abi); std::fs::create_dir_all(&native_lib_path)?; - std::fs::copy(lib_path, &native_lib_path.join(file_name))?; + std::fs::copy(lib_path, native_lib_path.join(file_name))?; // `aapt a[dd] [-v] file.{zip,jar,apk} file1 [file2 ...]` // Add specified files to Zip-compatible archive let mut aapt = sdk.build_tool(bin!("aapt"), Some(apk_path.parent().unwrap()))?; diff --git a/crossbundle/tools/src/commands/common/gen_minimal_project/consts.rs b/crossbundle/tools/src/commands/common/gen_minimal_project/consts.rs index 2a66ed22..a0e23634 100644 --- a/crossbundle/tools/src/commands/common/gen_minimal_project/consts.rs +++ b/crossbundle/tools/src/commands/common/gen_minimal_project/consts.rs @@ -21,10 +21,7 @@ edition = "2021" [dependencies] crossbow = { git = "https://github.com/dodorare/crossbow" } anyhow = "1.0" -macroquad = "=0.3.7" - -[patch.crates-io] -miniquad = { git = "https://github.com/not-fl3/miniquad", rev = "d67ffe6950cf73df307e2d23aaa4726f14399985" } +macroquad = "0.4.5" [package.metadata.android] app_wrapper = "quad" From 3d8b819291e3c5984d1eb888bb4e389c4f511455 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 28 Feb 2024 01:49:37 +0700 Subject: [PATCH 4/4] fix: ci lint --- .github/workflows/ci.yml | 2 +- crossbundle/cli/src/commands/build/android.rs | 6 +++--- crossbundle/cli/src/commands/build/apple.rs | 6 +++--- crossbundle/cli/src/commands/install/mod.rs | 2 +- crossbundle/cli/src/error.rs | 2 +- crossbundle/cli/tests/cargo_metadata.rs | 2 +- crossbundle/tools/src/commands/apple/save_plist.rs | 2 +- crossbundle/tools/tests/apple_full.rs | 4 ++-- crossbundle/tools/tests/bundletool.rs | 2 +- docs/src/contributing/contribute-code.md | 2 +- 10 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 26959bdc..9f65553d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -126,7 +126,7 @@ jobs: - name: Run clippy run: | cd crossbundle/cli/ - cargo clippy --all-targets --all-features -- -D warnings -A clippy::unnecessary-unwrap -A clippy::too-many-arguments + cargo clippy --all-targets --all-features -- -D warnings -A clippy::unnecessary-unwrap -A clippy::too-many-arguments -A clippy::result_large_err - name: Check for deadlinks run: | cargo install cargo-deadlinks diff --git a/crossbundle/cli/src/commands/build/android.rs b/crossbundle/cli/src/commands/build/android.rs index e353963c..cca64707 100644 --- a/crossbundle/cli/src/commands/build/android.rs +++ b/crossbundle/cli/src/commands/build/android.rs @@ -401,7 +401,7 @@ impl AndroidBuildCommand { let aab_output_path = outputs_build_dir.join(output_aab); let mut options = fs_extra::file::CopyOptions::new(); options.overwrite = true; - fs_extra::file::move_file(&signed_aab, &outputs_build_dir.join(output_aab), &options)?; + fs_extra::file::move_file(&signed_aab, outputs_build_dir.join(output_aab), &options)?; config.status("Build finished successfully")?; Ok((manifest, sdk, aab_output_path, package_name, key)) } @@ -529,10 +529,10 @@ impl AndroidBuildCommand { pub fn android_build_targets( context: &BuildContext, profile: Profile, - build_targets: &Vec, + build_targets: &[AndroidTarget], ) -> Vec { if !build_targets.is_empty() { - return build_targets.clone(); + return build_targets.into(); }; if profile == Profile::Debug && !context.config.android.debug_build_targets.is_empty() { return context.config.android.debug_build_targets.clone(); diff --git a/crossbundle/cli/src/commands/build/apple.rs b/crossbundle/cli/src/commands/build/apple.rs index f0fcafad..8aa8b463 100644 --- a/crossbundle/cli/src/commands/build/apple.rs +++ b/crossbundle/cli/src/commands/build/apple.rs @@ -125,7 +125,7 @@ impl IosBuildCommand { let app_path = apple::gen_apple_app_folder(apple_target_dir, name, assets, resources)?; config.status("Copying binary to app folder")?; - std::fs::copy(&bin_path, &app_path.join(name)).unwrap(); + std::fs::copy(bin_path, app_path.join(name)).unwrap(); config.status_message("Generating", "Info.plist")?; apple::save_info_plist(&app_path, properties, false).unwrap(); @@ -163,10 +163,10 @@ impl IosBuildCommand { pub fn apple_build_targets( context: &BuildContext, profile: Profile, - build_targets: &Vec, + build_targets: &[IosTarget], ) -> Vec { if !build_targets.is_empty() { - return build_targets.clone(); + return build_targets.into(); } if profile == Profile::Debug && !context.config.apple.debug_build_targets.is_empty() { return context.config.apple.debug_build_targets.clone(); diff --git a/crossbundle/cli/src/commands/install/mod.rs b/crossbundle/cli/src/commands/install/mod.rs index 06c02b03..08e5c3a5 100644 --- a/crossbundle/cli/src/commands/install/mod.rs +++ b/crossbundle/cli/src/commands/install/mod.rs @@ -80,7 +80,7 @@ impl InstallCommand { pub fn download_to_file(download_url: &str, file_path: &std::path::Path) -> Result<()> { let response = ureq::get(download_url) .call() - .map_err(Error::DownloadFailed)?; + .map_err(|e| Error::DownloadFailed(Box::from(e)))?; let mut out = std::fs::File::create(file_path).map_err(|cause| Error::JarFileCreationFailed { path: file_path.to_path_buf(), diff --git a/crossbundle/cli/src/error.rs b/crossbundle/cli/src/error.rs index a0bc4724..7839be57 100644 --- a/crossbundle/cli/src/error.rs +++ b/crossbundle/cli/src/error.rs @@ -31,7 +31,7 @@ pub enum Error { /// Home dir not found HomeDirNotFound, /// Failed to download jar file: {0:?} - DownloadFailed(ureq::Error), + DownloadFailed(Box), /// Failed to create jar file in specified path `{path}` cause of `{cause}` JarFileCreationFailed { path: std::path::PathBuf, diff --git a/crossbundle/cli/tests/cargo_metadata.rs b/crossbundle/cli/tests/cargo_metadata.rs index 5d7d0b44..8ed121a9 100644 --- a/crossbundle/cli/tests/cargo_metadata.rs +++ b/crossbundle/cli/tests/cargo_metadata.rs @@ -31,7 +31,7 @@ fn test_cargo_metadata() { let example = android_build_command.shared.example.as_ref(); let (_, _, package_name) = AndroidBuildCommand::needed_project_dirs(example, &context).unwrap(); config - .status_message("Starting apk build process", &package_name) + .status_message("Starting apk build process", package_name) .unwrap(); let android_manifest = diff --git a/crossbundle/tools/src/commands/apple/save_plist.rs b/crossbundle/tools/src/commands/apple/save_plist.rs index bfa5d069..dc904ebd 100644 --- a/crossbundle/tools/src/commands/apple/save_plist.rs +++ b/crossbundle/tools/src/commands/apple/save_plist.rs @@ -106,7 +106,7 @@ mod tests { }; save_info_plist(dir.path(), &properties, false).unwrap(); let file_path = dir.path().join("Info.plist"); - let result = std::fs::read_to_string(&file_path).unwrap(); + let result = std::fs::read_to_string(file_path).unwrap(); assert_eq!(result, PLIST_TEST_EXAMPLE.replace(" ", "\t")); // TODO: Fix this. Should be equivalent // let got_props: InfoPlist = plist::from_file(&file_path).unwrap(); diff --git a/crossbundle/tools/tests/apple_full.rs b/crossbundle/tools/tests/apple_full.rs index 19c57d53..c7cd65b7 100644 --- a/crossbundle/tools/tests/apple_full.rs +++ b/crossbundle/tools/tests/apple_full.rs @@ -86,11 +86,11 @@ fn test_apple_full() { let out_dir = dir .join("target") .join(build_target.rust_triple()) - .join(&profile); + .join(profile); // Copy binary to app folder let bin_path = out_dir.join(&name); - std::fs::copy(&bin_path, &app_dir.join(&name)).unwrap(); + std::fs::copy(bin_path, app_dir.join(&name)).unwrap(); // Generate Info.plist let properties = get_minimal_info_plist(&name); diff --git a/crossbundle/tools/tests/bundletool.rs b/crossbundle/tools/tests/bundletool.rs index 4a9f9cf6..b01f8cfd 100644 --- a/crossbundle/tools/tests/bundletool.rs +++ b/crossbundle/tools/tests/bundletool.rs @@ -114,7 +114,7 @@ fn build_bundle_test() { // Replaces unsigned aab with signed aab let signed_aab = build_dir.join(format!("{}_signed.aab", package_name)); - std::fs::rename(&aab_path, &signed_aab).unwrap(); + std::fs::rename(&aab_path, signed_aab).unwrap(); // Defines apk path from build directory for apk in std::fs::read_dir(build_dir).unwrap() { diff --git a/docs/src/contributing/contribute-code.md b/docs/src/contributing/contribute-code.md index 48915bb5..09630643 100644 --- a/docs/src/contributing/contribute-code.md +++ b/docs/src/contributing/contribute-code.md @@ -6,7 +6,7 @@ Would you like to contribute code to Crossbow? Here's how! 2. Make your changes in a local clone of your fork. 3. For a higher chance of CI passing the first time, consider run these commands from the root of your local clone: 1. `cargo fmt --all -- --check` (remove --check to let the command fix found problems) - 2. `cargo clippy --all-targets --all-features -- -D warnings -A clippy::unnecessary-unwrap -A clippy::too-many-arguments` + 2. `cargo clippy --all-targets --all-features -- -D warnings -A clippy::unnecessary-unwrap -A clippy::too-many-arguments -A clippy::result_large_err` 3. `cargo test --all-targets --workspace` 4. Push your changes to your fork and open a Pull Request. 5. Respond to any CI failures or review feedback.