| 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), | 
|  | 11          "The code signing identity") | 
|  | 12   assert(defined(invoker.application_path), | 
|  | 13          "The application to code sign") | 
|  | 14   assert(defined(invoker.deps)) | 
|  | 15 | 
|  | 16   action(target_name) { | 
|  | 17     sources = [ | 
|  | 18       invoker.entitlements_path, | 
|  | 19     ] | 
|  | 20 | 
|  | 21     _application_path = invoker.application_path | 
|  | 22 | 
|  | 23     script = ios_app_script | 
|  | 24 | 
|  | 25     outputs = [ | 
|  | 26       "$_application_path/_CodeSignature/CodeResources" | 
|  | 27     ] | 
|  | 28 | 
|  | 29     args = [ | 
|  | 30       "codesign", | 
|  | 31       "-p", | 
|  | 32       rebase_path(invoker.application_path, root_build_dir), | 
|  | 33       "-i", | 
|  | 34       invoker.identity, | 
|  | 35       "-e", | 
|  | 36       rebase_path(invoker.entitlements_path, root_build_dir), | 
|  | 37     ] | 
|  | 38 | 
|  | 39     deps = invoker.deps | 
|  | 40   } | 
|  | 41 } | 
|  | 42 | 
|  | 43 template("xcode_harness_ios") { | 
|  | 44   assert(defined(invoker.deps), | 
|  | 45          "The dependencies must be specified") | 
|  | 46   assert(defined(invoker.app_bundle), | 
|  | 47          "The app bundle must be defined") | 
|  | 48   assert(defined(invoker.app_name), | 
|  | 49          "The application name must be defined") | 
|  | 50   app_name = invoker.app_name | 
|  | 51 | 
|  | 52   xcode_project_gen_target_name = app_name + "_xcode" | 
|  | 53   copy(xcode_project_gen_target_name) { | 
|  | 54     sources = [ | 
|  | 55       "//build/config/ios/XcodeHarness/FakeMain.m", | 
|  | 56       "//build/config/ios/XcodeHarness/Harness.xcodeproj", | 
|  | 57     ] | 
|  | 58     outputs = [ | 
|  | 59       "$root_build_dir/$xcode_project_gen_target_name/{{source_file_part}}", | 
|  | 60     ] | 
|  | 61   } | 
|  | 62 | 
|  | 63   bundle_copy_gen_target_name = app_name + "_bundle_copy" | 
|  | 64   copy(bundle_copy_gen_target_name) { | 
|  | 65     sources = [ | 
|  | 66       invoker.app_bundle | 
|  | 67     ] | 
|  | 68     outputs = [ | 
|  | 69       "$root_build_dir/$xcode_project_gen_target_name/Application", | 
|  | 70     ] | 
|  | 71 | 
|  | 72     deps = invoker.deps | 
|  | 73   } | 
|  | 74 | 
|  | 75   group(target_name) { | 
|  | 76     deps = [ | 
|  | 77       ":$xcode_project_gen_target_name", | 
|  | 78       ":$bundle_copy_gen_target_name", | 
|  | 79     ] | 
|  | 80   } | 
|  | 81 } | 
|  | 82 | 
|  | 83 template("resource_copy_ios") { | 
|  | 84   assert(defined(invoker.resources), | 
|  | 85          "The source list of resources to copy over") | 
|  | 86   assert(defined(invoker.bundle_directory), | 
|  | 87          "The directory within the bundle to place the sources in") | 
|  | 88   assert(defined(invoker.app_name), | 
|  | 89          "The name of the application") | 
|  | 90 | 
|  | 91   _bundle_directory = invoker.bundle_directory | 
|  | 92   _app_name = invoker.app_name | 
|  | 93   _resources = invoker.resources | 
|  | 94 | 
|  | 95   copy(target_name) { | 
|  | 96     set_sources_assignment_filter([]) | 
|  | 97     sources = _resources | 
|  | 98     outputs = [ "$root_build_dir/$_app_name.app/$_bundle_directory/{{source_file
     _part}}" ] | 
|  | 99 | 
|  | 100     if (defined(invoker.deps)) { | 
|  | 101       deps = invoker.deps | 
|  | 102     } | 
|  | 103   } | 
|  | 104 } | 
|  | 105 | 
|  | 106 template("ios_app") { | 
|  | 107 | 
|  | 108   assert(defined(invoker.deps), | 
|  | 109          "Dependencies must be specified for $target_name") | 
|  | 110   assert(defined(invoker.info_plist), | 
|  | 111          "The application plist file must be specified for $target_name") | 
|  | 112   assert(defined(invoker.app_name), | 
|  | 113          "The name of iOS application for $target_name") | 
|  | 114   assert(defined(invoker.entitlements_path), | 
|  | 115          "The entitlements path must be specified for $target_name") | 
|  | 116   assert(defined(invoker.code_signing_identity), | 
|  | 117          "The entitlements path must be specified for $target_name") | 
|  | 118 | 
|  | 119   # We just create a variable so we can use the same in interpolation | 
|  | 120   app_name = invoker.app_name | 
|  | 121 | 
|  | 122   # Generate the project structure | 
|  | 123 | 
|  | 124   struct_gen_target_name = target_name + "_struct" | 
|  | 125 | 
|  | 126   action(struct_gen_target_name) { | 
|  | 127 | 
|  | 128     script = ios_app_script | 
|  | 129 | 
|  | 130     sources = [] | 
|  | 131     outputs = [ "$root_build_dir/$app_name.app" ] | 
|  | 132 | 
|  | 133     args = [ | 
|  | 134       "structure", | 
|  | 135       "-d", | 
|  | 136       rebase_path(root_build_dir), | 
|  | 137       "-n", | 
|  | 138       app_name | 
|  | 139     ] | 
|  | 140 | 
|  | 141   } | 
|  | 142 | 
|  | 143   # Generate the executable | 
|  | 144 | 
|  | 145   bin_gen_target_name = target_name + "_bin" | 
|  | 146 | 
|  | 147   executable(bin_gen_target_name) { | 
|  | 148     libs = [ | 
|  | 149       "AudioToolbox.framework", | 
|  | 150       "AVFoundation.framework", | 
|  | 151       "OpenGLES.framework", | 
|  | 152       "QuartzCore.framework", | 
|  | 153       "UIKit.framework", | 
|  | 154     ] | 
|  | 155     deps = invoker.deps | 
|  | 156     output_name = app_name | 
|  | 157   } | 
|  | 158 | 
|  | 159   # Process the Info.plist | 
|  | 160 | 
|  | 161   plist_gen_target_name = target_name + "_plist" | 
|  | 162 | 
|  | 163   action(plist_gen_target_name) { | 
|  | 164 | 
|  | 165     script = ios_app_script | 
|  | 166 | 
|  | 167     sources = [ invoker.info_plist ] | 
|  | 168     outputs = [ "$root_build_dir/plist/$app_name/Info.plist" ] | 
|  | 169 | 
|  | 170     args = [ | 
|  | 171       "plist", | 
|  | 172       "-i", | 
|  | 173       rebase_path(invoker.info_plist, root_build_dir), | 
|  | 174       "-o", | 
|  | 175       rebase_path("$root_build_dir/plist/$app_name"), | 
|  | 176     ] | 
|  | 177   } | 
|  | 178 | 
|  | 179   # Copy the generated binaries and assets to their appropriate locations | 
|  | 180 | 
|  | 181   copy_gen_target_name = target_name + "_copy" | 
|  | 182   copy(copy_gen_target_name) { | 
|  | 183     sources = [ | 
|  | 184       "$root_build_dir/plist/$app_name/Info.plist", | 
|  | 185       "$root_build_dir/$app_name", | 
|  | 186     ] | 
|  | 187 | 
|  | 188     outputs = [ | 
|  | 189       "$root_build_dir/$app_name.app/{{source_file_part}}" | 
|  | 190     ] | 
|  | 191 | 
|  | 192     deps = [ | 
|  | 193       ":$struct_gen_target_name", | 
|  | 194       ":$bin_gen_target_name", | 
|  | 195       ":$plist_gen_target_name", | 
|  | 196     ] | 
|  | 197   } | 
|  | 198 | 
|  | 199   # Generate the Xcode Harness for Profiling | 
|  | 200 | 
|  | 201   xcode_harness_gen_target_name = app_name + "_harness" | 
|  | 202   xcode_harness_ios(xcode_harness_gen_target_name) { | 
|  | 203     app_bundle = "$root_build_dir/$app_name.app" | 
|  | 204     deps = [ | 
|  | 205       ":$bin_gen_target_name", | 
|  | 206       ":$struct_gen_target_name", | 
|  | 207       ":$copy_gen_target_name", | 
|  | 208     ] | 
|  | 209   } | 
|  | 210 | 
|  | 211   # Perform Code Signing | 
|  | 212 | 
|  | 213   code_sign_gen_target_name = target_name + "_codesign" | 
|  | 214   code_sign_ios(code_sign_gen_target_name) { | 
|  | 215     entitlements_path = invoker.entitlements_path | 
|  | 216     identity = invoker.code_signing_identity | 
|  | 217     application_path = "$root_build_dir/$app_name.app" | 
|  | 218     deps = [ ":$copy_gen_target_name" ] | 
|  | 219   } | 
|  | 220 | 
|  | 221   # Top level group | 
|  | 222 | 
|  | 223   group(target_name) { | 
|  | 224     # Skip code signing if no identity is provided. This is useful for simulator | 
|  | 225     # builds | 
|  | 226     deps = [ ":$xcode_harness_gen_target_name" ] | 
|  | 227     if (invoker.code_signing_identity == "") { | 
|  | 228       deps += [ ":$copy_gen_target_name" ] | 
|  | 229     } else { | 
|  | 230       deps += [ ":$code_sign_gen_target_name" ] | 
|  | 231     } | 
|  | 232   } | 
|  | 233 | 
|  | 234 } | 
| OLD | NEW | 
|---|