Chrome on iOS uses some libraries that ship localized data as resources bundles. For example:
Library.bundle/some.png
Library.bundle/some@2x.png
Library.bundle/some@3x.png
Library.bundle/Resources/ar.lproj/Library.strings
Library.bundle/Resources/bg.lproj/Library.strings
...
Currently, to use bundle_data, this is painful, as it needs to be done like this:
_locales = [ "ar", "bg", ... ]
foreach (locale, _locales) {
bundle_data("bundle_data_$locale") {
visibility = [ ":bundle_data" ]
sources = [ "Library.bundle/Resources/$locale.lproj/Library.strings" ]
outputs = [ "{{bundle_resources_dir}}/Library.bundle/Resources/$locale.lproj/{{source_file_part}}" ]
}
}
bundle_data("bundle_data") {
sources = [
"Library.bundle/some.png",
"Library.bundle/some@2x.png",
"Library.bundle/some@3x.png",
]
outputs = [ "{{bundle_resources_dir}}/Library.bundle/{{source_file_part}}" ]
deps = []
foreach (locale, _locales) {
deps += [ ":bundle_data_$locale" ]
}
}
This is painful, and instead I'd like to have something like this:
bundle_data("bundle_data") {
sources = [
"Library.bundle/some.png",
"Library.bundle/some@2x.png",
"Library.bundle/some@3x.png",
"Library.bundle/Resources/ar.lproj/Library.strings",
"Library.bundle/Resources/bg.lproj/Library.strings",
...
]
outputs = [ "{{bundle_resources_dir}}/{{some_substitution}}/{{source_file_part}}" ]
}
Where {{some_substitution}} would expand to file directory relative to current directory instead of relative to //. Looking at "gn help source_expansion" I see no expansion that could fit here.
Comment 1 by liaoyuke@chromium.org
, Apr 19 2017