Corentin Wallez a9a84dfe1e BUILD.gn: Delete stale generated files in Dawn's gen dir.
This normalizes even more the directory structure of generated files in
Dawn and removes stale autogenerated files that could be included
wrongly using a GN action.

See comment on top of dawn_generator.gni in this commit for more
context.

BUG=dawn:22

Change-Id: I8ec038f949c048431b2b643af4462f98c4ae610b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11361
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-09-19 23:30:42 +00:00

60 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]
}