-
Notifications
You must be signed in to change notification settings - Fork 14
Optimize crossbow processes #99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 10 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
4c6bc1d
Add article about crossbow gradle
Heezay 0508004
Add test_execute_apk
Heezay 1b05ec2
Add test_execute_aab
Heezay e68faf2
Add test_build_gradle
Heezay 2f9a32c
Update crossbow-plugins.md
Heezay 1be7ede
Update build_gradle.rs
Heezay f51d359
Move tempfile into dev-dependencies
Heezay 8fe0118
Merge branch 'optimize-crossbow-processes' of https://github.com/dodo…
Heezay 2c51905
Remove assert in build_gradle
Heezay 3ef1400
Fix gen_minimal_project
Heezay ebb877a
Fix review issues
Heezay 5c035be
Fix code fmt
Heezay File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| use cli::{android::AndroidBuildCommand, BuildContext, SharedBuildCommand}; | ||
| use crossbundle_tools::{ | ||
| commands::gen_minimal_project, | ||
| types::AndroidTarget, | ||
| utils::{Config, Shell}, | ||
| }; | ||
|
|
||
| #[test] | ||
| /// Use macroquad minimal project in a temporary directory to test gradle project generation. It is working likewise the command below. | ||
Heezay marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| /// ```sh | ||
| /// crossbundle build android --quad --gradle | ||
| /// ``` | ||
| fn test_build_gradle() { | ||
| let tempdir = tempfile::tempdir().unwrap(); | ||
| let project_path = tempdir.path(); | ||
| let macroquad_project = true; | ||
| gen_minimal_project(&project_path, macroquad_project).unwrap(); | ||
|
|
||
| let target_dir = std::path::PathBuf::from(project_path).join("target"); | ||
| std::fs::create_dir_all(&target_dir).unwrap(); | ||
|
|
||
| let shell = Shell::new(); | ||
| let config = Config::new(shell, target_dir.clone()); | ||
| let context = BuildContext::new(&config, Some(target_dir.clone())).unwrap(); | ||
|
|
||
| let shared_build_command = SharedBuildCommand { | ||
| example: None, | ||
| features: vec![], | ||
| all_features: false, | ||
| no_default_features: false, | ||
| release: false, | ||
| target_dir: None, | ||
| quad: false, | ||
| }; | ||
|
|
||
| let android_build_command = AndroidBuildCommand { | ||
| shared: shared_build_command, | ||
| target: vec![AndroidTarget::Aarch64LinuxAndroid], | ||
| aab: false, | ||
| lib: None, | ||
| gradle: None, | ||
| sign_key_path: None, | ||
| sign_key_pass: None, | ||
| sign_key_alias: None, | ||
| }; | ||
|
|
||
| AndroidBuildCommand::build_gradle( | ||
| &android_build_command, | ||
| &config, | ||
| &context, | ||
| project_path.to_str().unwrap(), | ||
| ) | ||
| .unwrap(); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| use cli::{android::AndroidBuildCommand, BuildContext, SharedBuildCommand}; | ||
| use crossbundle_tools::{ | ||
| commands::gen_minimal_project, | ||
| types::AndroidTarget, | ||
| utils::{Config, Shell}, | ||
| }; | ||
|
|
||
| #[test] | ||
| /// Use bevy minimal project in a temporary directory to test AAB generation. It is working likewise the command below. | ||
Heezay marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| /// ```sh | ||
| /// crossbundle build android --quad --aab | ||
| /// ``` | ||
| fn test_execute_aab() { | ||
| let tempdir = tempfile::tempdir().unwrap(); | ||
| let project_path = tempdir.path(); | ||
| let macroquad_project = false; | ||
| gen_minimal_project(&project_path, macroquad_project).unwrap(); | ||
|
|
||
| let target_dir = std::path::PathBuf::from(project_path).join("target"); | ||
| std::fs::create_dir_all(&target_dir).unwrap(); | ||
|
|
||
| let shell = Shell::new(); | ||
| let config = Config::new(shell, target_dir.clone()); | ||
| let context = BuildContext::new(&config, Some(target_dir.clone())).unwrap(); | ||
|
|
||
| let shared_build_command = SharedBuildCommand { | ||
| example: None, | ||
| features: vec![], | ||
| all_features: false, | ||
| no_default_features: false, | ||
| release: false, | ||
| target_dir: None, | ||
| quad: false, | ||
| }; | ||
|
|
||
| let android_build_command = AndroidBuildCommand { | ||
| shared: shared_build_command, | ||
| target: vec![AndroidTarget::Aarch64LinuxAndroid], | ||
| aab: false, | ||
| lib: None, | ||
| gradle: None, | ||
| sign_key_path: None, | ||
| sign_key_pass: None, | ||
| sign_key_alias: None, | ||
| }; | ||
|
|
||
| let (_, _, generated_aab_path, _, _) = | ||
| AndroidBuildCommand::execute_aab(&android_build_command, &config, &context).unwrap(); | ||
| let expected_path = target_dir | ||
| .join("android") | ||
| .join("example") | ||
| .join("outputs") | ||
| .join("example_signed.aab"); | ||
| assert_eq!(generated_aab_path, expected_path); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| use cli::{android::AndroidBuildCommand, BuildContext, SharedBuildCommand}; | ||
| use crossbundle_tools::{ | ||
| commands::gen_minimal_project, | ||
| types::AndroidTarget, | ||
| utils::{Config, Shell}, | ||
| }; | ||
|
|
||
| #[test] | ||
| /// Use macroquad minimal project in a temporary directory to test APK generation. It is working likewise the command below. | ||
| /// ```sh | ||
| /// crossbundle build android --quad | ||
| /// ``` | ||
| fn test_execute_apk() { | ||
| let tempdir = tempfile::tempdir().unwrap(); | ||
| let project_path = tempdir.path(); | ||
| let macroquad_project = true; | ||
| gen_minimal_project(&project_path, macroquad_project).unwrap(); | ||
|
|
||
| let target_dir = std::path::PathBuf::from(project_path).join("target"); | ||
| std::fs::create_dir_all(&target_dir).unwrap(); | ||
|
|
||
| let shell = Shell::new(); | ||
| let config = Config::new(shell, target_dir.clone()); | ||
| let context = BuildContext::new(&config, Some(target_dir.clone())).unwrap(); | ||
|
|
||
| let shared_build_command = SharedBuildCommand { | ||
| example: None, | ||
| features: vec![], | ||
| all_features: false, | ||
| no_default_features: false, | ||
| release: false, | ||
| target_dir: None, | ||
| quad: false, | ||
| }; | ||
|
|
||
| let android_build_command = AndroidBuildCommand { | ||
| shared: shared_build_command, | ||
| target: vec![AndroidTarget::Aarch64LinuxAndroid], | ||
| aab: false, | ||
| lib: None, | ||
| gradle: None, | ||
| sign_key_path: None, | ||
| sign_key_pass: None, | ||
| sign_key_alias: None, | ||
| }; | ||
|
|
||
| let (_, _, generated_apk_path) = | ||
| AndroidBuildCommand::execute_apk(&android_build_command, &config, &context).unwrap(); | ||
| let expected_path = target_dir | ||
| .join("android") | ||
| .join("example") | ||
| .join("outputs") | ||
| .join("Macroquad Example.apk"); | ||
| assert_eq!(generated_apk_path, expected_path); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 12 additions & 2 deletions
14
crossbundle/tools/src/commands/common/gen_minimal_project/consts.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.