Chromium Code Reviews| Index: build/config/ios/rules.gni |
| diff --git a/build/config/ios/rules.gni b/build/config/ios/rules.gni |
| index 604e7abec65b1ea63c80a47a95a254ea4864789b..e1937e12c48bb4e5fc375a88428fc5be8a310984 100644 |
| --- a/build/config/ios/rules.gni |
| +++ b/build/config/ios/rules.gni |
| @@ -76,8 +76,8 @@ template("ios_app_bundle") { |
| "-s=PRODUCT_NAME=$_output_name", |
| "-s=XCODE_BUILD=$xcode_build", |
| "-s=XCODE_VERSION=$xcode_version", |
| - "-o=" + rebase_path(outputs[0], root_build_dir), |
| - ] + rebase_path(sources, root_build_dir) |
| + "-o=" + rebase_path(outputs[0], root_out_dir), |
| + ] + rebase_path(sources, root_out_dir) |
| args = [ "@{{response_file_name}}" ] |
| } |
| @@ -110,7 +110,7 @@ template("ios_app_bundle") { |
| "visibility", |
| ]) |
| - output_name = rebase_path("$target_gen_dir/$_output_name", root_build_dir) |
| + output_name = rebase_path("$target_gen_dir/$_output_name", root_out_dir) |
| if (!defined(libs)) { |
| libs = [] |
| } |
| @@ -210,7 +210,7 @@ template("bundle_data_xib") { |
| "--output", |
| rebase_path("$target_gen_dir/$_nib_filename"), |
| "--input", |
| - rebase_path(invoker.source, root_build_dir), |
| + rebase_path(invoker.source, root_out_dir), |
| ] |
| } |
| @@ -246,10 +246,97 @@ template("bundle_data_xib") { |
| # structure will not be created, and build output will go directly |
| # into the framework subdirectory. |
| # |
| +# public_headers: |
| +# (optional) list of paths to header file that needs to be copied |
| +# into the framework bundle Headers subdirectory. If omitted or |
| +# empty then the Headers subdirectory is not created. |
| +# |
| # See "gn help shared_library" for more information on arguments supported |
| # by shared library target. |
| template("ios_framework_bundle") { |
| + if (defined(invoker.public_headers) && invoker.public_headers != []) { |
| + _target_name = target_name |
|
Robert Sesek
2016/04/11 18:32:28
optional: pull _target_name and _output_name out o
sdefresne
2016/04/12 13:05:19
I tried to pull _output_name outside of the "if" b
|
| + _output_name = target_name |
| + if (defined(invoker.output_name)) { |
| + _output_name = invoker.output_name |
| + } |
| + |
| + _public_headers = invoker.public_headers |
| + _framework_name = _output_name + ".framework" |
|
Robert Sesek
2016/04/11 18:32:28
I wish we didn't have to duplicate this, but I don
sdefresne
2016/04/12 13:05:19
Acknowledge. One option would be to change framewo
|
| + _framework_root = "$root_out_dir/$_framework_name" |
| + |
| + _header_map_filename = "$target_gen_dir/$_output_name.headers.map" |
| + |
| + _compile_headers_map_target = _target_name + "_compile_headers_map" |
| + action(_compile_headers_map_target) { |
|
Robert Sesek
2016/04/11 18:32:29
Should each of these sub-targets have visibility s
sdefresne
2016/04/12 13:05:19
Done, except for "_create_module_map_target" as I
|
| + script = "$root_out_dir/gyp-mac-tool" |
| + outputs = [ |
| + _header_map_filename, |
| + ] |
| + |
| + sources = [] |
| + foreach(_source_file, invoker.sources) { |
| + _source_extension = get_path_info(_source_file, "extension") |
| + if (_source_extension == "h") { |
| + sources += [ _source_file ] |
| + } |
| + } |
| + |
| + args = [ |
| + "compile-ios-framework-header-map", |
| + rebase_path(_header_map_filename), |
| + rebase_path(_framework_root, root_out_dir), |
| + ] + rebase_path(sources, root_out_dir) |
| + } |
| + |
| + _create_module_map_target = _target_name + "_module_map" |
| + action(_create_module_map_target) { |
| + script = "$root_out_dir/gyp-mac-tool" |
| + outputs = [ |
| + "$_framework_root/Modules/module.modulemap", |
| + ] |
| + args = [ |
| + "package-ios-framework", |
| + rebase_path("$_framework_root", root_out_dir), |
| + ] |
| + } |
| + |
| + _copy_public_headers_target = _target_name + "_copy_public_headers" |
| + copy(_copy_public_headers_target) { |
| + sources = _public_headers |
| + outputs = [ |
| + "$_framework_root/Headers/{{source_file_part}}", |
| + ] |
| + } |
| + |
| + _headers_map_config = _target_name + "_headers_map" |
| + config(_headers_map_config) { |
| + include_dirs = [ _header_map_filename ] |
| + } |
| + |
| + _framework_headers_target = _target_name + "_framework_headers" |
| + group(_framework_headers_target) { |
| + deps = [ |
| + ":$_compile_headers_map_target", |
| + ":$_copy_public_headers_target", |
| + ":$_create_module_map_target", |
| + ] |
| + } |
| + } |
| + |
| framework_bundle(target_name) { |
| - forward_variables_from(invoker, "*") |
| + forward_variables_from(invoker, "*", [ "configs" ]) |
| + |
| + configs = [] |
| + if (defined(invoker.configs)) { |
| + configs += invoker.configs |
| + } |
| + |
| + if (defined(_public_headers)) { |
| + configs += [ ":$_headers_map_config" ] |
| + deps = [ |
| + ":$_framework_headers_target", |
| + ] |
| + } |
| } |
| } |