Skip to content
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

chore(cli): enhance mobile build by only compiling selected target #9894

Merged
merged 1 commit into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 12 additions & 15 deletions tooling/cli/src/mobile/android/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,17 @@ pub fn command(options: Options, noise_level: NoiseLevel) -> Result<()> {
delete_codegen_vars();

let mut build_options: BuildOptions = options.clone().into();
build_options.target = Some(
Target::all()
.get(Target::DEFAULT_KEY)
.unwrap()
.triple
.into(),
);

let first_target = Target::all()
.get(
options
.targets
.as_ref()
.and_then(|l| l.first().map(|t| t.as_str()))
.unwrap_or(Target::DEFAULT_KEY),
)
.unwrap();
build_options.target = Some(first_target.triple.into());

let tauri_config = get_tauri_config(
tauri_utils::platform::Target::Android,
Expand Down Expand Up @@ -138,14 +142,7 @@ pub fn command(options: Options, noise_level: NoiseLevel) -> Result<()> {
crate::build::setup(&interface, &mut build_options, tauri_config.clone(), true)?;

// run an initial build to initialize plugins
Target::all().values().next().unwrap().build(
&config,
&metadata,
&env,
noise_level,
true,
profile,
)?;
first_target.build(&config, &metadata, &env, noise_level, true, profile)?;

let open = options.open;
let _handle = run_build(
Expand Down
8 changes: 7 additions & 1 deletion tooling/cli/src/mobile/ios/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,13 @@ pub fn command(options: Options, noise_level: NoiseLevel) -> Result<()> {
let mut build_options: BuildOptions = options.clone().into();
build_options.target = Some(
Target::all()
.get(Target::DEFAULT_KEY)
.get(
options
.targets
.first()
.map(|t| t.as_str())
.unwrap_or(Target::DEFAULT_KEY),
)
.unwrap()
.triple
.into(),
Expand Down
Loading