Avoid propagating configs across toolchain.

gn will be modified to no longer propagate public_configs across
toolchains (as this is a problem with some platforms). Refactor
ios_framework_bundle template to define the configs for all the
toolchains and to put the references directly (instead of having
secondary toolchain get them through the dependency).

BUG=675224

Review-Url: https://codereview.chromium.org/2627983002
Cr-Original-Commit-Position: refs/heads/master@{#442967}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 72c855683a26d8290f0366a06455d7ec38283aae
This commit is contained in:
sdefresne 2017-01-11 10:50:49 -08:00 коммит произвёл Commit bot
Родитель 77f8180054
Коммит fa9bbb3416
1 изменённых файлов: 54 добавлений и 35 удалений

Просмотреть файл

@ -997,15 +997,53 @@ template("ios_framework_bundle") {
_has_public_headers =
defined(invoker.public_headers) && invoker.public_headers != []
# Public configs are not propagated across toolchain (see crbug.com/675224)
# so some configs have to be defined for both default_toolchain and all others
# toolchains when performing a fat build. Use "get_label_info" to construct
# the path since they need to be relative to the default_toolchain.
_default_toolchain_root_out_dir =
get_label_info("$_target_name($default_toolchain)", "root_out_dir")
_default_toolchain_target_gen_dir =
get_label_info("$_target_name($default_toolchain)", "target_gen_dir")
if (_has_public_headers) {
_framework_headers_target = _target_name + "_framework_headers"
_framework_headers_config = _target_name + "_framework_headers_config"
config(_framework_headers_config) {
# The link settings are inherited from the framework_bundle config.
cflags = [
"-F",
rebase_path("$_default_toolchain_root_out_dir/.", root_build_dir),
]
}
_headers_map_config = _target_name + "_headers_map"
_header_map_filename =
"$_default_toolchain_target_gen_dir/$_output_name.headers.hmap"
config(_headers_map_config) {
visibility = [ ":$_target_name" ]
include_dirs = [ _header_map_filename ]
}
}
_arch_shared_library_source = _target_name + "_arch_shared_library_sources"
_arch_shared_library_target = _target_name + "_arch_shared_library"
_lipo_shared_library_target = _target_name + "_shared_library"
_link_target_name = _target_name + "+link"
_framework_public_config = _target_name + "_public_config"
config(_framework_public_config) {
# TODO(sdefresne): should we have a framework_dirs similar to lib_dirs
# and include_dirs to avoid duplicate values on the command-line.
visibility = [ ":$_target_name" ]
ldflags = [
"-F",
rebase_path("$_default_toolchain_root_out_dir/.", root_build_dir),
]
lib_dirs = [ root_out_dir ]
libs = [ "$_output_name.framework" ]
}
source_set(_arch_shared_library_source) {
forward_variables_from(invoker,
@ -1025,8 +1063,8 @@ template("ios_framework_bundle") {
if (_has_public_headers) {
configs += [
":$_framework_headers_config($default_toolchain)",
":$_headers_map_config($default_toolchain)",
":$_framework_headers_config",
":$_headers_map_config",
]
if (!defined(deps)) {
@ -1097,15 +1135,24 @@ template("ios_framework_bundle") {
]
}
group(_target_name + "+link") {
group(_link_target_name) {
forward_variables_from(invoker,
[
"public_configs",
"visibility",
"testonly",
])
public_deps = [
":$_target_name+link($default_toolchain)",
":$_link_target_name($default_toolchain)",
]
if (!defined(public_configs)) {
public_configs = []
}
public_configs += [ ":$_framework_public_config" ]
if (_has_public_headers) {
public_configs += [ ":$_framework_headers_config" ]
}
}
if (defined(invoker.bundle_deps)) {
@ -1116,8 +1163,6 @@ template("ios_framework_bundle") {
_public_headers = invoker.public_headers
_framework_root = "$root_out_dir/$_output_name.framework"
_header_map_filename = "$target_gen_dir/$_output_name.headers.hmap"
_compile_headers_map_target = _target_name + "_compile_headers_map"
action(_compile_headers_map_target) {
visibility = [ ":$_framework_headers_target" ]
@ -1165,11 +1210,6 @@ template("ios_framework_bundle") {
]
}
config(_headers_map_config) {
visibility = [ ":$_target_name" ]
include_dirs = [ _header_map_filename ]
}
group(_framework_headers_target) {
deps = [
":$_compile_headers_map_target",
@ -1177,14 +1217,6 @@ template("ios_framework_bundle") {
":$_create_module_map_target",
]
}
config(_framework_headers_config) {
# The link settings are inherited from the framework_bundle config.
cflags = [
"-F",
rebase_path("$root_out_dir/.", root_build_dir),
]
}
}
lipo_binary(_lipo_shared_library_target) {
@ -1200,19 +1232,6 @@ template("ios_framework_bundle") {
arch_binary_output = _output_name
}
_framework_public_config = _target_name + "_public_config"
config(_framework_public_config) {
# TODO(sdefresne): should we have a framework_dirs similar to lib_dirs
# and include_dirs to avoid duplicate values on the command-line.
visibility = [ ":$_target_name" ]
ldflags = [
"-F",
rebase_path("$root_out_dir/.", root_build_dir),
]
lib_dirs = [ root_out_dir ]
libs = [ "$_output_name.framework" ]
}
_info_plist_target = _target_name + "_info_plist"
_info_plist_bundle = _target_name + "_info_plist_bundle"
ios_info_plist(_info_plist_target) {
@ -1265,11 +1284,11 @@ template("ios_framework_bundle") {
deps += [ ":$_info_plist_bundle" ]
}
group(_target_name + "+link") {
group(_link_target_name) {
forward_variables_from(invoker,
[
"public_deps",
"public_configs",
"public_deps",
"testonly",
"visibility",
])
@ -1277,11 +1296,11 @@ template("ios_framework_bundle") {
public_deps = []
}
public_deps += [ ":$_target_name" ]
if (!defined(public_configs)) {
public_configs = []
}
public_configs += [ ":$_framework_public_config" ]
if (_has_public_headers) {
public_configs += [ ":$_framework_headers_config" ]
}