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

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

Issue 1877523002: Mac/iOS/GN: Generate Info.plist files for Mac apps and frameworks with gn. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactor out Info.plist generation into its own template. Created 4 years, 8 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
index f8ec3613d48c35c17834f9b4f000f090df579337..cbc71350f2fbbdf4990cde43d2c6ebaddfa4ae75 100644
--- a/build/config/mac/rules.gni
+++ b/build/config/mac/rules.gni
@@ -3,8 +3,52 @@
# found in the LICENSE file.
import("//build/toolchain/toolchain.gni")
+import("//build/config/mac/mac_sdk.gni")
+import("//build/util/version.gni")
-# This is used as the base template for both iOS and Mac frameworks..
+# Used to generate an Info.plist file for iOS and Mac apps and frameworks.
Robert Sesek 2016/04/19 14:49:04 Also document the Arguments as the other templates
Patti Lor 2016/04/21 08:02:09 Done.
+template("info_plist") {
+ _generate_info_plist = target_name + "_action"
+
+ action(_generate_info_plist) {
+ script = "//build/config/mac/gen_plist.py"
+ sources = [
+ "//build/config/mac/BuildInfo.plist",
+ invoker.info_plist,
+ ]
+ outputs = [
+ "$target_gen_dir/Info.plist",
+ ]
+ extra_args = []
+ if (defined(invoker.extra_substitutions)) {
+ foreach(substitution, invoker.extra_substitutions) {
+ extra_args += [ "-s=$substitution" ]
+ }
+ }
+ response_file_contents =
+ extra_args + [
+ "-s=MAC_SDK_BUILD=$mac_sdk_build",
+ "-s=MAC_SDK_NAME=$mac_sdk_name$mac_sdk_version",
+ "-s=BUILD_MACHINE_OS_BUILD=$machine_os_build",
+ "-s=GCC_VERSION=com.apple.compilers.llvm.clang.1_0",
+ "-s=XCODE_BUILD=$xcode_build",
+ "-s=XCODE_VERSION=$xcode_version",
+ "-s=VERSION=$chrome_version_full",
+ "-s=VERSION_BUILD=$chrome_version_build",
+ "-o=" + rebase_path(outputs[0], root_build_dir),
+ ] + rebase_path(sources, root_build_dir)
+ args = [ "@{{response_file_name}}" ]
+ }
+
+ source_set(target_name) {
+ sources = get_target_outputs(":$_generate_info_plist")
+ public_deps = [
+ ":$_generate_info_plist",
+ ]
+ }
+}
+
+# This is used as the base template for both iOS and Mac frameworks.
#
# Arguments
#
@@ -27,7 +71,7 @@ template("framework_bundle") {
_output_name = invoker.output_name
}
- # If the framework is unversionned, the final _target_name will be the
+ # If the framework is unversioned, the final _target_name will be the
# create_bundle(_framework_target), otherwise an action with the name
# _target_name will depends on the the create_bundle() in order to prepare
# the versioned directory structure.
@@ -150,17 +194,24 @@ template("mac_framework_bundle") {
_info_plist_target = target_name + "_info_plist"
# TODO(rsesek): Process Info.plist variables.
Robert Sesek 2016/04/19 14:49:04 Remove, since you're doing it :).
Patti Lor 2016/04/21 08:02:09 Done.
+ info_plist(_info_plist_target) {
+ forward_variables_from(invoker, [ "info_plist" ])
+ }
_info_plist_bundle_data = _info_plist_target + "_bundle_data"
bundle_data(_info_plist_bundle_data) {
forward_variables_from(invoker, [ "testonly" ])
sources = [
+ "$target_gen_dir/Info.plist",
invoker.info_plist,
]
outputs = [
"{{bundle_root_dir}}/Info.plist",
]
+ public_deps = [
+ ":$_info_plist_target",
+ ]
}
framework_bundle(target_name) {
@@ -228,6 +279,16 @@ template("mac_app_bundle") {
_info_plist_target = target_name + "_info_plist"
# TODO(rsesek): Process Info.plist variables.
Robert Sesek 2016/04/19 14:49:04 Remove.
Patti Lor 2016/04/21 08:02:09 Done.
+ info_plist(_info_plist_target) {
+ forward_variables_from(invoker, [ "info_plist" ])
+ if (!defined(extra_substitutions)) {
Robert Sesek 2016/04/19 14:49:04 Since you're not forward_varaibles_from()-ing extr
Patti Lor 2016/04/21 08:02:09 Done.
+ extra_substitutions = []
+ }
+ extra_substitutions += [
+ "PRODUCT_NAME=$_output_name",
Robert Sesek 2016/04/19 14:49:04 These subs are needed in the mac_framework_bundle
Patti Lor 2016/04/21 08:02:09 Done.
+ "EXECUTABLE_NAME=$_output_name",
+ ]
+ }
_info_plist_bundle_data = _info_plist_target + "_bundle_data"
@@ -235,11 +296,15 @@ template("mac_app_bundle") {
forward_variables_from(invoker, [ "testonly" ])
visibility = [ ":$_target_name" ]
sources = [
+ "$target_gen_dir/Info.plist",
invoker.info_plist,
]
outputs = [
"{{bundle_root_dir}}/Info.plist",
]
+ public_deps = [
+ ":$_info_plist_target",
+ ]
}
create_bundle(_target_name) {

Powered by Google App Engine
This is Rietveld 408576698