Commit 827a4418 authored by Sylvain Defresne's avatar Sylvain Defresne Committed by Commit Bot

[ios] Check target_environment instead of using use_ios_simulator

In preparation of adding support for target_environment="catalyst"
replace all uses of `use_ios_simulator` with the corresponding
check of the value of `target_environment`.

Bug: none
Change-Id: I23b0e9c05c6a427de0e5cb82d7937905b64028c8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2476278
Auto-Submit: Sylvain Defresne <sdefresne@chromium.org>
Commit-Queue: Rohit Rao <rohitrao@chromium.org>
Reviewed-by: default avatarRohit Rao <rohitrao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#818775}
parent 8d2f6ff7
......@@ -43,7 +43,7 @@ config("compiler") {
}
# Environment.
if (use_ios_simulator) {
if (target_environment == "simulator") {
triplet_environment = "-simulator"
} else {
triplet_environment = ""
......@@ -98,7 +98,7 @@ config("runtime_library") {
_sysroot_path,
]
if (use_xcode_clang && enable_ios_bitcode && !use_ios_simulator) {
if (use_xcode_clang && enable_ios_bitcode && target_environment == "device") {
if (is_debug) {
common_flags += [ "-fembed-bitcode-marker" ]
} else {
......
......@@ -10,7 +10,7 @@ assert(use_system_xcode, "Hermetic xcode doesn't work for ios.")
declare_args() {
# SDK path to use. When empty this will use the default SDK based on the
# value of use_ios_simulator.
# value of target_environment.
ios_sdk_path = ""
ios_sdk_name = ""
ios_sdk_version = ""
......@@ -87,11 +87,9 @@ assert(!(use_goma && is_chrome_branded && is_official_build &&
assert(custom_toolchain == "" || additional_target_cpus == [],
"cannot define both custom_toolchain and additional_target_cpus")
use_ios_simulator = target_environment == "simulator"
# If codesigning is enabled, use must configure either a codesigning identity
# or a filter to automatically select the codesigning identity.
if (!use_ios_simulator && ios_enable_code_signing) {
if (target_environment == "device" && ios_enable_code_signing) {
assert(ios_code_signing_identity == "" ||
ios_code_signing_identity_description == "",
"You should either specify the precise identity to use with " +
......@@ -122,12 +120,14 @@ if (additional_target_cpus != []) {
if (ios_sdk_path == "") {
# Compute default target.
if (use_ios_simulator) {
if (target_environment == "simulator") {
ios_sdk_name = "iphonesimulator"
ios_sdk_platform = "iPhoneSimulator"
} else {
} else if (target_environment == "device") {
ios_sdk_name = "iphoneos"
ios_sdk_platform = "iPhoneOS"
} else {
assert("unsupported target_environment: $target_environment")
}
ios_sdk_info_args = [ "--get_sdk_info" ]
......@@ -155,7 +155,7 @@ if (ios_sdk_path == "") {
xcode_version_int = _ios_sdk_result.xcode_version_int
xcode_build = _ios_sdk_result.xcode_build
machine_os_build = _ios_sdk_result.machine_os_build
if (use_ios_simulator) {
if (target_environment == "simulator") {
# This is weird, but Xcode sets DTPlatformBuild to an empty field for
# simulator builds.
ios_platform_build = ""
......@@ -164,7 +164,7 @@ if (ios_sdk_path == "") {
}
}
if (!use_ios_simulator && ios_enable_code_signing) {
if (target_environment == "device" && ios_enable_code_signing) {
# Automatically select a codesigning identity if no identity is configured.
# This only applies to device build as simulator builds are not signed.
if (ios_code_signing_identity == "") {
......
......@@ -94,8 +94,8 @@ template("ios_test_runner_wrapper") {
data_deps += invoker.data_deps
}
# test runner relies on iossim if use_ios_simulator (defined in ios_sdk.gni)
if (use_ios_simulator) {
# test runner relies on iossim for simulator builds.
if (target_environment == "simulator") {
_rebased_root_build_dir = rebase_path("${root_build_dir}", root_build_dir)
data_deps += [ "//testing/iossim" ]
......
......@@ -364,7 +364,7 @@ template("create_signed_bundle") {
code_signing_outputs +=
[ "$bundle_contents_dir/_CodeSignature/CodeResources" ]
}
if (ios_code_signing_identity != "" && !use_ios_simulator &&
if (ios_code_signing_identity != "" && target_environment == "device" &&
_enable_embedded_mobileprovision) {
code_signing_outputs +=
[ "$bundle_contents_dir/embedded.mobileprovision" ]
......@@ -638,7 +638,8 @@ template("ios_app_bundle") {
visibility = [ ":$_arch_executable_target" ]
}
if (current_toolchain == default_toolchain || use_ios_simulator) {
if (current_toolchain == default_toolchain ||
target_environment == "simulator") {
_generate_entitlements_target = _target_name + "_gen_entitlements"
_generate_entitlements_output =
get_label_info(":$_generate_entitlements_target($default_toolchain)",
......@@ -721,7 +722,7 @@ template("ios_app_bundle") {
]
}
if (use_ios_simulator) {
if (target_environment == "simulator") {
deps += [ ":$_generate_entitlements_target($default_toolchain)" ]
if (!defined(inputs)) {
......@@ -903,7 +904,7 @@ template("ios_app_bundle") {
}
bundle_deps += _variant.bundle_deps
if (use_ios_simulator) {
if (target_environment == "simulator") {
if (!defined(data_deps)) {
data_deps = []
}
......@@ -1272,8 +1273,8 @@ template("ios_framework_bundle") {
"$_default_toolchain_target_gen_dir/$_output_name.headers.hmap"
config(_headers_map_config) {
visibility = [
":${_target_name}_signed_bundle",
":${_arch_shared_library_source}",
":${_target_name}_signed_bundle",
]
include_dirs = [ _header_map_filename ]
}
......
......@@ -61,7 +61,7 @@ breakpad_enabled = is_official_build && is_chrome_branded
if (breakpad_enabled) {
breakpad_enabled_as_int = 1
is_official_release = enable_dsyms && !use_ios_simulator &&
is_official_release = enable_dsyms && target_environment == "device" &&
current_toolchain == default_toolchain
} else {
breakpad_enabled_as_int = 0
......
......@@ -12,8 +12,8 @@ declare_args() {
# Using a locally-built iOS WebKit is only supported for simulator builds, and
# only if not building WebKit for macOS.
_build_ios_webkit =
checkout_ios_webkit && use_ios_simulator && !build_mac_webkit
_build_ios_webkit = checkout_ios_webkit && target_environment == "simulator" &&
!build_mac_webkit
_build_mac_webkit = checkout_ios_webkit && build_mac_webkit
group("webkit") {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment