• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2019 The Dawn Authors
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15import("../scripts/dawn_overrides_with_defaults.gni")
16import("dawn_generator.gni")
17
18# The list of directories in which to check for stale autogenerated files.
19# It should include the list of all directories in which we ever generated
20# files but we can't just put dawn_gen_root because there are more than
21# autogenerated sources there.
22_stale_dirs = [
23  "dawn",
24  "dawn_native",
25  "dawn_wire",
26  "mock",
27  "src",
28]
29
30_allowed_output_dirs_file =
31    "${dawn_gen_root}/removed_stale_autogen_files.allowed_output_dirs"
32write_file(_allowed_output_dirs_file, dawn_allowed_gen_output_dirs)
33
34_stale_dirs_file = "${dawn_gen_root}/removed_stale_autogen_files.stale_dirs"
35write_file(_stale_dirs_file, _stale_dirs)
36
37_stamp_file = "${dawn_gen_root}/removed_stale_autogen_files.stamp"
38
39# An action that removes autogenerated files that aren't in allowed directories
40# see dawn_generator.gni for more details.
41action("remove_stale_autogen_files") {
42  script = "remove_files.py"
43  args = [
44    "--root-dir",
45    rebase_path(dawn_gen_root, root_build_dir),
46    "--allowed-output-dirs-file",
47    rebase_path(_allowed_output_dirs_file, root_build_dir),
48    "--stale-dirs-file",
49    rebase_path(_stale_dirs_file, root_build_dir),
50    "--stamp",
51    rebase_path(_stamp_file, root_build_dir),
52  ]
53
54  # Have the "list of file" inputs as a dependency so that the action reruns
55  # as soon as they change.
56  inputs = [
57    _allowed_output_dirs_file,
58    _stale_dirs_file,
59  ]
60
61  # Output a stamp file so we don't re-run this action on every build.
62  outputs = [ _stamp_file ]
63}
64