Chromium Code Reviews| Index: build/config/ios/rules.gni |
| diff --git a/build/config/ios/rules.gni b/build/config/ios/rules.gni |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..5a8c6ed8f88c145068707932e470e10839084287 |
| --- /dev/null |
| +++ b/build/config/ios/rules.gni |
| @@ -0,0 +1,165 @@ |
| +# Copyright 2015 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +ios_app_script = "//build/config/ios/ios_app.py" |
| + |
| +template("code_sign_ios") { |
| + assert(defined(invoker.entitlements_path), |
| + "The path to the entitlements .xcent file") |
| + assert(defined(invoker.identity), "The code signing identity") |
| + assert(defined(invoker.application_path), "The application to code sign") |
| + assert(defined(invoker.deps)) |
| + |
| + action(target_name) { |
| + sources = [ |
| + invoker.entitlements_path, |
| + ] |
| + |
| + _application_path = invoker.application_path |
| + |
| + script = ios_app_script |
| + |
| + outputs = [ |
| + "$_application_path/_CodeSignature/CodeResources", |
| + ] |
| + |
| + args = [ |
| + "codesign", |
| + "-p", |
| + rebase_path(invoker.application_path, root_build_dir), |
| + "-i", |
| + invoker.identity, |
| + "-e", |
| + rebase_path(invoker.entitlements_path, root_build_dir), |
| + ] |
| + |
| + forward_variables_from(invoker, |
| + [ |
| + "deps", |
| + "public_deps", |
| + "testonly", |
| + ]) |
| + } |
| +} |
| + |
| +# TODO(GYP), TODO(dpranke): Should this be part of ios_app? |
| +template("resource_copy_ios") { |
| + assert(defined(invoker.resources), |
| + "The source list of resources to copy over") |
| + assert(defined(invoker.bundle_directory), |
| + "The directory within the bundle to place the sources in") |
| + assert(defined(invoker.app_name), "The name of the application") |
| + |
| + _bundle_directory = invoker.bundle_directory |
| + _app_name = invoker.app_name |
| + _resources = invoker.resources |
| + |
| + copy(target_name) { |
| + set_sources_assignment_filter([]) |
| + sources = _resources |
| + outputs = [ |
| + "$root_build_dir/$_app_name.app/$_bundle_directory/{{source_file_part}}", |
| + ] |
| + } |
| +} |
| + |
| +template("ios_app") { |
| + assert(defined(invoker.deps), |
| + "Dependencies must be specified for $target_name") |
| + assert(defined(invoker.info_plist), |
| + "The application plist file must be specified for $target_name") |
| + assert(defined(invoker.app_name), |
| + "The iOS application name must be specified for $target_name") |
| + assert(defined(invoker.entitlements_path), |
| + "The entitlements path must be specified for $target_name") |
| + assert(defined(invoker.code_signing_identity), |
| + "The code_signing_identity must be specified for $target_name") |
| + |
| + # We just create a variable so we can use the same in interpolation |
| + app_name = invoker.app_name |
|
brettw
2015/08/06 18:07:27
This still isn't optional (should default to targe
Dirk Pranke
2015/08/06 18:29:46
Yeah, I fixed the mac one but not the ios one. wil
Dirk Pranke
2015/08/06 20:32:11
I'm not sure if can use output_name; we app_name f
brettw
2015/08/06 22:38:15
Okay, we can do a follow up. I'm still quite certa
|
| + |
| + forward_variables_from(invoker, [ "testonly" ]) |
| + |
| + plist_gen_target_name = target_name + "_plist" |
| + bin_gen_target_name = target_name + "_bin" |
| + group_target_name = target_name |
| + |
| + # Generate the executable |
| + executable(bin_gen_target_name) { |
| + visibility = [ ":$group_target_name" ] |
| + |
| + output_name = "${app_name}.app/${app_name}" |
| + if (defined(invoker.testonly)) { |
|
brettw
2015/08/06 18:07:27
You forward testonly above. Is this necessary? If
Dirk Pranke
2015/08/06 18:29:46
I don't think this is necessary. Will fix.
|
| + testonly = invoker.testonly |
| + } |
| + |
| + if (defined(invoker.libs)) { |
| + libs = invoker.libs |
| + } else { |
| + libs = [] |
| + } |
| + libs += [ |
| + "UIKit.framework", |
| + "QuartzCore.framework", |
| + "OpenGLES.framework", |
| + ] |
| + |
| + deps = invoker.deps + [ ":$plist_gen_target_name" ] |
|
brettw
2015/08/06 18:07:27
Can this treat the invoker deps as optional? I rea
Dirk Pranke
2015/08/06 18:29:46
Will fix.
|
| + } |
| + |
| + # Process the Info.plist |
| + action(plist_gen_target_name) { |
| + visibility = [ |
| + ":$group_target_name", |
| + ":$bin_gen_target_name", |
| + ] |
| + |
| + script = ios_app_script |
| + |
| + sources = [ |
| + invoker.info_plist, |
| + ] |
| + outputs = [ |
| + "$root_build_dir/${app_name}.app/Info.plist", |
| + ] |
| + |
| + args = [ |
| + "plist", |
| + "-i", |
| + rebase_path(invoker.info_plist, root_build_dir), |
| + "-o", |
| + rebase_path("$root_build_dir/${app_name}.app"), |
| + ] |
| + } |
| + |
| + # Perform Code Signing |
| + entitlements_path = invoker.entitlements_path |
| + if (invoker.code_signing_identity != "") { |
| + code_sign_gen_target_name = target_name + "_codesign" |
| + code_sign_ios(code_sign_gen_target_name) { |
| + visibility = [ ":$target_name" ] |
| + |
| + identity = invoker.code_signing_identity |
| + application_path = "$root_build_dir/$app_name.app" |
| + deps = [ |
| + ":$plist_gen_target_name", |
| + ":$bin_gen_target_name", |
| + ] |
| + } |
| + } else { |
| + # This avoids a potential unused variable warning in the caller. |
| + entitlements_path = entitlements_path |
| + } |
| + |
| + # Top level group |
| + group(target_name) { |
| + deps = [ |
| + ":$plist_gen_target_name", |
| + ":$bin_gen_target_name", |
| + ] |
| + if (invoker.code_signing_identity != "") { |
| + deps += [ ":$code_sign_gen_target_name" ] |
| + } |
| + } |
| +} |