Chromium Code Reviews| 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 deps = invoker.deps | |
|
brettw
2015/08/04 18:07:28
If you sync you can do:
forward_variables_from(i
Dirk Pranke
2015/08/04 18:27:15
ack.
| |
| 38 if (defined(invoker.testonly)) { | |
| 39 testonly = invoker.testonly | |
| 40 } | |
| 41 } | |
| 42 } | |
| 43 | |
| 44 # TODO(GYP), TODO(dpranke): Should this be part of ios_app? | |
| 45 template("resource_copy_ios") { | |
| 46 assert(defined(invoker.resources), | |
| 47 "The source list of resources to copy over") | |
| 48 assert(defined(invoker.bundle_directory), | |
| 49 "The directory within the bundle to place the sources in") | |
| 50 assert(defined(invoker.app_name), "The name of the application") | |
| 51 | |
| 52 _bundle_directory = invoker.bundle_directory | |
| 53 _app_name = invoker.app_name | |
| 54 _resources = invoker.resources | |
| 55 | |
| 56 copy(target_name) { | |
| 57 set_sources_assignment_filter([]) | |
| 58 sources = _resources | |
| 59 outputs = [ | |
| 60 "$root_build_dir/$_app_name.app/$_bundle_directory/{{source_file_part}}", | |
| 61 ] | |
| 62 } | |
| 63 } | |
| 64 | |
| 65 template("ios_app") { | |
| 66 assert(defined(invoker.deps), | |
| 67 "Dependencies must be specified for $target_name") | |
| 68 assert(defined(invoker.info_plist), | |
| 69 "The application plist file must be specified for $target_name") | |
| 70 assert(defined(invoker.app_name), | |
| 71 "The iOS application name 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 app_name = invoker.app_name | |
| 79 | |
| 80 if (defined(invoker.testonly)) { | |
| 81 testonly = invoker.testonly | |
| 82 } | |
| 83 | |
| 84 struct_gen_target_name = target_name + "_struct" | |
| 85 plist_gen_target_name = target_name + "_plist" | |
| 86 bin_gen_target_name = target_name + "_bin" | |
| 87 | |
| 88 # Generate the project structure | |
| 89 action(struct_gen_target_name) { | |
|
sdefresne
2015/08/04 07:42:01
nit: this targets only creates directories as outp
brettw
2015/08/04 18:07:28
No idea, maybe try with it removed? Whatever you t
Dirk Pranke
2015/08/04 18:27:15
I also think it is unnecessary but hadn't tested t
| |
| 90 script = ios_app_script | |
| 91 | |
| 92 sources = [] | |
|
brettw
2015/08/04 18:07:28
You can just delete this.
Dirk Pranke
2015/08/04 18:27:15
ack.
| |
| 93 outputs = [ | |
| 94 "$root_build_dir/$app_name.app", | |
| 95 ] | |
| 96 | |
| 97 args = [ | |
| 98 "structure", | |
| 99 "-d", | |
| 100 rebase_path(root_build_dir), | |
| 101 "-n", | |
| 102 app_name, | |
| 103 ] | |
| 104 } | |
|
brettw
2015/08/04 18:07:28
Can you set visibility on these intermediate targe
Dirk Pranke
2015/08/04 18:27:15
will do.
| |
| 105 | |
| 106 # Generate the executable | |
| 107 executable(bin_gen_target_name) { | |
| 108 output_name = "${app_name}.app/${app_name}" | |
| 109 if (defined(invoker.testonly)) { | |
| 110 testonly = invoker.testonly | |
| 111 } | |
| 112 | |
| 113 if (defined(invoker.libs)) { | |
| 114 libs = invoker.libs | |
| 115 } else { | |
| 116 libs = [] | |
| 117 } | |
| 118 libs += [ | |
| 119 "UIKit.framework", | |
| 120 "QuartzCore.framework", | |
| 121 "OpenGLES.framework", | |
| 122 ] | |
| 123 | |
| 124 deps = invoker.deps + [ | |
| 125 ":$struct_gen_target_name", | |
| 126 ":$plist_gen_target_name", | |
| 127 ] | |
| 128 } | |
| 129 | |
| 130 # Process the Info.plist | |
| 131 action(plist_gen_target_name) { | |
| 132 script = ios_app_script | |
| 133 | |
| 134 sources = [ | |
| 135 invoker.info_plist, | |
| 136 ] | |
| 137 outputs = [ | |
| 138 "$root_build_dir/${app_name}.app/Info.plist", | |
| 139 ] | |
| 140 | |
| 141 args = [ | |
| 142 "plist", | |
| 143 "-i", | |
| 144 rebase_path(invoker.info_plist, root_build_dir), | |
| 145 "-o", | |
| 146 rebase_path("$root_build_dir/${app_name}.app"), | |
| 147 ] | |
| 148 | |
| 149 deps = [ | |
| 150 ":$struct_gen_target_name", | |
| 151 ] | |
| 152 } | |
| 153 | |
| 154 # Perform Code Signing | |
| 155 code_sign_gen_target_name = target_name + "_codesign" | |
| 156 code_sign_ios(code_sign_gen_target_name) { | |
| 157 entitlements_path = invoker.entitlements_path | |
| 158 identity = invoker.code_signing_identity | |
| 159 application_path = "$root_build_dir/$app_name.app" | |
| 160 deps = [ | |
| 161 ":$struct_gen_target_name", | |
| 162 ":$plist_gen_target_name", | |
| 163 ":$bin_gen_target_name", | |
| 164 ] | |
| 165 if (defined(invoker.testonly)) { | |
|
brettw
2015/08/04 18:07:28
forward_variables_from(invoker, ["testonly"])
Dirk Pranke
2015/08/04 18:27:15
ack.
| |
| 166 testonly = invoker.testonly | |
| 167 } | |
| 168 } | |
| 169 | |
| 170 # Top level group | |
| 171 group(target_name) { | |
| 172 deps = [ | |
|
brettw
2015/08/04 18:07:28
I'd do public_deps instead since you may want to t
Dirk Pranke
2015/08/04 18:27:15
Hm. I don't think so; this is declaring the ios_ap
| |
| 173 ":$struct_gen_target_name", | |
| 174 ":$plist_gen_target_name", | |
| 175 ":$bin_gen_target_name", | |
| 176 ] | |
| 177 if (invoker.code_signing_identity != "") { | |
| 178 deps += [ ":$code_sign_gen_target_name" ] | |
| 179 } | |
| 180 } | |
| 181 } | |
| OLD | NEW |