feat(cli): enhance iOS build task arguments (#4987)

This commit is contained in:
Lucas Fernandes Nogueira 2022-08-21 10:34:38 -03:00 committed by GitHub
parent 8aad710064
commit e55d96acc1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 8 deletions

View File

@ -134,9 +134,6 @@ pub fn exec(
map.insert("tauri-binary", tauri_binary.to_string_lossy());
let mut build_args = Vec::new();
for arg in args {
if arg == "android" {
break;
}
let path = PathBuf::from(&arg);
if path.exists() {
if let Ok(dir) = current_dir() {
@ -146,10 +143,13 @@ pub fn exec(
}
}
build_args.push(arg.to_string_lossy().into_owned());
if arg == "android" || arg == "ios" {
break;
}
}
build_args.push("android".into());
build_args.push("build".into());
map.insert("tauri-binary-args", build_args);
build_args.push(target.ide_build_script_name().into());
map.insert("tauri-binary-args", &build_args);
map.insert("tauri-binary-args-str", build_args.join(" "));
// Generate Android Studio project
let android_env = if target == Target::Android {

View File

@ -78,6 +78,14 @@ impl Target {
Self::Ios => "ios",
}
}
fn ide_build_script_name(&self) -> &'static str {
match self {
Self::Android => "build",
#[cfg(target_os = "macos")]
Self::Ios => "xcode-script",
}
}
}
#[derive(Debug, Default, Serialize, Deserialize)]

View File

@ -267,7 +267,7 @@ targets:
VALID_ARCHS: {{~#each ios-valid-archs}} {{this}} {{/each}}
legacy:
toolPath: {{ tauri-binary }}
arguments: ios xcode-script -v --platform ${PLATFORM_DISPLAY_NAME:?} --sdk-root ${SDKROOT:?} --configuration ${CONFIGURATION:?} ${FORCE_COLOR} ${ARCHS:?}
arguments: {{ tauri-binary-args-str }} -v --platform ${PLATFORM_DISPLAY_NAME:?} --sdk-root ${SDKROOT:?} --configuration ${CONFIGURATION:?} ${FORCE_COLOR} ${ARCHS:?}
passSettings: false # prevents evil linker errors
workingDirectory: $(SRCROOT)/../..
lib_{{app.name}}_macOS:
@ -275,6 +275,6 @@ targets:
platform: macOS
legacy:
toolPath: {{ tauri-binary }}
arguments: ios xcode-script -v --platform ${PLATFORM_DISPLAY_NAME:?} --sdk-root ${SDKROOT:?} --configuration ${CONFIGURATION:?} ${FORCE_COLOR} ${ARCHS:?}
arguments: {{ tauri-binary-args-str }} -v --platform ${PLATFORM_DISPLAY_NAME:?} --sdk-root ${SDKROOT:?} --configuration ${CONFIGURATION:?} ${FORCE_COLOR} ${ARCHS:?}
passSettings: false
workingDirectory: $(SRCROOT)/../..