MCPcopy Create free account
hub / github.com/nodejs/node / RemovePossiblyStaleRuntimeDepsFiles

Method RemovePossiblyStaleRuntimeDepsFiles

deps/v8/tools/mb/mb.py:800–827  ·  view source on GitHub ↗
(self, vals, targets, isolate_map,
                                          build_dir)

Source from the content-addressed store, hash-verified

798 return ret
799
800 def RemovePossiblyStaleRuntimeDepsFiles(self, vals, targets, isolate_map,
801 build_dir):
802 # TODO(crbug.com/41441724): Because `gn gen --runtime-deps-list-file`
803 # puts the runtime_deps file in different locations based on the actual
804 # type of a target, we may end up with multiple possible runtime_deps
805 # files in a given build directory, where some of the entries might be
806 # stale (since we might be reusing an existing build directory).
807 #
808 # We need to be able to get the right one reliably; you might think
809 # we can just pick the newest file, but because GN won't update timestamps
810 # if the contents of the files change, an older runtime_deps
811 # file might actually be the one we should use over a newer one (see
812 # crbug.com/932387 for a more complete explanation and example).
813 #
814 # In order to avoid this, we need to delete any possible runtime_deps
815 # files *prior* to running GN. As long as the files aren't actually
816 # needed during the build, this hopefully will not cause unnecessary
817 # build work, and so it should be safe.
818 #
819 # Ultimately, we should just make sure we get the runtime_deps files
820 # in predictable locations so we don't have this issue at all, and
821 # that's what crbug.com/932700 is for.
822 possible_rpaths = self.PossibleRuntimeDepsPaths(vals, targets, isolate_map)
823 for rpaths in possible_rpaths.values():
824 for rpath in rpaths:
825 path = self.ToAbsPath(build_dir, rpath)
826 if self.Exists(path):
827 self.RemoveFile(path)
828
829 def PossibleRuntimeDepsPaths(self, vals, ninja_targets, isolate_map):
830 """Returns a map of targets to possible .runtime_deps paths.

Callers 1

RunGNGenMethod · 0.95

Calls 5

ToAbsPathMethod · 0.95
ExistsMethod · 0.95
RemoveFileMethod · 0.95
valuesMethod · 0.45

Tested by

no test coverage detected