Christopher Fujino 3246808cd2
[flutter_tools] cache flutter sdk version to disk (#124558)
Fixes https://github.com/flutter/flutter/issues/112833

Most of the actual changes here are in [packages/flutter_tools/lib/src/version.dart](https://github.com/flutter/flutter/pull/124558/files#diff-092e00109d9e1589fbc7c6de750e29a6ae512b2dd44e85d60028953561201605), while the rest is largely just addressing changes to the constructor of `FlutterVersion` which now has different dependencies.

This change makes `FlutterVersion` an interface with two concrete implementations:

1. `_FlutterVersionGit` which is mostly the previous implementation, and
2. `_FlutterVersionFromFile` which will read a new `.version.json` file from the root of the repo

The [`FlutterVersion` constructor](https://github.com/flutter/flutter/pull/124558/files#diff-092e00109d9e1589fbc7c6de750e29a6ae512b2dd44e85d60028953561201605R70) is now a factory that first checks if `.version.json` exists, and if so returns an instance of `_FlutterVersionFromGit` else it returns the fallback `_FlutterVersionGit` which will end up writing `.version.json` so that we don't need to re-calculate the version on the next invocation.

`.version.json` will be deleted in the bash/batch entrypoints any time we need to rebuild he tool (this will usually be because the user did `flutter upgrade` or `flutter channel`, or manually changed the commit with git).
2023-06-15 00:20:30 +00:00
..

Flutter SDK dependency versions

The files in this directory specifies pinned versions of various dependencies of the flutter SDK.

The bin/internal/engine.version file controls which version of the Flutter engine to use. The file contains the commit hash of a commit in the https://github.com/flutter/engine repository. That hash must have successfully been compiled on https://build.chromium.org/p/client.flutter/ and had its artifacts (the binaries that run on Android and iOS, the compiler, etc) successfully uploaded to Google Cloud Storage.

The /bin/internal/engine.merge_method file controls how we merge a pull request created by the engine auto-roller. If it's squash, there's only one commit for a pull request no matter how many engine commits there are inside that pull request. If it's rebase, the number of commits in the framework is equal to the number of engine commits in the pull request. The latter method makes it easier to detect regressions but costs more test resources.

The bin/internal/flutter_packages.version file specifies the version of the flutter/packages repository to be used for testing. The flutter/packages repository isn't an upstream dependency of flutter/flutter; it is only used as part of the test suite for verification, and the pinned version here makes sure that tests are deterministic at each flutter/flutter commit.