Home | History | Annotate | Download | only in ios
      1 # Copyright 2015 The Chromium Authors. All rights reserved.
      2 # Use of this source code is governed by a BSD-style license that can be
      3 # found in the LICENSE file.
      4 
      5 declare_args() {
      6   # SDK path to use. When empty this will use the default SDK based on the
      7   # value of use_ios_simulator.
      8   ios_sdk_path = ""
      9   ios_sdk_name = ""
     10   ios_sdk_version = ""
     11   ios_sdk_platform = ""
     12   xcode_version = ""
     13   xcode_build = ""
     14   machine_os_build = ""
     15 
     16   use_ios_simulator = target_cpu == "x86" || target_cpu == "x64"
     17 
     18   # Version of iOS that we're targeting.
     19   ios_deployment_target = "9.0"
     20 
     21   # The iOS Code signing identity to use
     22   # TODO(GYP), TODO(sdfresne): Consider having a separate
     23   # ios_enable_code_signing_flag=<bool> flag to make the invocation clearer.
     24   ios_enable_code_signing = true
     25   ios_code_signing_identity = ""
     26 }
     27 
     28 if (ios_sdk_path == "") {
     29   # Compute default target.
     30   if (use_ios_simulator) {
     31     ios_sdk_name = "iphonesimulator"
     32     ios_sdk_platform = "iPhoneSimulator"
     33   } else {
     34     ios_sdk_name = "iphoneos"
     35     ios_sdk_platform = "iPhoneOS"
     36   }
     37   _ios_sdk_result =
     38       exec_script("//build/config/mac/sdk_info.py", [ ios_sdk_name ], "scope")
     39   ios_sdk_path = _ios_sdk_result.sdk_path
     40   ios_sdk_version = _ios_sdk_result.sdk_version
     41   ios_sdk_build = _ios_sdk_result.sdk_build
     42   xcode_version = _ios_sdk_result.xcode_version
     43   xcode_build = _ios_sdk_result.xcode_build
     44   machine_os_build = _ios_sdk_result.machine_os_build
     45   if (use_ios_simulator) {
     46     # This is weird, but Xcode sets DTPlatformBuild to an empty field for
     47     # simulator builds.
     48     ios_platform_build = ""
     49   } else {
     50     ios_platform_build = ios_sdk_build
     51   }
     52 }
     53 
     54 if (use_ios_simulator) {
     55   # Always disable code signing on the simulator
     56   ios_enable_code_signing = false
     57   ios_code_signing_identity = ""
     58 }
     59 
     60 if (ios_enable_code_signing) {
     61   # If an identity is not provided, look for one on the host
     62   if (ios_code_signing_identity == "") {
     63     _ios_identities = exec_script("find_signing_identity.py", [], "list lines")
     64     ios_code_signing_identity = _ios_identities[0]
     65   }
     66 
     67   if (ios_code_signing_identity == "") {
     68     print("Tried to prepare a device build without specifying a code signing")
     69     print("identity and could not detect one automatically either.")
     70     print("TIP: Simulator builds don't require code signing...")
     71     assert(false)
     72   }
     73 }
     74