Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(576)

Unified Diff: build/config/ios/rules.gni

Issue 1250913002: patch from chinmaygarde@ to make progress on mac, ios. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tweaks needed to get base_unittests to compile Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..66e596d8cc4b07c77935880076425d78237e0c7f
--- /dev/null
+++ b/build/config/ios/rules.gni
@@ -0,0 +1,209 @@
+# 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),
+ ]
+
+ deps = invoker.deps
+ if (defined(invoker.testonly)) {
+ testonly = invoker.testonly
+ }
+ }
+}
+
+template("resource_copy_ios") {
sdefresne 2015/07/25 19:15:30 I think this should be part of ios_app, otherwise
Dirk Pranke 2015/07/31 21:27:40 Will investigate. marking as a TODO for now.
+ 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 name of iOS application for $target_name")
+ assert(defined(invoker.entitlements_path),
+ "The entitlements path must be specified for $target_name")
+ assert(defined(invoker.code_signing_identity),
+ "The entitlements path must be specified for $target_name")
sdefresne 2015/07/25 19:15:30 This comment is incorrect, this is checking "code_
Dirk Pranke 2015/07/31 21:27:40 Done.
+
+ # We just create a variable so we can use the same in interpolation
+ app_name = invoker.app_name
+
+ if (defined(invoker.testonly)) {
+ testonly = invoker.testonly
+ }
+
+ struct_gen_target_name = target_name + "_struct"
+ plist_gen_target_name = target_name + "_plist"
+ bin_gen_target_name = target_name + "_bin"
+
+ # Generate the project structure
+
sdefresne 2015/07/25 19:15:30 nit: remove blank line?
Dirk Pranke 2015/07/31 21:27:41 Done.
+ action(struct_gen_target_name) {
+ script = ios_app_script
+
+ sources = []
+ outputs = [
+ "$root_build_dir/$app_name.app",
+ ]
+
+ args = [
+ "structure",
+ "-d",
+ rebase_path(root_build_dir),
+ "-n",
+ app_name,
+ ]
+ }
+
+ # Generate the executable
+ executable(bin_gen_target_name) {
+ output_name = "${app_name}.app/${app_name}"
+ if (defined(invoker.testonly)) {
+ testonly = invoker.testonly
+ }
+
+ if (defined(invoker.libs)) {
+ libs = invoker.libs
+ } else {
+ libs = []
+ }
+ libs += [
+ "UIKit.framework",
+ "QuartzCore.framework",
+ "OpenGLES.framework",
+ ]
+
+ deps = invoker.deps + [
+ ":$struct_gen_target_name",
+ ":$plist_gen_target_name",
+ ]
+ }
+
+ # Process the Info.plist
+
+ action(plist_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"),
+ ]
+
+ deps = [
+ ":$struct_gen_target_name",
+ ]
+ }
+
+ # Copy the generated binaries and assets to their appropriate locations
+
+ #copy_gen_target_name = target_name + "_copy"
sdefresne 2015/07/25 19:15:30 This looks like this can be removed as the other t
Dirk Pranke 2015/07/31 21:27:40 Right.
+ #copy(copy_gen_target_name) {
+ # sources = [
+ # # "$root_build_dir/$app_name",
+ # #"$root_build_dir/Info.plist",
+ # ]
+ #
+ # outputs = [
+ # "$root_build_dir/$app_name.app/{{source_file_part}}",
+ # ]
+ #
+ # deps = [
+ # ":$struct_gen_target_name",
+ # ":$bin_gen_target_name",
+ # ":$plist_gen_target_name",
+ # ]
+ #}
+
+ # Perform Code Signing
+
+ code_sign_gen_target_name = target_name + "_codesign"
+ code_sign_ios(code_sign_gen_target_name) {
+ entitlements_path = invoker.entitlements_path
+ identity = invoker.code_signing_identity
+ application_path = "$root_build_dir/$app_name.app"
+ deps = [
+ #":$copy_gen_target_name",
+ ":$struct_gen_target_name",
+ ":$plist_gen_target_name",
+ ":$bin_gen_target_name",
+ ]
+ if (defined(invoker.testonly)) {
+ testonly = invoker.testonly
+ }
+ }
+
+ # Top level group
+
+ group(target_name) {
+ # Skip code signing if no identity is provided. This is useful for simulator
+ # builds
sdefresne 2015/07/25 19:15:30 nit: full stop?
Dirk Pranke 2015/07/31 21:27:40 Done.
+ deps = []
+ if (invoker.code_signing_identity == "") {
sdefresne 2015/07/25 19:15:30 question: why not flatten the hierarchy, i.e. do t
Dirk Pranke 2015/07/31 21:27:40 I just hadn't gotten to cleaning this up yet. Will
+ deps += [
+ ":$struct_gen_target_name",
+ ":$plist_gen_target_name",
+ ":$bin_gen_target_name",
+ ]
+ } else {
+ deps += [ ":$code_sign_gen_target_name" ]
+ }
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698