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

Unified Diff: build/config/mac/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: status Created 5 years, 4 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/mac/rules.gni
diff --git a/build/config/mac/rules.gni b/build/config/mac/rules.gni
new file mode 100644
index 0000000000000000000000000000000000000000..8baad60597b9cfeb664ce58f7cc0a824b3c5409d
--- /dev/null
+++ b/build/config/mac/rules.gni
@@ -0,0 +1,212 @@
+# 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.
+
+mac_app_script = "//build/config/mac/mac_app.py"
+
+template("code_sign_mac") {
+ 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 = mac_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",
+ "visibility",
+ ])
+ }
+}
+
+template("process_nibs_mac") {
+ assert(defined(invoker.sources), "The nib sources must be specified")
+ assert(defined(invoker.module), "The nib module must be specified")
+ assert(defined(invoker.output_dir), "The output directory must be specified")
+
+ action_foreach(target_name) {
+ sources = invoker.sources
+
+ script = mac_app_script
+
+ invoker_out_dir = invoker.output_dir
+
+ outputs = [
+ "$root_build_dir/$invoker_out_dir/{{source_name_part}}.nib",
+ ]
+
+ args = [
+ "nib",
+ "-i",
+ "{{source}}",
+ "-o",
+ invoker_out_dir,
+ "-m",
+ invoker.module,
+ ]
+ }
+
+ forward_variables_from(invoker,
+ [
+ "deps",
+ "public_deps",
+ "visibility",
+ ])
+}
+
+template("resource_copy_mac") {
+ 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")
+
+ if (defined(invoker.app_name)) {
+ _app_name = invoker.app_name
+ } else {
+ _app_name = target_name
+ }
+
+ _bundle_directory = invoker.bundle_directory
+ _resources = invoker.resources
+
+ copy(target_name) {
+ set_sources_assignment_filter([])
+ sources = _resources
+ outputs = [
+ "$root_build_dir/$_app_name.app/$_bundle_directory/Contents/Resources/{{source_file_part}}",
+ ]
+ }
+}
+
+template("mac_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.xibs),
+ "The list of XIB files must be specified for $target_name")
+
+ group_gen_target_name = target_name
+ copy_all_target_name = target_name + "_all_copy"
+
+ # We just create a variable so we can use the same in interpolation
+ if (defined(invoker.app_name)) {
+ _app_name = invoker.app_name
+ } else {
+ _app_name = target_name
+ }
+
+ # Generate the executable
+ bin_gen_target_name = target_name + "_bin"
+ executable(bin_gen_target_name) {
+ visibility = [ ":$group_gen_target_name" ]
+ deps = invoker.deps
+ output_name = app_name
+ }
+
+ # Process the Info.plist
+ plist_gen_target_name = target_name + "_plist"
+
+ action(plist_gen_target_name) {
+ visibility = [ ":$group_gen_target_name" ]
+ script = mac_app_script
+
+ sources = [
+ invoker.info_plist,
+ ]
+ outputs = [
+ "$root_build_dir/Info.plist",
+ ]
+
+ args = [
+ "plist",
+ "-i",
+ rebase_path(invoker.info_plist, root_build_dir),
+ "-o",
+ rebase_path(root_build_dir),
+ ]
+ }
+
+ # Copy the generated binaries and assets to their appropriate locations
+ copy_plist_gen_target_name = target_name + "_plist_copy"
+ copy(copy_plist_gen_target_name) {
+ visibility = [ ":$group_gen_target_name" ]
+ sources = [
+ "$root_build_dir/Info.plist",
+ ]
+
+ outputs = [
+ "$root_build_dir/$app_name.app/Contents/{{source_file_part}}",
+ ]
+
+ deps = [
+ ":$plist_gen_target_name",
+ ]
+ }
+
+ copy_bin_target_name = target_name + "_bin_copy"
+ copy(copy_bin_target_name) {
+ visibility = [ ":$group_gen_target_name" ]
+ sources = [
+ "$root_build_dir/$app_name",
+ ]
+
+ outputs = [
+ "$root_build_dir/$app_name.app/Contents/MacOS/{{source_file_part}}",
+ ]
+
+ deps = [
+ ":$bin_gen_target_name",
+ ]
+ }
+
+ copy_xib_target_name = target_name + "_xib_copy"
+ process_nibs_mac(copy_xib_target_name) {
+ visibility = [ ":$group_gen_target_name" ]
+ sources = invoker.xibs
+ module = app_name
+ output_dir = "$app_name.app/Contents/Resources"
+ }
+
+ group(copy_all_target_name) {
+ visibility = [ ":$group_gen_target_name" ]
+ deps = [
+ ":$struct_gen_target_name",
+ ":$copy_plist_gen_target_name",
+ ":$copy_bin_target_name",
+ ":$copy_xib_target_name",
+ ]
+ }
+
+ # Top level group
+
+ group(group_gen_target_name) {
+ deps = [
+ ":$copy_all_target_name",
+ ]
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698