dawn-cmake/generator/BUILD.gn

64 lines
2.1 KiB
Plaintext

# Copyright 2019 The Dawn Authors
#
# 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.
import("../scripts/dawn_overrides_with_defaults.gni")
import("dawn_generator.gni")
# The list of directories in which to check for stale autogenerated files.
# It should include the list of all directories in which we ever generated
# files but we can't just put dawn_gen_root because there are more than
# autogenerated sources there.
_stale_dirs = [
"dawn",
"dawn/native",
"dawn/wire",
"mock",
"src",
]
_allowed_output_dirs_file =
"${dawn_gen_root}/removed_stale_autogen_files.allowed_output_dirs"
write_file(_allowed_output_dirs_file, dawn_allowed_gen_output_dirs)
_stale_dirs_file = "${dawn_gen_root}/removed_stale_autogen_files.stale_dirs"
write_file(_stale_dirs_file, _stale_dirs)
_stamp_file = "${dawn_gen_root}/removed_stale_autogen_files.stamp"
# An action that removes autogenerated files that aren't in allowed directories
# see dawn_generator.gni for more details.
action("remove_stale_autogen_files") {
script = "remove_files.py"
args = [
"--root-dir",
rebase_path(dawn_gen_root, root_build_dir),
"--allowed-output-dirs-file",
rebase_path(_allowed_output_dirs_file, root_build_dir),
"--stale-dirs-file",
rebase_path(_stale_dirs_file, root_build_dir),
"--stamp",
rebase_path(_stamp_file, root_build_dir),
]
# Have the "list of file" inputs as a dependency so that the action reruns
# as soon as they change.
inputs = [
_allowed_output_dirs_file,
_stale_dirs_file,
]
# Output a stamp file so we don't re-run this action on every build.
outputs = [ _stamp_file ]
}