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

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

Issue 1808733003: [iOS] Fix ios_web_shell to build with gn. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@components
Patch Set: Created 4 years, 9 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
« no previous file with comments | « build/config/ios/ios_compile_xib.py ('k') | ios/web/shell/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/config/ios/rules.gni
diff --git a/build/config/ios/rules.gni b/build/config/ios/rules.gni
index 6aef64aa42b0fef1dce9eb0bf5dd87837be99f01..0b41d5d4145ecb2ca5ae808da501cb66effdebf0 100644
--- a/build/config/ios/rules.gni
+++ b/build/config/ios/rules.gni
@@ -186,3 +186,63 @@ template("app") {
# an alias to "ninja -C out/Default base_unittests" (for convenience
# and compatibility with gyp),
}
+
+# Compile a xib or storyboard file and add it to a bundle_data so that it is
+# available at runtime in the bundle.
+#
+# Arguments
+#
+# source:
+# string, path of the xib or storyboard to compile.
+#
+# Forwards all variables to the bundle_data target.
+template("bundle_data_xib") {
+ assert(defined(invoker.source), "source needs to be defined for $target_name")
+
+ _source_extension = get_path_info(invoker.source, "extension")
+ assert(_source_extension == "xib" || _source_extension == "storyboard",
+ "source must be a .xib or .storyboard for $target_name")
+
+ _target_name = target_name
Dirk Pranke 2016/03/16 22:00:17 why bother with _target_name here?
sdefresne 2016/03/17 17:53:14 I want the following: ${target_name} -> ${targe
Dirk Pranke 2016/03/18 02:19:59 Ah, right. I forgot about this. Sorry!
+ _compile_xib = target_name + "_compile_xib"
+
+ _nib_basename = get_path_info(invoker.source, "name")
+ _nib_filename = "$_nib_basename.nib"
+
+ action(_compile_xib) {
+ visibility = [ ":$_target_name" ]
+ script = "//build/config/ios/ios_compile_xib.py"
+ sources = [
+ invoker.source,
+ ]
+ outputs = [
+ "$target_gen_dir/$_nib_filename/objects.nib",
+ "$target_gen_dir/$_nib_filename/runtime.nib",
+ ]
+ args = [
+ "--minimum-deployment-target",
+ ios_deployment_target,
+ "--output",
+ rebase_path("$target_gen_dir/$_nib_filename"),
+ "--input",
+ rebase_path(invoker.source, root_build_dir),
+ ]
+ }
+
+ bundle_data(_target_name) {
+ forward_variables_from(invoker, "*", [ "source" ])
+
+ if (!defined(public_deps)) {
+ public_deps = []
+ }
+ public_deps += [ ":$_compile_xib" ]
+
+ sources = [
+ "$target_gen_dir/$_nib_filename/objects.nib",
+ "$target_gen_dir/$_nib_filename/runtime.nib",
+ ]
+ outputs = [
+ "{{bundle_resources_dir}}/$_nib_filename/{{source_file_part}}",
+ ]
+ }
+}
« no previous file with comments | « build/config/ios/ios_compile_xib.py ('k') | ios/web/shell/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698