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

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

Issue 1910133002: [iOS/Mac/GN] The framework_bundle template should not force dependencies to link it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 721271e6cf3c8a63ac113ae0e066f06c9e28bb4d..522747ef131c75631eb180807fccafcb86b16e97 100644
--- a/build/config/mac/rules.gni
+++ b/build/config/mac/rules.gni
@@ -5,7 +5,13 @@
import("//build/toolchain/toolchain.gni")
import("//build/config/mac/mac_sdk.gni")
-# This is used as the base template for both iOS and Mac frameworks..
+# This is used as the base template for both iOS and Mac frameworks.
+#
+# By default, the bundle target this template generates does not link the
brettw 2016/04/21 20:27:55 This seems like it would work in the other place.
Robert Sesek 2016/04/22 15:27:06 Done.
+# resulting framework into anything that depends on it. If a dependency wants
+# a link-time (as well as build-time) dependency on the framework bundle,
+# depend against "$target_name+link". If only the build-time dependency is
+# required (e.g., for copying into another bundle), then use "$target_name".
#
# Arguments
#
@@ -80,10 +86,7 @@ template("framework_bundle") {
# TODO(sdefresne): should we have a framework_dirs similar to lib_dirs
# and include_dirs to avoid duplicate values on the command-line.
visibility = [ ":$_framework_target" ]
- common_flags = [ "-F" + rebase_path("$root_out_dir/.", root_out_dir) ]
- cflags_objc = common_flags
sdefresne 2016/04/22 07:59:48 I think we need -F in cflags_objc/cflags_objcc whe
Robert Sesek 2016/04/22 15:27:06 I moved that to the ios/rules.gni config since Mac
- cflags_objcc = common_flags
- ldflags = common_flags
+ ldflags = [ "-F" + rebase_path("$root_out_dir/.", root_out_dir) ]
lib_dirs = [ root_out_dir ]
libs = [ _framework_name ]
}
@@ -100,7 +103,10 @@ template("framework_bundle") {
if (defined(_framework_version)) {
visibility = [ ":$_target_name" ]
} else {
- forward_variables_from(invoker, [ "visibility" ])
+ if (defined(invoker.visibility)) {
+ visibility = invoker.visibility
+ visibility += [ ":$_target_name+link" ]
+ }
}
if (!defined(public_deps)) {
@@ -108,8 +114,6 @@ template("framework_bundle") {
}
public_deps += [ ":$_shared_library_bundle_data" ]
- public_configs = [ ":$_framework_public_config" ]
-
bundle_root_dir = _framework_root_dir
bundle_resources_dir = "$bundle_root_dir/Resources"
bundle_executable_dir = "$bundle_root_dir"
@@ -117,11 +121,13 @@ template("framework_bundle") {
if (defined(_framework_version)) {
action(_target_name) {
- forward_variables_from(invoker,
- [
- "visibility",
- "testonly",
- ])
+ forward_variables_from(invoker, [ "testonly" ])
+
+ if (defined(invoker.visibility)) {
+ visibility = invoker.visibility
+ visibility += [ ":$_target_name+link" ]
+ }
+
script = "$root_out_dir/gyp-mac-tool"
outputs = [
"$root_out_dir/$_framework_name/Versions/Current",
@@ -136,6 +142,18 @@ template("framework_bundle") {
]
}
}
+
+ group(_target_name + "+link") {
+ forward_variables_from(invoker,
+ [
+ "visibility",
+ "testonly",
+ ])
+ public_deps = [
+ ":$_target_name",
+ ]
+ public_configs = [ ":$_framework_public_config" ]
+ }
}
# Template to combile .xib or .storyboard files.

Powered by Google App Engine
This is Rietveld 408576698