2019-10-22 00:11:09 +03:00
|
|
|
import("//build/config/mac/mac_sdk.gni")
|
|
|
|
|
2019-11-06 02:41:20 +03:00
|
|
|
# Template to compile .xib and .storyboard files.
|
|
|
|
# (copied from src/build/config/ios/rules.gni)
|
|
|
|
#
|
|
|
|
# Arguments
|
|
|
|
#
|
|
|
|
# sources:
|
|
|
|
# list of string, sources to compile
|
|
|
|
#
|
|
|
|
# ibtool_flags:
|
|
|
|
# (optional) list of string, additional flags to pass to the ibtool
|
|
|
|
template("compile_ib_files") {
|
|
|
|
action_foreach(target_name) {
|
|
|
|
forward_variables_from(invoker,
|
|
|
|
[
|
|
|
|
"testonly",
|
|
|
|
"visibility",
|
|
|
|
])
|
|
|
|
assert(defined(invoker.sources),
|
|
|
|
"sources must be specified for $target_name")
|
|
|
|
assert(defined(invoker.output_extension),
|
|
|
|
"output_extension must be specified for $target_name")
|
|
|
|
|
|
|
|
ibtool_flags = []
|
|
|
|
if (defined(invoker.ibtool_flags)) {
|
|
|
|
ibtool_flags = invoker.ibtool_flags
|
|
|
|
}
|
|
|
|
|
|
|
|
_output_extension = invoker.output_extension
|
|
|
|
|
|
|
|
script = "//build/config/ios/compile_ib_files.py"
|
|
|
|
sources = invoker.sources
|
|
|
|
outputs = [
|
|
|
|
"$target_gen_dir/$target_name/{{source_name_part}}.$_output_extension",
|
|
|
|
]
|
|
|
|
args = [
|
|
|
|
"--input",
|
|
|
|
"{{source}}",
|
|
|
|
"--output",
|
|
|
|
rebase_path(
|
|
|
|
"$target_gen_dir/$target_name/{{source_name_part}}.$_output_extension",
|
|
|
|
root_build_dir),
|
|
|
|
]
|
|
|
|
args += ibtool_flags
|
|
|
|
}
|
|
|
|
}
|
2019-10-22 00:11:09 +03:00
|
|
|
|
|
|
|
# Template is copied here from Chromium but was removed in
|
|
|
|
# https://chromium-review.googlesource.com/c/chromium/src/+/1637981
|
|
|
|
# Template to compile and package Mac XIB files as bundle data.
|
|
|
|
# Arguments
|
|
|
|
# sources:
|
2022-06-16 10:46:11 +03:00
|
|
|
# list of string, sources to compile
|
2019-10-22 00:11:09 +03:00
|
|
|
# output_path:
|
|
|
|
# (optional) string, the path to use for the outputs list in the
|
|
|
|
# bundle_data step. If unspecified, defaults to bundle_resources_dir.
|
|
|
|
template("mac_xib_bundle_data") {
|
|
|
|
_target_name = target_name
|
|
|
|
_compile_target_name = _target_name + "_compile_ibtool"
|
|
|
|
|
|
|
|
compile_ib_files(_compile_target_name) {
|
|
|
|
forward_variables_from(invoker, [ "testonly" ])
|
|
|
|
visibility = [ ":$_target_name" ]
|
|
|
|
sources = invoker.sources
|
|
|
|
output_extension = "nib"
|
|
|
|
ibtool_flags = [
|
|
|
|
"--minimum-deployment-target",
|
|
|
|
mac_deployment_target,
|
|
|
|
|
|
|
|
# TODO(rsesek): Enable this once all the bots are on Xcode 7+.
|
|
|
|
# "--target-device",
|
|
|
|
# "mac",
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
bundle_data(_target_name) {
|
|
|
|
forward_variables_from(invoker,
|
|
|
|
[
|
|
|
|
"testonly",
|
|
|
|
"visibility",
|
|
|
|
])
|
|
|
|
|
2020-01-17 21:41:52 +03:00
|
|
|
public_deps = [ ":$_compile_target_name" ]
|
2019-10-22 00:11:09 +03:00
|
|
|
sources = get_target_outputs(":$_compile_target_name")
|
|
|
|
|
|
|
|
_output_path = "{{bundle_resources_dir}}"
|
|
|
|
if (defined(invoker.output_path)) {
|
|
|
|
_output_path = invoker.output_path
|
|
|
|
}
|
|
|
|
|
2020-01-17 21:41:52 +03:00
|
|
|
outputs = [ "$_output_path/{{source_file_part}}" ]
|
2019-10-22 00:11:09 +03:00
|
|
|
}
|
|
|
|
}
|