OLD | NEW |
(Empty) | |
| 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 ios_app_script = "//build/config/ios/ios_app.py" |
| 6 |
| 7 template("code_sign_ios") { |
| 8 assert(defined(invoker.entitlements_path), |
| 9 "The path to the entitlements .xcent file") |
| 10 assert(defined(invoker.identity), "The code signing identity") |
| 11 assert(defined(invoker.application_path), "The application to code sign") |
| 12 assert(defined(invoker.deps)) |
| 13 |
| 14 action(target_name) { |
| 15 sources = [ |
| 16 invoker.entitlements_path, |
| 17 ] |
| 18 |
| 19 _application_path = invoker.application_path |
| 20 |
| 21 script = ios_app_script |
| 22 |
| 23 outputs = [ |
| 24 "$_application_path/_CodeSignature/CodeResources", |
| 25 ] |
| 26 |
| 27 args = [ |
| 28 "codesign", |
| 29 "-p", |
| 30 rebase_path(invoker.application_path, root_build_dir), |
| 31 "-i", |
| 32 invoker.identity, |
| 33 "-e", |
| 34 rebase_path(invoker.entitlements_path, root_build_dir), |
| 35 ] |
| 36 |
| 37 forward_variables_from(invoker, |
| 38 [ |
| 39 "deps", |
| 40 "public_deps", |
| 41 "testonly", |
| 42 ]) |
| 43 } |
| 44 } |
| 45 |
| 46 # TODO(GYP), TODO(dpranke): Should this be part of ios_app? |
| 47 template("resource_copy_ios") { |
| 48 assert(defined(invoker.resources), |
| 49 "The source list of resources to copy over") |
| 50 assert(defined(invoker.bundle_directory), |
| 51 "The directory within the bundle to place the sources in") |
| 52 assert(defined(invoker.app_name), "The name of the application") |
| 53 |
| 54 _bundle_directory = invoker.bundle_directory |
| 55 _app_name = invoker.app_name |
| 56 _resources = invoker.resources |
| 57 |
| 58 copy(target_name) { |
| 59 set_sources_assignment_filter([]) |
| 60 sources = _resources |
| 61 outputs = [ |
| 62 "$root_build_dir/$_app_name.app/$_bundle_directory/{{source_file_part}}", |
| 63 ] |
| 64 } |
| 65 } |
| 66 |
| 67 template("ios_app") { |
| 68 assert(defined(invoker.deps), |
| 69 "Dependencies must be specified for $target_name") |
| 70 assert(defined(invoker.info_plist), |
| 71 "The application plist file must be specified for $target_name") |
| 72 assert(defined(invoker.entitlements_path), |
| 73 "The entitlements path must be specified for $target_name") |
| 74 assert(defined(invoker.code_signing_identity), |
| 75 "The code_signing_identity must be specified for $target_name") |
| 76 |
| 77 # We just create a variable so we can use the same in interpolation |
| 78 if (defined(invoker.app_name)) { |
| 79 _app_name = invoker.app_name |
| 80 } else { |
| 81 _app_name = target_name |
| 82 } |
| 83 |
| 84 forward_variables_from(invoker, [ "testonly" ]) |
| 85 |
| 86 plist_gen_target_name = target_name + "_plist" |
| 87 bin_gen_target_name = target_name + "_bin" |
| 88 group_target_name = target_name |
| 89 |
| 90 # Generate the executable |
| 91 executable(bin_gen_target_name) { |
| 92 visibility = [ ":$group_target_name" ] |
| 93 |
| 94 output_name = "${_app_name}.app/${_app_name}" |
| 95 |
| 96 if (defined(invoker.libs)) { |
| 97 libs = invoker.libs |
| 98 } else { |
| 99 libs = [] |
| 100 } |
| 101 libs += [ |
| 102 "UIKit.framework", |
| 103 "QuartzCore.framework", |
| 104 "OpenGLES.framework", |
| 105 ] |
| 106 |
| 107 if (defined(invoker.deps)) { |
| 108 deps = invoker.deps |
| 109 } else { |
| 110 deps = [] |
| 111 } |
| 112 deps += [ ":$plist_gen_target_name" ] |
| 113 } |
| 114 |
| 115 # Process the Info.plist |
| 116 action(plist_gen_target_name) { |
| 117 visibility = [ |
| 118 ":$group_target_name", |
| 119 ":$bin_gen_target_name", |
| 120 ] |
| 121 |
| 122 script = ios_app_script |
| 123 |
| 124 sources = [ |
| 125 invoker.info_plist, |
| 126 ] |
| 127 outputs = [ |
| 128 "$root_build_dir/${_app_name}.app/Info.plist", |
| 129 ] |
| 130 |
| 131 args = [ |
| 132 "plist", |
| 133 "-i", |
| 134 rebase_path(invoker.info_plist, root_build_dir), |
| 135 "-o", |
| 136 rebase_path("$root_build_dir/${_app_name}.app"), |
| 137 ] |
| 138 } |
| 139 |
| 140 # Perform Code Signing |
| 141 entitlements_path = invoker.entitlements_path |
| 142 if (invoker.code_signing_identity != "") { |
| 143 code_sign_gen_target_name = target_name + "_codesign" |
| 144 code_sign_ios(code_sign_gen_target_name) { |
| 145 visibility = [ ":$target_name" ] |
| 146 |
| 147 identity = invoker.code_signing_identity |
| 148 application_path = "$root_build_dir/$app_name.app" |
| 149 deps = [ |
| 150 ":$plist_gen_target_name", |
| 151 ":$bin_gen_target_name", |
| 152 ] |
| 153 } |
| 154 } else { |
| 155 # This avoids a potential unused variable warning in the caller. |
| 156 entitlements_path = entitlements_path |
| 157 } |
| 158 |
| 159 # Top level group |
| 160 group(target_name) { |
| 161 deps = [ |
| 162 ":$plist_gen_target_name", |
| 163 ":$bin_gen_target_name", |
| 164 ] |
| 165 if (invoker.code_signing_identity != "") { |
| 166 deps += [ ":$code_sign_gen_target_name" ] |
| 167 } |
| 168 } |
| 169 } |
OLD | NEW |