blob: 2008c956c8b599840153a4cf739d12abe080afd7 [file] [log] [blame]
# Copyright 2022 The Cobalt Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
template("bundle_content") {
bundle_name = invoker.bundle_name
bundle_deps = invoker.bundle_deps
bundle_content_list_file = "$root_gen_dir/${target_name}_files.txt"
file_format = "list lines"
# If the platform bundles content the list of content files can be collected
# from the metadata field of the generated install_content targets.
generated_file("list_$target_name") {
forward_variables_from(invoker, [ "testonly" ])
# Rebase the paths the script working directory.
rebase = root_build_dir
data_keys = [ "install_content" ]
walk_keys = [ "ignore_install_content" ]
deps = []
foreach(dep, bundle_deps) {
deps += [ "${dep}_install_content" ]
}
output_conversion = file_format
outputs = [ bundle_content_list_file ]
}
action(target_name) {
forward_variables_from(invoker, [ "testonly" ])
deps = [ ":list_$target_name" ]
inputs = [ bundle_content_list_file ]
bundle_content_dir =
"$sb_install_output_dir/$bundle_name/$sb_install_content_subdir"
# TODO(b/220024845): We don't have the list of output files. The files
# are listed in `bundle_content_list_file` but can't be accessed in GN
# as `read_file` can't reliably access files generated by
# `generated_file` targets.
outputs = [ bundle_content_dir ]
script = "//starboard/build/copy_install_content.py"
args = [
"--output_dir",
rebase_path(bundle_content_dir, root_build_dir),
"--base_dir",
rebase_path(sb_static_contents_output_data_dir, root_build_dir),
"--files_list",
rebase_path(bundle_content_list_file, root_build_dir),
]
}
}