148 lines
5.3 KiB
Plaintext
148 lines
5.3 KiB
Plaintext
# Copyright 2015 The Chromium Authors
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
|
|
import("//build/config/ios/config.gni")
|
|
import("//build/config/ios/ios_sdk_overrides.gni")
|
|
import("//build/toolchain/goma.gni")
|
|
import("//build/toolchain/rbe.gni")
|
|
import("//build/toolchain/toolchain.gni")
|
|
import("//build_overrides/build.gni")
|
|
|
|
assert(current_os == "ios")
|
|
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 target_environment.
|
|
ios_bin_path = ""
|
|
ios_sdk_path = ""
|
|
ios_sdk_name = ""
|
|
ios_sdk_version = ""
|
|
ios_sdk_platform = ""
|
|
ios_sdk_platform_path = ""
|
|
ios_toolchains_path = ""
|
|
xcode_version = ""
|
|
xcode_version_int = 0
|
|
xcode_build = ""
|
|
machine_os_build = ""
|
|
|
|
# Set DEVELOPER_DIR while running sdk_info.py.
|
|
ios_sdk_developer_dir = ""
|
|
|
|
# Control whether codesiging is enabled (ignored for simulator builds).
|
|
ios_enable_code_signing = true
|
|
|
|
# Explicitly select the identity to use for codesigning. If defined, must
|
|
# be set to a non-empty string that will be passed to codesigning. Can be
|
|
# left unspecified if ios_code_signing_identity_description is used instead.
|
|
ios_code_signing_identity = ""
|
|
|
|
# Pattern used to select the identity to use for codesigning. If defined,
|
|
# must be a substring of the description of exactly one of the identities by
|
|
# `security find-identity -v -p codesigning`.
|
|
ios_code_signing_identity_description = "Apple Development"
|
|
|
|
# Prefix for CFBundleIdentifier property of iOS bundles (correspond to the
|
|
# "Organization Identifier" in Xcode). Code signing will fail if no mobile
|
|
# provisioning for the selected code signing identify support that prefix.
|
|
ios_app_bundle_id_prefix = "org.chromium.ost"
|
|
|
|
# Paths to the mobileprovision files for the chosen code signing
|
|
# identity description and app bundle id prefix.
|
|
ios_mobileprovision_files = []
|
|
|
|
# Set to true if all test apps should use the same bundle id.
|
|
ios_use_shared_bundle_id_for_test_apps = true
|
|
}
|
|
|
|
# If codesigning is enabled, use must configure either a codesigning identity
|
|
# or a filter to automatically select the codesigning identity.
|
|
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 " +
|
|
"ios_code_signing_identity or let the code select an identity " +
|
|
"automatically (via find_signing_identity.py which use the " +
|
|
"variable ios_code_signing_identity_description to set the " +
|
|
"pattern to match the identity to use).")
|
|
}
|
|
|
|
if (ios_sdk_path == "") {
|
|
# Compute default target.
|
|
if (target_environment == "simulator") {
|
|
ios_sdk_name = "iphonesimulator"
|
|
ios_sdk_platform = "iPhoneSimulator"
|
|
} else if (target_environment == "device") {
|
|
ios_sdk_name = "iphoneos"
|
|
ios_sdk_platform = "iPhoneOS"
|
|
} else if (target_environment == "catalyst") {
|
|
ios_sdk_name = "macosx"
|
|
ios_sdk_platform = "MacOSX"
|
|
} else {
|
|
assert(false, "unsupported environment: $target_environment")
|
|
}
|
|
|
|
ios_sdk_info_args = [
|
|
"--get_sdk_info",
|
|
"--get_machine_info",
|
|
]
|
|
ios_sdk_info_args += [ ios_sdk_name ]
|
|
if (ios_sdk_developer_dir != "") {
|
|
ios_sdk_info_args += [
|
|
"--developer_dir",
|
|
ios_sdk_developer_dir,
|
|
]
|
|
}
|
|
if (use_system_xcode && (use_goma || use_remoteexec)) {
|
|
ios_sdk_info_args += [
|
|
"--create_symlink_at",
|
|
"sdk/xcode_links",
|
|
"--root_build_dir",
|
|
root_build_dir,
|
|
]
|
|
}
|
|
script_name = "//build/config/apple/sdk_info.py"
|
|
_ios_sdk_result = exec_script(script_name, ios_sdk_info_args, "scope")
|
|
ios_bin_path =
|
|
rebase_path("${_ios_sdk_result.toolchains_path}/usr/bin/", root_build_dir)
|
|
ios_sdk_path = _ios_sdk_result.sdk_path
|
|
ios_sdk_platform_path = _ios_sdk_result.sdk_platform_path
|
|
ios_sdk_version = _ios_sdk_result.sdk_version
|
|
ios_sdk_build = _ios_sdk_result.sdk_build
|
|
ios_toolchains_path = _ios_sdk_result.toolchains_path
|
|
xcode_version = _ios_sdk_result.xcode_version
|
|
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 (target_environment == "simulator") {
|
|
# This is weird, but Xcode sets DTPlatformBuild to an empty field for
|
|
# simulator builds.
|
|
ios_platform_build = ""
|
|
} else {
|
|
ios_platform_build = ios_sdk_build
|
|
}
|
|
}
|
|
|
|
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 == "") {
|
|
find_signing_identity_args = []
|
|
if (ios_code_signing_identity_description != "") {
|
|
find_signing_identity_args = [
|
|
"--matching-pattern",
|
|
ios_code_signing_identity_description,
|
|
]
|
|
}
|
|
ios_code_signing_identity = exec_script("find_signing_identity.py",
|
|
find_signing_identity_args,
|
|
"trim string")
|
|
}
|
|
}
|
|
|
|
if (ios_use_shared_bundle_id_for_test_apps) {
|
|
shared_bundle_id_for_test_apps =
|
|
"$ios_app_bundle_id_prefix.chrome.unittests.dev"
|
|
}
|