1# Copyright 2024 The Chromium Authors 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5declare_args() { 6 # Configure the environment for which to build. Could be either "device", 7 # "simulator" or "catalyst". Must be specified. 8 target_environment = "" 9 10 # Control whether codesiging is enabled (ignored for simulator builds). 11 # TODO(crbug.com/378918882): Prefix with apple_mobile_ instead of ios_. 12 ios_enable_code_signing = true 13 14 # Explicitly select the identity to use for codesigning. If defined, must 15 # be set to a non-empty string that will be passed to codesigning. Can be 16 # left unspecified if ios_code_signing_identity_description is used instead. 17 # TODO(crbug.com/378918882): Prefix with apple_mobile_ instead of ios_. 18 ios_code_signing_identity = "" 19 20 # Pattern used to select the identity to use for codesigning. If defined, 21 # must be a substring of the description of exactly one of the identities by 22 # `security find-identity -v -p codesigning`. 23 # TODO(crbug.com/378918882): Prefix with apple_mobile_ instead of ios_. 24 ios_code_signing_identity_description = "Apple Development" 25 26 # Prefix for CFBundleIdentifier property of iOS bundles (correspond to the 27 # "Organization Identifier" in Xcode). Code signing will fail if no mobile 28 # provisioning for the selected code signing identify support that prefix. 29 # TODO(crbug.com/378918882): Prefix with apple_mobile_ instead of ios_. 30 ios_app_bundle_id_prefix = "org.chromium.ost" 31 32 # Paths to the mobileprovision files for the chosen code signing 33 # identity description and app bundle id prefix. 34 # TODO(crbug.com/378918882): Prefix with apple_mobile_ instead of ios_. 35 ios_mobileprovision_files = [] 36} 37 38# As entitlements are tied to a specific bundle identifier, all the 39# test applications share the same identifier. This simplifies adding 40# new test application (since there is no need to investigate which 41# entitlements they need, nor to wait for the mobile provision with 42# those entitlements to be generated by Apple and then deployed to the 43# infrastructure, ...). The drawback is that only one test application 44# can be installed at a time on a device/simulator (as the bundle 45# identifier uniquely identify an application). 46# 47# This variable corresponds to the test bundle identifier. 48shared_bundle_id_for_test_apps = 49 "$ios_app_bundle_id_prefix.chrome.unittests.dev" 50 51# This file is included on all platforms, but the automatic configuration of 52# the variables can only be executed if building for ios or watchos (as they 53# either have no meaning or depend on tools that are only available on macOS). 54if (is_ios || is_watchos) { 55 # Check that target_environment is set to a supported value. 56 _target_environments = [ 57 "simulator", 58 "device", 59 ] 60 if (is_ios) { 61 _target_environments += [ "catalyst" ] 62 } 63 assert(filter_include([ target_environment ], _target_environments) != [], 64 "target_environment must be in $_target_environments: " + 65 "$target_environment") 66 67 if (target_environment == "device" && ios_enable_code_signing) { 68 # If codesigning is enabled, user must configure either a codesigning 69 # identity or a filter to automatically select the codesigning identity. 70 assert(ios_code_signing_identity == "" || 71 ios_code_signing_identity_description == "", 72 "You should either specify the precise identity to use with " + 73 "ios_code_signing_identity or let the code select an identity " + 74 "automatically (via find_signing_identity.py which use the " + 75 "variable ios_code_signing_identity_description to set the " + 76 "pattern to match the identity to use).") 77 78 # Automatically select a codesigning identity if no identity is configured. 79 # This only applies to device build as simulator builds are not signed. 80 if (ios_code_signing_identity == "") { 81 find_signing_identity_args = [] 82 if (ios_code_signing_identity_description != "") { 83 find_signing_identity_args = [ 84 "--matching-pattern", 85 ios_code_signing_identity_description, 86 ] 87 } 88 ios_code_signing_identity = 89 exec_script("//build/config/apple/find_signing_identity.py", 90 find_signing_identity_args, 91 "trim string") 92 } 93 } 94} 95