29b942c3f0
Fixes https://github.com/dart-lang/sdk/issues/61684 This caching is based largely on the `--depfile` feature offered by `dart compile`, which is based on a Ninja depfile concept (https://ninja-build.org/manual.html#_depfile), which spits out a file (`depfile.txt` here) which lists all of the input files which were required to build an AOT snapshot. The process is essentially: 1. If an AOT snapshot is found, maybe use it as a cached snapshot! a. If the `pubspec.yaml` modification timestamp is newer, re-compile! b. If the `.dart_tool/package_config.json` modification timestamp is newer, re-compile! c. If the `bin/plugin.dart` modification timestamp is newer, re-compile! d. If the `bin/depfile.txt` file is missing or malformed, re-compile! e. If any files mentioned in `bin/depfile.txt` have a newer modification timestamp, or don't exist, or are an otherwise bad path, re-compile! f. Otherwise, save a dozen seconds and use the cached snapshot. Change-Id: Icc747198f8af76d256ac915685473d6f529a3cef Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/464602 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Samuel Rawlins <srawlins@google.com>