diff --git a/Cargo.toml b/Cargo.toml index becebe8a..c96c08d7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "crossbow" -version = "0.2.3" +version = "0.2.4" edition = "2021" authors = ["DodoRare Team "] description = "Cross-Platform build tools and toolkit for games" @@ -21,10 +21,10 @@ apple-bundle = { version = "0.1.4", optional = true } [target.'cfg(target_os = "android")'.dependencies] ndk-glue = "0.7.0" -crossbow-android = { path = "platform/android", version = "0.2.3", optional = true } +crossbow-android = { path = "platform/android", version = "0.2.4", optional = true } [target.'cfg(target_os = "ios")'.dependencies] -crossbow-ios = { path = "platform/ios", version = "0.2.3", optional = true } +crossbow-ios = { path = "platform/ios", version = "0.2.4", optional = true } [patch.crates-io] bevy = { git = "https://github.com/dodorare/bevy", rev = "732fc8c585ebd3a622153771a8c51ace93024a04" } diff --git a/crossbundle/cli/Cargo.toml b/crossbundle/cli/Cargo.toml index 6996c5a6..0d3a0b73 100644 --- a/crossbundle/cli/Cargo.toml +++ b/crossbundle/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "crossbundle" -version = "0.2.3" +version = "0.2.4" edition = "2021" authors = ["DodoRare Team "] description = "Build and publish apps for Android/iOS" @@ -18,8 +18,8 @@ name = "crossbundle" path = "src/main.rs" [dependencies] -crossbow = { path = "../../", version = "0.2.3", default-features = false, features = ["update-manifest"] } -crossbundle-tools = { path = "../tools", version = "0.2.3", default-features = false } +crossbow = { path = "../../", version = "0.2.4", default-features = false, features = ["update-manifest"] } +crossbundle-tools = { path = "../tools", version = "0.2.4", default-features = false } android-tools = { version = "0.2.11", optional = true } clap = { version = "3.2", features = ["derive"] } serde = { version = "1.0", features = ["derive"] } diff --git a/crossbundle/cli/src/commands/build/android.rs b/crossbundle/cli/src/commands/build/android.rs index fd8d9231..33612f0f 100644 --- a/crossbundle/cli/src/commands/build/android.rs +++ b/crossbundle/cli/src/commands/build/android.rs @@ -3,6 +3,7 @@ use crate::{error::*, types::CrossbowMetadata}; use android_manifest::AndroidManifest; use android_tools::java_tools::{JarSigner, Key}; use clap::Parser; + use crossbundle_tools::{ commands::{android::*, combine_folders}, error::CommandExt, @@ -21,24 +22,27 @@ pub struct AndroidBuildCommand { #[clap(long, short, multiple_values = true)] pub target: Vec, /// Build strategy specifies what and how to build Android application: with help of - /// Gradle, or with our native approach. + /// Gradle, or with our native approach #[clap(long, short, default_value = "gradle-apk")] pub strategy: AndroidStrategy, /// Only compile rust code as a dynamic library. By default: "crossbow-android" #[clap(long, default_missing_value = "crossbow_android")] pub lib: Option, - /// Path to export Gradle project. By default exports to `target/android/` folder. + /// Path to export Gradle project. By default exports to `target/android/` folder #[clap(long)] pub export_path: Option, - /// Path to the signing key. + /// Path to the signing key #[clap(long, requires_all = &["sign-key-pass", "sign-key-alias"])] pub sign_key_path: Option, - /// Signing key password. + /// Signing key password #[clap(long)] pub sign_key_pass: Option, - /// Signing key alias. + /// Signing key alias #[clap(long)] pub sign_key_alias: Option, + /// Native compile for bevy projects without cargo Executor trait invocations + #[clap(long, short)] + pub bevy_compile: bool, } impl AndroidBuildCommand { @@ -182,7 +186,7 @@ impl AndroidBuildCommand { std::fs::create_dir_all(&out_dir)?; } let file_name = compiled_lib.file_name().unwrap().to_owned(); - std::fs::copy(compiled_lib, &out_dir.join(&file_name))?; + std::fs::copy(compiled_lib, out_dir.join(file_name))?; } Ok(()) } @@ -197,6 +201,7 @@ impl AndroidBuildCommand { let example = self.shared.example.as_ref(); let (project_path, target_dir, package_name) = Self::needed_project_dirs(example, context)?; config.status_message("Starting apk build process", &package_name)?; + let (sdk, ndk) = Self::android_toolchain()?; let android_build_dir = target_dir.join("android").join(&package_name); @@ -401,7 +406,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)) } @@ -413,7 +418,7 @@ impl AndroidBuildCommand { ) -> Result<(PathBuf, PathBuf, String)> { let project_path: PathBuf = context.project_path.clone(); let target_dir: PathBuf = context.target_dir.clone(); - let (_target, package_name) = if let Some(example) = example { + let (_, package_name) = if let Some(example) = example { (Target::Example(example.clone()), example.clone()) } else { (Target::Lib, context.package_name()) @@ -483,19 +488,23 @@ impl AndroidBuildCommand { let rust_triple = build_target.rust_triple(); config.status_message("Compiling for architecture", rust_triple)?; - // Compile rust code for android depending on application wrapper - rust_compile( - ndk, - build_target, - project_path, - profile, - self.shared.features.clone(), - self.shared.all_features, - self.shared.no_default_features, - target_sdk_version, - &lib_name, - context.config.android.app_wrapper, - )?; + // Compile rust code for android depending on application wrapper and `--bevy-compile` + // flag + match self.bevy_compile { + true => bevy_native_compile(build_target, target_dir, target_sdk_version, ndk)?, + false => rust_compile( + ndk, + build_target, + project_path, + profile, + self.shared.features.clone(), + self.shared.all_features, + self.shared.no_default_features, + target_sdk_version, + &lib_name, + context.config.android.app_wrapper, + )?, + } let out_dir = target_dir.join(build_target.rust_triple()).join(profile); let compiled_lib = out_dir.join(lib_name); diff --git a/crossbundle/cli/src/commands/build/apple.rs b/crossbundle/cli/src/commands/build/apple.rs index e23c2b56..3f16e6a2 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(); 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/derive/Cargo.toml b/crossbundle/derive/Cargo.toml new file mode 100644 index 00000000..0d1dd909 --- /dev/null +++ b/crossbundle/derive/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "crossbundle-derive" +version = "0.2.4" +edition = "2021" +authors = ["DodoRare Team "] +description = "Cross-Platform Rust Toolkit for Games 🏹" +repository = "https://github.com/dodorare/crossbow" +license = "Apache-2.0" +keywords = ["derive", "android", "ios"] +readme = "README.md" + +[lib] +proc-macro = true + +[dependencies] +proc-macro2 = "1.0" +quote = "1.0" +syn = { version = "1.0", features = ["full"] } \ No newline at end of file diff --git a/crossbundle/derive/src/lib.rs b/crossbundle/derive/src/lib.rs new file mode 100644 index 00000000..4a1b30f9 --- /dev/null +++ b/crossbundle/derive/src/lib.rs @@ -0,0 +1,36 @@ +extern crate proc_macro; + +use proc_macro::TokenStream; +use quote::quote; +use syn::{parse_macro_input, ItemFn}; + +fn crossbundle_main_logic(_attr: TokenStream, item: TokenStream) -> TokenStream { + let input = parse_macro_input!(item as ItemFn); + if input.sig.ident != "main" { + panic!("crossbundle_main can only be used on a function called 'main'") + } + TokenStream::from(quote! { + #[no_mangle] + #[cfg(target_os = "android")] + unsafe extern "C" fn ANativeActivity_onCreate( + activity: *mut std::os::raw::c_void, + saved_state: *mut std::os::raw::c_void, + saved_state_size: usize, + ) { + crossbow::ndk_glue::init( + activity as _, + saved_state as _, + saved_state_size as _, + main, + ); + } + + #[allow(unused)] + #input + }) +} + +#[proc_macro_attribute] +pub fn crossbundle_main(attr: TokenStream, item: TokenStream) -> TokenStream { + crossbundle_main_logic(attr, item) +} diff --git a/crossbundle/tools/Cargo.toml b/crossbundle/tools/Cargo.toml index 256c924a..29298f94 100644 --- a/crossbundle/tools/Cargo.toml +++ b/crossbundle/tools/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "crossbundle-tools" -version = "0.2.3" +version = "0.2.4" edition = "2021" authors = ["DodoRare Team "] description = "Build and publish apps for Android/iOS" @@ -10,7 +10,7 @@ keywords = ["android", "ios"] readme = "README.md" [dependencies] -crossbow-android = { version = "0.2.3", path = "../../platform/android", default-features = false, features = ["embed"] } +crossbow-android = { version = "0.2.4", path = "../../platform/android", default-features = false, features = ["embed"] } # Apple crates apple-bundle = { version = "0.1.4", optional = true } simctl = { version = "0.1.1", package = "creator-simctl", optional = true } diff --git a/crossbundle/tools/src/commands/android/common/rust_compile/bevy_native_compiler.rs b/crossbundle/tools/src/commands/android/common/rust_compile/bevy_native_compiler.rs new file mode 100644 index 00000000..b2a0b611 --- /dev/null +++ b/crossbundle/tools/src/commands/android/common/rust_compile/bevy_native_compiler.rs @@ -0,0 +1,90 @@ +use crate::{commands::android::cargo_env_target_cfg, error::*, types::*}; +use std::path::Path; + +/// Use cargo inner features to build bevy project to avoid cargo Executor trait using. +/// Required to add `[lib]` section in `Cargo.toml` with cdylib crate-type. For correct +/// app working in runtime use crossbundle derive macro. For more information see +/// crossbundle build command docs. +pub fn bevy_native_compile( + build_target: AndroidTarget, + target_dir: &Path, + target_sdk_version: u32, + ndk: &AndroidNdk, +) -> Result<()> { + let mut cargo = std::process::Command::new("cargo"); + let triple = build_target.rust_triple(); + let clang_target = format!( + "--target={}{}", + build_target.ndk_llvm_triple(), + target_sdk_version + ); + let ar = ndk.toolchain_bin("ar", build_target)?; + + cargo.env(format!("AR_{}", triple), &ar); + cargo.env(cargo_env_target_cfg("AR", triple), &ar); + + // Read initial RUSTFLAGS + let mut rustflags = match std::env::var("CARGO_ENCODED_RUSTFLAGS") { + Ok(val) => val, + Err(std::env::VarError::NotPresent) => "".to_string(), + Err(std::env::VarError::NotUnicode(_)) => { + panic!("RUSTFLAGS environment variable contains non-unicode characters") + } + }; + + let (clang, clang_pp) = ndk.clang(build_target, target_sdk_version)?; + + // Configure cross-compiler for `cc` crate + // https://github.com/rust-lang/cc-rs#external-configuration-via-environment-variables + cargo.env(format!("CC_{}", triple), &clang); + cargo.env(format!("CFLAGS_{}", triple), &clang_target); + cargo.env(format!("CXX_{}", triple), &clang_pp); + cargo.env(format!("CXXFLAGS_{}", triple), &clang_target); + + // Configure LINKER for `rustc` + // https://doc.rust-lang.org/beta/cargo/reference/environment-variables.html#configuration-environment-variables + cargo.env(cargo_env_target_cfg("LINKER", triple), &clang); + if !rustflags.is_empty() { + rustflags.push('\x1f'); + } + + rustflags.push_str("-Clink-arg="); + rustflags.push_str(&clang_target); + + let ar = ndk.toolchain_bin("ar", build_target)?; + cargo.env(format!("AR_{}", triple), &ar); + cargo.env(cargo_env_target_cfg("AR", triple), &ar); + + // Workaround for https://github.com/rust-windowing/android-ndk-rs/issues/149: + // Rust (1.56 as of writing) still requires libgcc during linking, but this does + // not ship with the NDK anymore since NDK r23 beta 3. + // See https://github.com/rust-lang/rust/pull/85806 for a discussion on why libgcc + // is still required even after replacing it with libunwind in the source. + // XXX: Add an upper-bound on the Rust version whenever this is not necessary anymore. + if ndk.build_tag() > 7272597 { + let link_dir = target_dir.join("link-libraries"); + std::fs::create_dir_all(&link_dir).map_err(|_| Error::PathNotFound(link_dir.clone()))?; + let libgcc = link_dir.join("libgcc.a"); + std::fs::write(libgcc, "INPUT(-lunwind)") + .map_err(|_| Error::PathNotFound(link_dir.clone()))?; + + // cdylibs in transitive dependencies still get built and also need this + // workaround linker flag, yet arguments passed to `cargo rustc` are only + // forwarded to the final compiler invocation rendering our workaround ineffective. + // The cargo page documenting this discrepancy (https://doc.rust-lang.org/cargo/commands/cargo-rustc.html) + // suggests to resort to RUSTFLAGS. + // Note that `rustflags` will never be empty because of an unconditional `.push_str` + // above, so we can safely start with appending \x1f here. + rustflags.push_str("\x1f-L\x1f"); + rustflags.push_str(link_dir.to_str().expect("Target dir must be valid UTF-8")); + } + cargo.env("CARGO_ENCODED_RUSTFLAGS", rustflags); + + cargo.arg("rustc"); + cargo.arg("--lib"); + cargo.arg("--target").arg(triple); + + cargo.output_err(true)?; + + Ok(()) +} diff --git a/crossbundle/tools/src/commands/android/common/rust_compile/mod.rs b/crossbundle/tools/src/commands/android/common/rust_compile/mod.rs index f9fd4217..462f1689 100644 --- a/crossbundle/tools/src/commands/android/common/rust_compile/mod.rs +++ b/crossbundle/tools/src/commands/android/common/rust_compile/mod.rs @@ -1,3 +1,4 @@ +mod bevy_native_compiler; mod cmake_toolchain; mod compile_options; mod consts; @@ -5,6 +6,7 @@ mod gen_tmp_lib_file; mod rust_compiler; mod set_linker_args; +pub use bevy_native_compiler::*; pub use cmake_toolchain::*; pub use rust_compiler::*; pub use set_linker_args::*; diff --git a/crossbundle/tools/src/commands/android/common/rust_compile/rust_compiler.rs b/crossbundle/tools/src/commands/android/common/rust_compile/rust_compiler.rs index 62f7eb76..96e0b4b5 100644 --- a/crossbundle/tools/src/commands/android/common/rust_compile/rust_compiler.rs +++ b/crossbundle/tools/src/commands/android/common/rust_compile/rust_compiler.rs @@ -19,10 +19,10 @@ pub fn rust_compile( // Set environment variables needed for use with the cc crate let (clang, clang_pp) = ndk.clang(build_target, target_sdk_version)?; std::env::set_var(format!("CC_{}", rust_triple), &clang); - std::env::set_var(format!("CXX_{}", rust_triple), &clang_pp); + std::env::set_var(format!("CXX_{}", rust_triple), clang_pp); std::env::set_var(cargo_env_target_cfg("LINKER", rust_triple), &clang); let ar = ndk.toolchain_bin("ar", build_target)?; - std::env::set_var(format!("AR_{}", rust_triple), &ar); + std::env::set_var(format!("AR_{}", rust_triple), ar); let cargo_config = cargo::util::Config::default()?; let workspace = cargo::core::Workspace::new(&project_path.join("Cargo.toml"), &cargo_config)?; @@ -164,7 +164,7 @@ impl cargo::core::compiler::Executor for SharedLibraryExecutor { // XXX: Add an upper-bound on the Rust version whenever this is not necessary anymore. if self.ndk.build_tag() > 7272597 { let mut args = search_for_libgcc_and_libunwind( - &self.build_target, + self.build_target, build_path, &self.ndk, self.target_sdk_version, @@ -210,10 +210,3 @@ impl cargo::core::compiler::Executor for SharedLibraryExecutor { Ok(()) } } - -/// Helper function that allows to return environment argument with specified tool -pub fn cargo_env_target_cfg(tool: &str, target: &str) -> String { - let utarget = target.replace('-', "_"); - let env = format!("CARGO_TARGET_{}_{}", &utarget, tool); - env.to_uppercase() -} diff --git a/crossbundle/tools/src/commands/android/common/rust_compile/set_linker_args.rs b/crossbundle/tools/src/commands/android/common/rust_compile/set_linker_args.rs index abeaaaba..8eebdd3d 100644 --- a/crossbundle/tools/src/commands/android/common/rust_compile/set_linker_args.rs +++ b/crossbundle/tools/src/commands/android/common/rust_compile/set_linker_args.rs @@ -33,27 +33,34 @@ pub fn build_arg(start: &str, end: impl AsRef) -> std::ffi::OsS new_arg } +/// Helper function that allows to return environment argument with specified tool +pub fn cargo_env_target_cfg(tool: &str, target: &str) -> String { + let utarget = target.replace('-', "_"); + let env = format!("CARGO_TARGET_{}_{}", &utarget, tool); + env.to_uppercase() +} + /// Add path containing libgcc.a and libunwind.a for linker to search. /// See https://github.com/rust-lang/rust/pull/85806 for discussion on libgcc. /// The workaround to get to NDK r23 or newer is to create a libgcc.a file with /// the contents of 'INPUT(-lunwind)' to link in libunwind.a instead of libgcc.a pub fn search_for_libgcc_and_libunwind( - build_target: &AndroidTarget, + build_target: AndroidTarget, build_path: std::path::PathBuf, ndk: &AndroidNdk, target_sdk_version: u32, ) -> cargo::CargoResult> { let mut new_args = Vec::new(); - let linker_path = ndk.linker_path(build_target, target_sdk_version)?; + let linker_path = ndk.linker_path(&build_target, target_sdk_version)?; new_args.push(build_arg("-Clinker=", linker_path)); let libgcc_dir = build_path.join("_libgcc_"); std::fs::create_dir_all(&libgcc_dir)?; let libgcc = libgcc_dir.join("libgcc.a"); - std::fs::write(&libgcc, "INPUT(-lunwind)")?; + std::fs::write(libgcc, "INPUT(-lunwind)")?; new_args.push(build_arg("-Clink-arg=-L", libgcc_dir)); - let libunwind_dir = ndk.find_libunwind_dir(build_target)?; + let libunwind_dir = ndk.find_libunwind_dir(&build_target)?; new_args.push(build_arg("-Clink-arg=-L", libunwind_dir)); Ok(new_args) } diff --git a/crossbundle/tools/src/commands/android/common/write_zip.rs b/crossbundle/tools/src/commands/android/common/write_zip.rs index 9d32eec3..d96f91b8 100644 --- a/crossbundle/tools/src/commands/android/common/write_zip.rs +++ b/crossbundle/tools/src/commands/android/common/write_zip.rs @@ -20,7 +20,7 @@ pub fn zip_dirs_to_write(source_path: &Path) -> 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/tests/apple_full.rs b/crossbundle/tools/tests/apple_full.rs index 19c57d53..e69aca00 100644 --- a/crossbundle/tools/tests/apple_full.rs +++ b/crossbundle/tools/tests/apple_full.rs @@ -90,7 +90,7 @@ fn test_apple_full() { // 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/docs/src/crossbow/configuration.md b/docs/src/crossbow/configuration.md index 006beafc..e6662cc9 100644 --- a/docs/src/crossbow/configuration.md +++ b/docs/src/crossbow/configuration.md @@ -12,7 +12,7 @@ authors = ["Example "] edition = "2021" [dependencies] -crossbow = "0.2.3" +crossbow = "0.2.4" [package.metadata] # The user-friendly application name for your app. Displayed in the applications menu diff --git a/docs/src/crossbundle/command-build.md b/docs/src/crossbundle/command-build.md index 45893978..567bbfe4 100644 --- a/docs/src/crossbundle/command-build.md +++ b/docs/src/crossbundle/command-build.md @@ -36,3 +36,41 @@ To find out available commands specify the -h flag. ```sh crossbundle build android -h ``` + +## Crossbundle build native AAB/APK with `--bevy-compile` flag for bevy projects + +Alternative build opportunity that allows to avoid using cargo Executor trait. For correct building and app working process need to provide several steps: + +1. Add lib section to `Cargo.toml` with cdylib crate type: + +```toml +[lib] +crate-type = ["cdylib"] +path = "src/main.rs" +``` + +Note: Our examples using only main.rs as bin and as lib file so we need to set path to lib. You can create lib.rs file and set only crate type + +2. Add crossbundle derive crate to `Cargo.toml` to dependencies section: + +```toml +[dependencies] +crossbundle-derive = { path = "./../../crossbundle/derive", version = "0.2.4" } +``` + +3. Put crossbundle derive macro above main function to init Android Native Activity. + +```rust +#[crossbundle_derive::crossbundle_main] +fn main() { + // code +} +``` + +Use command below to build apk or aab: + +```sh +crossbundle build android -s=native-apk --bevy-compile +# or do you need AAB: +crossbundle build android -s=native-aab --bevy-compile +``` diff --git a/docs/src/crossbundle/command-run.md b/docs/src/crossbundle/command-run.md index 72a54709..e9fe564d 100644 --- a/docs/src/crossbundle/command-run.md +++ b/docs/src/crossbundle/command-run.md @@ -30,3 +30,16 @@ To find out available commands specify the -h flag. ```sh crossbundle run android -h ``` + +## Crossbundle run native AAB/APK with `--bevy-compile` flag for bevy projects + +Run your APK or AAB on device with the command below. The command build project with `--bevy-compile` flag. +See [crossbundle build command](command-build.md) to find out how to configure your project to compile it `--bevy-compile` flag. + +After configuration you can use the command below: + +```sh +crossbundle run android -s=native-apk --bevy-compile +# or do you need AAB: +crossbundle run android -s=native-aab --bevy-compile +``` diff --git a/docs/src/tutorials/in-app-updates.md b/docs/src/tutorials/in-app-updates.md index 2b39077a..c98a8140 100644 --- a/docs/src/tutorials/in-app-updates.md +++ b/docs/src/tutorials/in-app-updates.md @@ -26,9 +26,9 @@ Add Rust dependencies like this: ```toml [dependencies] -crossbow = "0.2.3" +crossbow = "0.2.4" [target.'cfg(target_os = "android")'.dependencies] -play-core = "0.2.3" +play-core = "0.2.4" ``` And finally, add this to your Crossbow Android configuration: diff --git a/docs/src/tutorials/play-billing.md b/docs/src/tutorials/play-billing.md index db18c6df..676db7c2 100644 --- a/docs/src/tutorials/play-billing.md +++ b/docs/src/tutorials/play-billing.md @@ -26,9 +26,9 @@ Just add Rust dependencies like this: ```toml [dependencies] -crossbow = "0.2.3" +crossbow = "0.2.4" [target.'cfg(target_os = "android")'.dependencies] -play-billing = "0.2.3" +play-billing = "0.2.4" ``` And finally, add this to your Crossbow Android configuration: diff --git a/examples/bevy-2d/Cargo.toml b/examples/bevy-2d/Cargo.toml index 947859b5..d658001f 100644 --- a/examples/bevy-2d/Cargo.toml +++ b/examples/bevy-2d/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "bevy-2d" -version = "0.2.3" +version = "0.2.4" authors = ["DodoRare Team "] edition = "2021" [dependencies] -crossbow = { version = "0.2.3", path = "../../" } +crossbow = { version = "0.2.4", path = "../../" } log = "0.4" anyhow = "1.0" bevy = { version = "0.8.1", default-features = false, features = ["bevy_winit", "render", "bevy_asset", "png"] } diff --git a/examples/bevy-explorer/Cargo.toml b/examples/bevy-explorer/Cargo.toml index 94e3a1d5..5c43c0d0 100644 --- a/examples/bevy-explorer/Cargo.toml +++ b/examples/bevy-explorer/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "bevy-explorer" -version = "0.2.3" +version = "0.2.4" authors = ["DodoRare Team "] edition = "2021" [dependencies] -crossbow = { version = "0.2.3", path = "../../" } +crossbow = { version = "0.2.4", path = "../../" } log = "0.4" anyhow = "1.0" subxt = "0.23.0" diff --git a/examples/crossbow-plugins/Cargo.toml b/examples/crossbow-plugins/Cargo.toml index 5954e021..0725a0e9 100644 --- a/examples/crossbow-plugins/Cargo.toml +++ b/examples/crossbow-plugins/Cargo.toml @@ -1,19 +1,19 @@ [package] name = "crossbow-plugins" -version = "0.2.3" +version = "0.2.4" authors = ["DodoRare Team "] edition = "2021" [dependencies] -crossbow = { version = "0.2.3", path = "../../" } +crossbow = { version = "0.2.4", path = "../../" } log = "0.4" anyhow = "1.0" macroquad = "=0.3.7" [target.'cfg(target_os = "android")'.dependencies] -play-core = { version = "0.2.3", path = "../../plugins/play-core" } -play-billing = { version = "0.2.3", path = "../../plugins/play-billing" } -play-games-services = { version = "0.2.3", path = "../../plugins/play-games-services" } +play-core = { version = "0.2.4", path = "../../plugins/play-core" } +play-billing = { version = "0.2.4", path = "../../plugins/play-billing" } +play-games-services = { version = "0.2.4", path = "../../plugins/play-games-services" } [package.metadata] app_name = "Crossbow Plugins" diff --git a/examples/macroquad-3d/Cargo.toml b/examples/macroquad-3d/Cargo.toml index 417fec51..d68d1732 100644 --- a/examples/macroquad-3d/Cargo.toml +++ b/examples/macroquad-3d/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "macroquad-3d" -version = "0.2.3" +version = "0.2.4" authors = ["DodoRare Team "] edition = "2021" [dependencies] -crossbow = { version = "0.2.3", path = "../../" } +crossbow = { version = "0.2.4", path = "../../" } log = "0.4" anyhow = "1.0" macroquad = "=0.3.7" diff --git a/examples/macroquad-permissions/Cargo.toml b/examples/macroquad-permissions/Cargo.toml index e0f46a61..04e388f4 100644 --- a/examples/macroquad-permissions/Cargo.toml +++ b/examples/macroquad-permissions/Cargo.toml @@ -1,17 +1,17 @@ [package] name = "macroquad-permissions" -version = "0.2.3" +version = "0.2.4" authors = ["DodoRare Team "] edition = "2021" [dependencies] -crossbow = { version = "0.2.3", path = "../../" } +crossbow = { version = "0.2.4", path = "../../" } log = "0.4" anyhow = "1.0" macroquad = "=0.3.7" [target.'cfg(target_os = "android")'.dependencies] -admob-android = { version = "0.2.3", path = "../../plugins/admob-android" } +admob-android = { version = "0.2.4", path = "../../plugins/admob-android" } [package.metadata] app_name = "Permissions" diff --git a/platform/android/Cargo.toml b/platform/android/Cargo.toml index f9f5ec1b..34625d58 100644 --- a/platform/android/Cargo.toml +++ b/platform/android/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "crossbow-android" -version = "0.2.3" +version = "0.2.4" edition = "2021" authors = ["DodoRare Team "] description = "Cross-Platform build tools and toolkit for games" diff --git a/platform/android/java/app/config.gradle b/platform/android/java/app/config.gradle index 25923d6e..ed81d17d 100644 --- a/platform/android/java/app/config.gradle +++ b/platform/android/java/app/config.gradle @@ -1,5 +1,5 @@ ext.versions = [ - crossbowLibrary : "0.2.3", + crossbowLibrary : "0.2.4", androidGradlePlugin: "7.0.0", compileSdk : 31, minSdk : 19, diff --git a/platform/ios/Cargo.toml b/platform/ios/Cargo.toml index 08869ec6..53470779 100644 --- a/platform/ios/Cargo.toml +++ b/platform/ios/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "crossbow-ios" -version = "0.2.3" +version = "0.2.4" edition = "2021" authors = ["DodoRare Team "] description = "Cross-Platform build tools and toolkit for games" diff --git a/plugins/admob-android/Cargo.toml b/plugins/admob-android/Cargo.toml index 92833559..d58666c9 100644 --- a/plugins/admob-android/Cargo.toml +++ b/plugins/admob-android/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "admob-android" -version = "0.2.3" +version = "0.2.4" edition = "2021" authors = ["DodoRare Team "] description = "AdMob Plugin for Crossbow" @@ -11,4 +11,4 @@ readme = "README.md" exclude = ["android/"] [dependencies] -crossbow-android = { path = "../../platform/android", version = "0.2.3" } +crossbow-android = { path = "../../platform/android", version = "0.2.4" } diff --git a/plugins/admob-android/README.md b/plugins/admob-android/README.md index 48d0207b..12ae7eae 100644 --- a/plugins/admob-android/README.md +++ b/plugins/admob-android/README.md @@ -27,9 +27,9 @@ Just add Rust dependencies like this: ```toml [dependencies] -crossbow = "0.2.3" +crossbow = "0.2.4" [target.'cfg(target_os = "android")'.dependencies] -admob-android = "0.2.3" +admob-android = "0.2.4" ``` And finally, add this to your Crossbow Android configuration: diff --git a/plugins/admob-android/android/config.gradle b/plugins/admob-android/android/config.gradle index e52c6016..e50cca91 100644 --- a/plugins/admob-android/android/config.gradle +++ b/plugins/admob-android/android/config.gradle @@ -1,5 +1,5 @@ ext.versions = [ - crossbowLibrary : "0.2.3", + crossbowLibrary : "0.2.4", androidGradlePlugin: "7.0.0", compileSdk : 31, minSdk : 19, diff --git a/plugins/play-billing/Cargo.toml b/plugins/play-billing/Cargo.toml index 4612f6ba..0ea75abc 100644 --- a/plugins/play-billing/Cargo.toml +++ b/plugins/play-billing/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "play-billing" -version = "0.2.3" +version = "0.2.4" edition = "2021" authors = ["DodoRare Team "] description = "Google Play Billing Plugin for Crossbow" @@ -11,4 +11,4 @@ readme = "README.md" exclude = ["android/"] [dependencies] -crossbow-android = { path = "../../platform/android", version = "0.2.3" } +crossbow-android = { path = "../../platform/android", version = "0.2.4" } diff --git a/plugins/play-billing/README.md b/plugins/play-billing/README.md index 163e8c21..08e5ce47 100644 --- a/plugins/play-billing/README.md +++ b/plugins/play-billing/README.md @@ -17,9 +17,9 @@ Just add Rust dependencies like this: ```toml [dependencies] -crossbow = "0.2.3" +crossbow = "0.2.4" [target.'cfg(target_os = "android")'.dependencies] -play-billing = "0.2.3" +play-billing = "0.2.4" ``` And finally, add this to your Crossbow Android configuration: diff --git a/plugins/play-billing/android/config.gradle b/plugins/play-billing/android/config.gradle index e52c6016..e50cca91 100644 --- a/plugins/play-billing/android/config.gradle +++ b/plugins/play-billing/android/config.gradle @@ -1,5 +1,5 @@ ext.versions = [ - crossbowLibrary : "0.2.3", + crossbowLibrary : "0.2.4", androidGradlePlugin: "7.0.0", compileSdk : 31, minSdk : 19, diff --git a/plugins/play-core/Cargo.toml b/plugins/play-core/Cargo.toml index 6c81e6d9..de43105f 100644 --- a/plugins/play-core/Cargo.toml +++ b/plugins/play-core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "play-core" -version = "0.2.3" +version = "0.2.4" edition = "2021" authors = ["DodoRare Team "] description = "Google Play Core Plugin for Crossbow" @@ -11,4 +11,4 @@ readme = "README.md" exclude = ["android/"] [dependencies] -crossbow-android = { path = "../../platform/android", version = "0.2.3" } +crossbow-android = { path = "../../platform/android", version = "0.2.4" } diff --git a/plugins/play-core/README.md b/plugins/play-core/README.md index e77f263f..cb4b39b8 100644 --- a/plugins/play-core/README.md +++ b/plugins/play-core/README.md @@ -17,9 +17,9 @@ Just add Rust dependencies like this: ```toml [dependencies] -crossbow = "0.2.3" +crossbow = "0.2.4" [target.'cfg(target_os = "android")'.dependencies] -play-core = "0.2.3" +play-core = "0.2.4" ``` And finally, add this to your Crossbow Android configuration: diff --git a/plugins/play-core/android/config.gradle b/plugins/play-core/android/config.gradle index e52c6016..e50cca91 100644 --- a/plugins/play-core/android/config.gradle +++ b/plugins/play-core/android/config.gradle @@ -1,5 +1,5 @@ ext.versions = [ - crossbowLibrary : "0.2.3", + crossbowLibrary : "0.2.4", androidGradlePlugin: "7.0.0", compileSdk : 31, minSdk : 19, diff --git a/plugins/play-games-services/Cargo.toml b/plugins/play-games-services/Cargo.toml index b7b393dd..3b1563e4 100644 --- a/plugins/play-games-services/Cargo.toml +++ b/plugins/play-games-services/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "play-games-services" -version = "0.2.3" +version = "0.2.4" edition = "2021" authors = ["DodoRare Team "] description = "Google Play Games Services Plugin for Crossbow" @@ -11,4 +11,4 @@ readme = "README.md" exclude = ["android/"] [dependencies] -crossbow-android = { path = "../../platform/android", version = "0.2.3" } +crossbow-android = { path = "../../platform/android", version = "0.2.4" } diff --git a/plugins/play-games-services/README.md b/plugins/play-games-services/README.md index e56cd7d2..5fd51899 100644 --- a/plugins/play-games-services/README.md +++ b/plugins/play-games-services/README.md @@ -29,9 +29,9 @@ Just add Rust dependencies like this: ```toml [dependencies] -crossbow = "0.2.3" +crossbow = "0.2.4" [target.'cfg(target_os = "android")'.dependencies] -play-games-services = "0.2.3" +play-games-services = "0.2.4" ``` And finally, add this to your Crossbow Android configuration: diff --git a/plugins/play-games-services/android/config.gradle b/plugins/play-games-services/android/config.gradle index e52c6016..e50cca91 100644 --- a/plugins/play-games-services/android/config.gradle +++ b/plugins/play-games-services/android/config.gradle @@ -1,5 +1,5 @@ ext.versions = [ - crossbowLibrary : "0.2.3", + crossbowLibrary : "0.2.4", androidGradlePlugin: "7.0.0", compileSdk : 31, minSdk : 19,