From a2711ed15a46576c4e79dbadc329862705643b7a Mon Sep 17 00:00:00 2001 From: Eric Seidel Date: Fri, 22 Sep 2023 14:49:15 -0700 Subject: [PATCH] chore: Move cutler to build_engine repo (#1314) Moved to build_engine in shorebirdtech/build_engine#27. --- .github/workflows/main.yaml | 6 +- README.md | 1 - packages/cutler/.gitignore | 5 - packages/cutler/FORKING_FLUTTER.md | 203 ---- packages/cutler/README.md | 70 -- packages/cutler/analysis_options.yaml | 1 - packages/cutler/bin/cutler.dart | 12 - packages/cutler/lib/checkout.dart | 271 ----- packages/cutler/lib/commands/base.dart | 45 - packages/cutler/lib/commands/commands.dart | 3 - .../cutler/lib/commands/rebase_command.dart | 201 ---- .../cutler/lib/commands/validate_command.dart | 151 --- .../cutler/lib/commands/versions_command.dart | 74 -- packages/cutler/lib/config.dart | 68 -- packages/cutler/lib/cutler.dart | 96 -- packages/cutler/lib/logger.dart | 8 - packages/cutler/lib/model.dart | 204 ---- packages/cutler/lib/versions.dart | 99 -- packages/cutler/pubspec.lock | 420 -------- packages/cutler/pubspec.yaml | 24 - packages/cutler/test/checkout_test.dart | 105 -- packages/cutler/test/config_test.dart | 30 - packages/cutler/test/fixtures/DEPS | 965 ------------------ packages/cutler/test/model_test.dart | 121 --- packages/cutler/test/versions_test.dart | 24 - 25 files changed, 1 insertion(+), 3206 deletions(-) delete mode 100644 packages/cutler/.gitignore delete mode 100644 packages/cutler/FORKING_FLUTTER.md delete mode 100644 packages/cutler/README.md delete mode 100644 packages/cutler/analysis_options.yaml delete mode 100644 packages/cutler/bin/cutler.dart delete mode 100644 packages/cutler/lib/checkout.dart delete mode 100644 packages/cutler/lib/commands/base.dart delete mode 100644 packages/cutler/lib/commands/commands.dart delete mode 100644 packages/cutler/lib/commands/rebase_command.dart delete mode 100644 packages/cutler/lib/commands/validate_command.dart delete mode 100644 packages/cutler/lib/commands/versions_command.dart delete mode 100644 packages/cutler/lib/config.dart delete mode 100644 packages/cutler/lib/cutler.dart delete mode 100644 packages/cutler/lib/logger.dart delete mode 100644 packages/cutler/lib/model.dart delete mode 100644 packages/cutler/lib/versions.dart delete mode 100644 packages/cutler/pubspec.lock delete mode 100644 packages/cutler/pubspec.yaml delete mode 100644 packages/cutler/test/checkout_test.dart delete mode 100644 packages/cutler/test/config_test.dart delete mode 100644 packages/cutler/test/fixtures/DEPS delete mode 100644 packages/cutler/test/model_test.dart delete mode 100644 packages/cutler/test/versions_test.dart diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 98596136..83609a2f 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -38,10 +38,6 @@ jobs: - ./.github/workflows/main.yaml - ./.github/actions/dart_package/action.yaml - packages/artifact_proxy/** - cutler: - - ./.github/workflows/main.yaml - - ./.github/actions/dart_package/action.yaml - - packages/cutler/** discord_gcp_alerts: - ./.github/workflows/main.yaml - ./.github/actions/dart_package/action.yaml @@ -115,7 +111,7 @@ jobs: with: codecov_token: ${{ secrets.CODECOV_TOKEN }} working_directory: packages/${{ matrix.package }} - min_coverage: ${{ matrix.package == 'cutler' && '10' || '100' }} + min_coverage: 100 build_redis: needs: changes diff --git a/README.md b/README.md index ff04857b..7e8be8cd 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,6 @@ This repository is a monorepo containing the following packages: | [shorebird_cli](packages/shorebird_cli/README.md) | Command-line which allows developers to interact with various Shorebird services | | [shorebird_code_push_client](packages/shorebird_code_push_client/README.md) | Dart library which allows Dart applications to interact with the ShoreBird CodePush API | | [shorebird_code_push_protocol](packages/shorebird_code_push_protocol/README.md) | Dart library which contains common interfaces used by Shorebird CodePush | -| [cutler](packages/cutler/README.md) | A tool for managing Flutter forks | | [discord_gcp_alerts](packages/discord_gcp_alerts/README.md) | Dart server which forwards GCP alerts to Discord | | [jwt](packages/jwt/README.md) | Dart library for verifying Json Web Tokens | | [redis_client](packages/redis_client/README.md) | Dart library for interacting with Redis | diff --git a/packages/cutler/.gitignore b/packages/cutler/.gitignore deleted file mode 100644 index 9ddb333f..00000000 --- a/packages/cutler/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -# https://dart.dev/guides/libraries/private-files -# Created by `dart pub` -.dart_tool/ -build/ -coverage/ \ No newline at end of file diff --git a/packages/cutler/FORKING_FLUTTER.md b/packages/cutler/FORKING_FLUTTER.md deleted file mode 100644 index 1fed6e24..00000000 --- a/packages/cutler/FORKING_FLUTTER.md +++ /dev/null @@ -1,203 +0,0 @@ -`cutler` intends to replaces some of this, but not all of it. -Keeping these docs until `cutler` is fully functional. - -`dart run cutler versions` is able to print out all of the hashes in the forked -repos for a given Shorebird hash (including any Shorebird channel or release -tag). - -Example: -``` - % dart run cutler versions -Building package executable... -Built cutler:cutler. -Using /Users/eseidel/Documents/GitHub as checkouts root. -✓ Checkouts updated! (15.9s) -Shorebird @ origin/stable - flutter 012153de178d4a51cd6f9adc792ad63ae3cfb1b3 (8 ahead) - engine 5a1c263ce5313c8f5e93a11dd2a3af0e19d90262 (54 ahead) - dart 37f38201922b071c5494e35fe09b56336f03a4f6 (13 ahead) - buildroot 320eae0a60e36365e90b4380f5eb0b3fd4392f67 (1 ahead) - -Upstream - flutter 2524052335ec76bb03e04ede244b071f1b86d190 (3.13.3) - engine b8d35810e91ab8fc39ba5e7a41bff6f697e8e3a8 (3.13.3) - dart efd81da467c5cfeaa39652bd865ce91830a66ab7 (3.1.1) - buildroot 6e71c38443c0bf9d8954c87bf69bb4e019f44f94 -``` - -## Repository structure - -We maintain forks of: -* flutter/flutter -* flutter/engine -* flutter/buildroot -* dart-lang/sdk - -We keep our forked changes on the `shorebird/dev` branch of each repo which we -rebase periodically on top of the latest stable from the upstream repos. - -When Flutter makes a release, we rebase our `shorebird/dev` branches onto -the branch points for Flutter's release branches. We then create our own -release branches for the Shorebird release (e.g. flutter_release/3.7.10). - -The only reason we need to create branches is to keep our forked commits alive. -You don't directly check out these branches (unless you plan to make a hotfix) -but instead Shorebird will pull them using its `flutter.version` file, etc. - -We keep channel branches (e.g. `stable`) in the `shorebird` repo but -do not do so in the other repos. - -The forked repos have branches corresponding to a Flutter release but do not -keep branches corresponding to Shorebird or Flutter channels. - -For example, when updating to the Flutter 3.7.10 release, we created the -following branches: -* flutter/flutter: `flutter_release/3.7.10` -* flutter/engine: `flutter_release/3.7.10` -* flutter/buildroot: `flutter_release/3.7.10` -* dart-lang/sdk: `flutter_release/3.7.10` -* shorebird: no branch or tag, just a commit to the `main` branch which - will eventually get pushed to the `stable` branch for Shorebird. - -It's rare that we will ever need to add commits to one of these branches, -since changes to our fork are rare. We currently do not try to back-port -any Shorebird changes to older Flutter revisions, rather we just update -to the latest Flutter release and include our new fixes there. -https://github.com/shorebirdtech/shorebird/issues/1100 - -## Keeping our fork up to date - -You need checkouts of all the various repos in the same directory. - -Currently the tool assumes you're using our internal repository `_shorebird` -to check out `shorebird`. Example: -``` -cd $HOME/Documents/GitHub -git clone https://github.com/shorebirdtech/_shorebird -``` - -To check out the engine, you should follow: -https://github.com/shorebirdtech/updater/blob/main/BUILDING_ENGINE.md -which will result in an `engine` directory in the same directory as `_shorebird`. - -Run `cutler` to get the git commands you need. - -`cutler` has a set of fallback paths it will search to find your checkouts root -if you checked out `_shorebird` into the same directory as `engine`, it should -find it. - - -The steps to update our repos: - -1. Rebase buildroot on top of the new buildroot hash, e.g. -``` -git rebase --onto f24f62fa5381c0e415b6ca2000600fc0600c11c8 8747bce41d0dc6d9dc45c4d1b46d2100bb9ee688 7383548fa2306b5d53979ac5e9d176b35258811b -``` -2. Save the commit id from that rebase -- you'll need it to edit the DEPS file in -the engine repo. In this example it was "d6c410f19de5947de40ce110c1e768c887870072". - -3. Rebase the engine on top of the new engine hash, e.g. -``` -git rebase --onto 3.10.0-1.5.pre 3.7.12 c415419390e4751ddfa3110e0808e7abb3d45a18 -``` -If there are conflicts, you'll need to resolve them. If the conflict -is in the DEPS file, you can take it as an opportunity to insert the new -buildroot hash. - -4. Save the commit id from that rebase -- you'll need it to edit the engine.version -file in the flutter repo. In this example it was "94bc1218b84cc0199068f8788cda96e3128784a0". - -5. Rebase the flutter repo on top of the new flutter hash, e.g. -``` -git rebase --onto 3.10.0-1.5.pre 3.7.12 83305b5088e6fe327fb3334a73ff190828d85713 -``` -This might have conflicts, if so you'll need to resolve them. If the conflict -is in the DEPS file, you can take it as an opportunity to insert the new -engine hash. - -6. Save the commit id from that rebase -- you'll need it to edit the flutter.version -file in the shorebird repo. In this example it was "f498c3913890e7a022596029c7f07f467b0889da". - -7. Update the flutter.version file in the shorebird repo to the new flutter -hash, e.g. -``` -echo 'f498c3913890e7a022596029c7f07f467b0889da' > bin/internal/flutter.version -commit -a -m "Update flutter version to 3.10.0-1.5.pre" -``` - -8. Now that we've prepared these versions it should be possible to build the - engine and test our work! - `gclient sync` is only needed if buildroot (`src`) changed. -``` -cd $HOME/Documents/GitHub -cd engine -gclient sync -cd .. -./build_engine/build_engine/build.sh $HOME/Documents/GitHub/engine -``` -build.sh currently requires an absolute path to the engine directory or it fails -with a cryptic error message crashing in `cargo ndk build`. - -Building will take up to 45 mins on a M2 machine (it builds the engine 3 times) -if it's a clean build. - -We don't currently have any integration tests, but we can test manually with an -app: -``` -shorebird run --local-engine-src-path=$HOME/Documents/GitHub/engine/src --local-engine android_release_arm64 -``` - -If things look good now we need to tag and push our changes to the git repos -we touched earlier. - -9. Tag the buildroot repo with the new buildroot hash, e.g. -``` -cd $HOME/Documents/GitHub/engine/src -git tag -a -m "shorebird-3.10.0-1.5.pre" shorebird-3.10.0-1.5.pre d6c410f19de5947de40ce110c1e768c887870072 -git push origin shorebird-3.10.0-1.5.pre -``` - -10. Tag the engine repo with the new engine hash, e.g. -``` -cd $HOME/Documents/GitHub/engine/src/flutter -git tag -a -m "shorebird-3.10.0-1.5.pre" shorebird-3.10.0-1.5.pre 94bc1218b84cc0199068f8788cda96e3128784a0 -git push origin shorebird-3.10.0-1.5.pre -``` - -11. Tag the flutter repo with the new flutter hash, e.g. -``` -cd $HOME/Documents/GitHub/flutter -git tag -a -m "shorebird-3.10.0-1.5.pre" shorebird-3.10.0-1.5.pre f498c3913890e7a022596029c7f07f467b0889da -git push origin shorebird-3.10.0-1.5.pre -``` - -12. Sync our tags with the upstream (https://github.com/flutter/flutter): -``` -git fetch --tags upstream -git push --tags -``` - -13. If there were changes to the `patch` binary in the `updater` library we -will need to trigger github actions before we can publish the new version of -the shorebird engine. - -14. Before we can publish the new version of Shorebird, we need to build the -engine for all the platforms we support. We do that by running the -`build_and_upload.sh` script in the build_engine repo. - -``` -./build_engine/build_engine/build_and_upload.sh ./engine 978a56f2d97f9ce24a2b6bc22c9bbceaaba0343c -``` - -That script should be run in the cloud, but right now I've not figured that out -yet, so we run it locally on an arm64 Mac. - -15. Once we've built all artifacts the final step is to push the new version -of shorebird to the appropriate branch. e.g. -(untested) -``` -cd $HOME/Documents/GitHub/_shorebird/shorebird -git tag -a -m "shorebird-3.10.0-1.5.pre" shorebird-3.10.0-1.5.pre $VERSION -git push origin shorebird-3.10.0-1.5.pre -git push origin/beta shorebird-3.10.0-1.5.pre -``` diff --git a/packages/cutler/README.md b/packages/cutler/README.md deleted file mode 100644 index 4516bd86..00000000 --- a/packages/cutler/README.md +++ /dev/null @@ -1,70 +0,0 @@ -# Cutler - -A tool for keeping our fork of Flutter up-to-date with the primary Flutter. - -> "Someone who makes or sells cutlery is a cutler." - Wikipedia -> -> "Forks are considered cutlery, right?" - Me - -Cutler has two subcommands: -* `rebase` for updating our fork of Flutter -* `print-versions` for printing out the versions of a given Shorebird hash - -## Prerequisites - -A directory containing git checkouts of: -- `shorebird` (this repo) -- [Our fork of `flutter`](https://github.com/shorebirdtech/flutter) - - NOTE: you will need to add the primary Flutter repo as an upstream: - `git remote add upstream https://github.com/flutter/flutter` - -## Usage - -Typical usage, where `root` is the directory containing the git checkouts: - -```bash -dart run cutler rebase --root=$HOME/Documents/GitHub --dry-run -``` - -> **📝 NOTE:** -> If you're running `cutler` repeatedly, you might also use `--no-update` after -> the first run to avoid waiting to try and update git repos. - -You can also see what the current stable changes would look like applied to -another Flutter channel with `--flutter-channel`, e.g.: -``` -dart run cutler rebase --root=$HOME/Documents/GitHub --dry-run --flutter-channel=beta -``` - -`--dry-run` will show you the changes it plans to make. Actually making the -changes might work, but hasn't been tested yet. - -Example invocation, exploring porting a 3.7.12 based fork onto 3.10 (beta): -``` -% dart run cutler rebase --root=$HOME/Documents/GitHub --dry-run --no-update --flutter-channel=beta -Building package executable... -Built cutler:cutler. -Shorebird stable: - flutter 83305b5088e6fe327fb3334a73ff190828d85713 - engine c415419390e4751ddfa3110e0808e7abb3d45a18 - buildroot 7383548fa2306b5d53979ac5e9d176b35258811b -Forkpoints: - flutter 4d9e56e694b656610ab87fcf2efbcd226e0ed8cf (3.7.12) - engine 1a65d409c7a1438a34d21b60bf30a6fd5db59314 (3.7.12) - buildroot 8747bce41d0dc6d9dc45c4d1b46d2100bb9ee688 -Upstream beta: - flutter b1c77b7ed32346fe829c0ca97bd85d19290d54ae (3.10.0-1.5.pre) - engine 50e509c2bd0d7788feb675e38321cc5711c8d2d6 (3.10.0-1.5.pre) - buildroot f24f62fa5381c0e415b6ca2000600fc0600c11c8 -Rebasing buildroot... -git rebase --onto f24f62fa5381c0e415b6ca2000600fc0600c11c8 8747bce41d0dc6d9dc45c4d1b46d2100bb9ee688 7383548fa2306b5d53979ac5e9d176b35258811b -Rebasing engine... -git rebase --onto 3.10.0-1.5.pre 3.7.12 c415419390e4751ddfa3110e0808e7abb3d45a18 -Rebasing flutter... -git rebase --onto 3.10.0-1.5.pre 3.7.12 83305b5088e6fe327fb3334a73ff190828d85713 -Updating engine DEPS... -Would have changed DEPS lines: -( 'src': 'https://github.com/shorebirdtech/buildroot.git' + '@' + 'new-buildroot-hash',) -Updating shorebird flutter version... - Change flutter.version: new-flutter-hash from 83305b5088e6fe327fb3334a73ff190828d85713 -``` diff --git a/packages/cutler/analysis_options.yaml b/packages/cutler/analysis_options.yaml deleted file mode 100644 index f8c1a7f5..00000000 --- a/packages/cutler/analysis_options.yaml +++ /dev/null @@ -1 +0,0 @@ -include: package:very_good_analysis/analysis_options.5.1.0.yaml \ No newline at end of file diff --git a/packages/cutler/bin/cutler.dart b/packages/cutler/bin/cutler.dart deleted file mode 100644 index f3d6afe4..00000000 --- a/packages/cutler/bin/cutler.dart +++ /dev/null @@ -1,12 +0,0 @@ -import 'package:cutler/cutler.dart'; -import 'package:cutler/logger.dart'; -import 'package:scoped/scoped.dart'; - -void main(List args) { - runScoped( - () => Cutler().run(args), - values: { - loggerRef, - }, - ); -} diff --git a/packages/cutler/lib/checkout.dart b/packages/cutler/lib/checkout.dart deleted file mode 100644 index cf8373e9..00000000 --- a/packages/cutler/lib/checkout.dart +++ /dev/null @@ -1,271 +0,0 @@ -import 'dart:io'; - -import 'package:cutler/logger.dart'; -import 'package:cutler/model.dart'; -import 'package:path/path.dart' as p; - -/// This file provides the git extensions to our model objects for Cutler. -/// That lets the models be pure data objects, and keeps the command-running -/// code separate. Unsure if this is a good design or not. - -/// Runs a command and returns the result. -ProcessResult runCommandInner( - String executable, - List arguments, { - String? workingDirectory, -}) { - if (workingDirectory != null && !Directory(workingDirectory).existsSync()) { - throw Exception('Directory $workingDirectory does not exist.'); - } - - final workingDirectoryString = workingDirectory == null || - p.equals(workingDirectory, Directory.current.path) - ? '' - : ' (in $workingDirectory)'; - logger.detail("$executable ${arguments.join(' ')}$workingDirectoryString"); - - return Process.runSync( - executable, - arguments, - workingDirectory: workingDirectory, - ); -} - -/// Runs a command and returns stdout, trimmed. -String runCommand( - String executable, - List arguments, { - String? workingDirectory, -}) { - final result = runCommandInner( - executable, - arguments, - workingDirectory: workingDirectory, - ); - if (result.exitCode != 0) { - throw Exception( - 'Failed to run $executable $arguments: ${result.stdout} ${result.stderr}', - ); - } - return result.stdout.toString().trim(); -} - -/// Represents all the checkouts cutler knows about. -class Checkouts { - /// Constructs a new [Checkouts] object with a given [root] directory. - Checkouts(this.root) { - for (final repo in Repo.values) { - _checkouts[repo] = Checkout(repo, root); - } - } - - /// The root directory for all checkouts. - final String root; - - /// The checkouts. - final _checkouts = {}; - - /// Returns an iterable of all checkouts. - Iterable get values => _checkouts.values; - - /// Returns a [Checkout] for a given [repo]. - Checkout operator [](Repo repo) => _checkouts[repo]!; - - /// Returns a [Checkout] for Flutter. - Checkout get flutter => _checkouts[Repo.flutter]!; - - /// Returns a [Checkout] for Engine. - Checkout get engine => _checkouts[Repo.engine]!; - - /// Returns a [Checkout] for Dart. - Checkout get dart => _checkouts[Repo.dart]!; - - /// Returns a [Checkout] for Buildroot. - Checkout get buildroot => _checkouts[Repo.buildroot]!; - - /// Returns a [Checkout] for Shorebird. - Checkout get shorebird => _checkouts[Repo.shorebird]!; -} - -/// Extension methods for [Repo] to do actual `git` actions. -class Checkout { - /// Constructs a new [Checkout] for a given [repo]. - Checkout(this.repo, String checkoutsRoot) : _checkoutsRoot = checkoutsRoot; - - /// The repo this checkout is for. - final Repo repo; - - /// The root directory for all checkouts. - final String _checkoutsRoot; - - /// The name of this repo. - String get name => repo.name; - - /// Updates this repo. - void fetchAll() { - runCommand( - 'git', - ['fetch', '--all', '--tags'], - workingDirectory: workingDirectory, - ); - } - - /// Returns a [Version] for the given [commitish]. - Version versionFrom(String commitish, {bool lookupTags = true}) { - final hash = runCommand( - 'git', - ['rev-parse', commitish], - workingDirectory: workingDirectory, - ); - return Version( - hash: hash, - repo: repo, - aliases: lookupTags ? getTagsFor(hash) : [], - ); - } - - /// Returns a [Version] for the given [branch] in the given [remote]. - Version remoteBranch({required String branch, required String remote}) { - final output = runCommand( - 'git', - ['ls-remote', '--refs', remote, branch], - workingDirectory: workingDirectory, - ); - final hash = output.split('\t').first; - final name = output.split('\t').last; - return Version( - hash: hash, - repo: repo, - aliases: [name], - ); - } - - /// Returns a [Version] for the given [tag] in the given [remote]. - Version remoteTag({ - required String remote, - required String tag, - }) { - final tags = remoteTags(remote: remote, pattern: tag); - if (tags.isEmpty) { - throw Exception('No tags found for $tag in $remote'); - } - if (tags.length > 1) { - throw Exception('Multiple tags found for $tag in $remote'); - } - return tags.first; - } - - /// Returns a list of Versions for the given [pattern] in the given [remote]. - Iterable remoteTags({ - required String remote, - String? pattern, - }) { - final args = ['ls-remote', '--tags', remote]; - if (pattern != null) { - args.add(pattern); - } - final output = runCommand('git', args, workingDirectory: workingDirectory); - // split lines - final lines = output.split('\n'); - return lines.map((line) { - final hash = line.split('\t').first; - final name = line.split('\t').last; - return Version( - hash: hash, - repo: repo, - aliases: [name], - ); - }); - } - - /// Returns true if [ancestor] is an ancestor of [descendant] in this repo. - bool isAncestor({required String ancestor, required String descendant}) { - final result = runCommandInner( - 'git', - ['merge-base', '--is-ancestor', ancestor, descendant], - workingDirectory: workingDirectory, - ); - return result.exitCode == 0; - } - - /// Returns a count of commits between two commits in this repo. - int countCommits({required String from, required String to}) { - final output = runCommand( - 'git', - ['rev-list', '--count', '$from..$to'], - workingDirectory: workingDirectory, - ); - return int.parse(output); - } - - /// Returns the working directory for this repo. - String get workingDirectory => '$_checkoutsRoot/${repo.path}'; - - /// Returns the latest commit for a given [branch] in this repo. - String getLatestCommit(String branch) { - return runCommand( - 'git', - ['log', '-1', '--pretty=%H', branch], - workingDirectory: workingDirectory, - ); - } - - /// Returns the tags for a given [commit] in this repo. - List getTagsFor(String commit) { - final output = runCommand( - 'git', - ['tag', '--points-at', commit], - workingDirectory: workingDirectory, - ); - if (output.isEmpty) { - return []; - } - return output.split('\n'); - } - - /// Returns the fork point as a [Version] for this repo given a [forkBranch]. - Version getForkPoint(String forkBranch) { - final describeString = runCommand( - 'git', - ['describe', '--tags', forkBranch], - workingDirectory: workingDirectory, - ); - final tag = describeString.split('-').first; - return versionFrom(tag); - } - - /// Returns the contents of a file at a given [path] in this repo at a given - /// [commit]. - String contentsAtPath(String commit, String path) { - return runCommand( - 'git', - ['show', '$commit:$path'], - workingDirectory: workingDirectory, - ); - } - - /// Writes [contents] to a file at a given [path] in this repo. - void writeFile(String path, String contents) { - File(p.join(workingDirectory, path)).writeAsStringSync(contents); - } - - /// Commits to this repo with a given [message]. - void commit(String message) { - runCommand( - 'git', - ['commit', '-a', '-m', message], - workingDirectory: workingDirectory, - ); - } - - /// Returns a [Version] object representing the current HEAD of this repo. - Version localHead() { - return versionFrom( - runCommand( - 'git', - ['rev-parse', 'HEAD'], - workingDirectory: workingDirectory, - ), - ); - } -} diff --git a/packages/cutler/lib/commands/base.dart b/packages/cutler/lib/commands/base.dart deleted file mode 100644 index c89b6c6d..00000000 --- a/packages/cutler/lib/commands/base.dart +++ /dev/null @@ -1,45 +0,0 @@ -import 'package:args/command_runner.dart'; -import 'package:cutler/checkout.dart'; -import 'package:cutler/config.dart'; -import 'package:cutler/cutler.dart'; -import 'package:cutler/logger.dart'; - -/// Base class for Cutler subcommands. -abstract class CutlerCommand extends Command { - /// Constructs a new [CutlerCommand]. - CutlerCommand(); - - /// The global config, set during argument parsing. - Config get config => (runner! as Cutler).config; - - /// The checkout objects - late final Checkouts checkouts; - - /// The Flutter checkout. - Checkout get flutter => checkouts.flutter; - - /// The Engine checkout. - Checkout get engine => checkouts.engine; - - /// The Shorebird checkout. - Checkout get shorebird => checkouts.shorebird; - - /// The Buildroot checkout. - Checkout get buildroot => checkouts.buildroot; - - /// The Dart checkout. - Checkout get dart => checkouts.dart; - - /// Update the repos if needed. - void updateReposIfNeeded(Config config) { - if (!config.doUpdate) { - return; - } - final progress = logger.progress('Updating checkouts...'); - for (final checkout in checkouts.values) { - progress.update('Updating ${checkout.name}'); - checkout.fetchAll(); - } - progress.complete('Checkouts updated!'); - } -} diff --git a/packages/cutler/lib/commands/commands.dart b/packages/cutler/lib/commands/commands.dart deleted file mode 100644 index f4019579..00000000 --- a/packages/cutler/lib/commands/commands.dart +++ /dev/null @@ -1,3 +0,0 @@ -export 'rebase_command.dart'; -export 'validate_command.dart'; -export 'versions_command.dart'; diff --git a/packages/cutler/lib/commands/rebase_command.dart b/packages/cutler/lib/commands/rebase_command.dart deleted file mode 100644 index 9e36e932..00000000 --- a/packages/cutler/lib/commands/rebase_command.dart +++ /dev/null @@ -1,201 +0,0 @@ -import 'package:cutler/checkout.dart'; -import 'package:cutler/commands/base.dart'; -import 'package:cutler/logger.dart'; -import 'package:cutler/model.dart'; -import 'package:cutler/versions.dart'; -import 'package:io/io.dart'; -import 'package:path/path.dart' as p; - -/// This isn't truly a VersionSet since it may not be a consistent -/// set of versions built into a Flutter release, rather it's just whatever -/// our current HEAD is across our fork repos. -VersionSet getHeadVersions(Checkouts checkouts, String forkBranch) { - return VersionSet( - engine: checkouts.engine.versionFrom(forkBranch), - flutter: checkouts.flutter.versionFrom(forkBranch), - buildroot: checkouts.buildroot.versionFrom(forkBranch), - dart: checkouts.dart.versionFrom(forkBranch), - ); -} - -/// Holds the state about a rebase operation. -class RebaseContext { - /// Constructs a new [RebaseContext]. - RebaseContext(this.upstream, this.forkpoint, this.dev, this.devBranch); - - /// The VersionSet of the upstream Flutter we're rebasing to. - final VersionSet upstream; - - /// The VersionSet of the Flutter forkpoint we're rebasing from. - final VersionSet forkpoint; - - /// The VersionSet of the current HEAD of our fork. - final VersionSet dev; - - /// The name of the branches we're rebasing. - // FIXME(eseidel): This should move onto Repo. - final String devBranch; - - /// Returns the fully qualified branch name for `shorebird/dev`. - String get fullyQualifiedBranch => 'origin/$devBranch'; - - /// Print the commands needed to rebase `shorebird/dev` to a new revision. - void printRebase(Repo repo) { - final path = repo.path; - final upstreamRef = upstream[repo].ref; - final forkpointRef = forkpoint[repo].ref; - if (upstreamRef == forkpointRef) { - logger - ..info('# ${repo.name} is already at $upstreamRef') - ..info(''); - return; - } - logger - ..info('# ${repo.name}') - ..info('git -C $path fetch --all --tags') - ..info('git -C $path rebase --onto $upstreamRef ' - '$forkpointRef $fullyQualifiedBranch') - ..info('# Handle conflicts'); - } - - /// Returns true if we need to push `shorebird/dev` to a new revision. - bool needsPush(Repo repo) { - // Only need to push if we did a rebase (or we changed a dependency). - if (upstream[repo].ref != forkpoint[repo].ref) { - return true; - } - return repo.dependencies.any(needsPush); - } - - /// Execute the rebase operation. - void printCommands() { - // Print the commands needed to rebase - printRebase(Repo.buildroot); - printRebase(Repo.dart); - printRebase(Repo.engine); - printRebase(Repo.flutter); - - final flutterVersionName = upstream.flutter.aliases.first; - - if (needsPush(Repo.buildroot)) { - // If this changes it will inevitably have conflicts to resolve anyway. - logger.warn('Need to update buildroot version.'); - } - if (needsPush(Repo.dart)) { - // If this changes it will inevitably have conflicts to resolve anyway. - logger.warn('Need to update dart version.'); - } - if (needsPush(Repo.engine)) { - final versionFilePath = - p.join(Repo.flutter.path, Paths.flutterEngineVersion.path); - logger - ..info('git -C ${Repo.engine.path} rev-parse HEAD > $versionFilePath') - ..info( - 'git -C ${Repo.flutter.path} commit -a ' - '-m "Update engine for $flutterVersionName"', - ) - ..info(''); - } - if (needsPush(Repo.flutter)) { - final versionFilePath = - p.join(Repo.shorebird.path, Paths.shorebirdFlutterVersion.path); - logger - ..info('git -C ${Repo.flutter.path} rev-parse HEAD > $versionFilePath') - ..info( - 'git -C ${Repo.shorebird.path} commit -a ' - '-m "Update flutter for $flutterVersionName"', - ) - ..info(''); - } - - final forks = [ - Repo.buildroot, - Repo.dart, - Repo.engine, - Repo.flutter, - ]; - for (final repo in forks) { - if (needsPush(repo)) { - final path = repo.path; - final releaseBranch = 'flutter_release/$flutterVersionName'; - logger - ..info('git -C $path push origin -f HEAD:$devBranch') - ..info('git -C $path push --tags') - ..info('git -C $path push origin -f $devBranch:$releaseBranch') - ..info(''); - } - } - - logger - ..info('# Trigger build_engine action on GHA before pushing shorebird') - // We just push `main` for Shorebird, since we don't have a `dev` branch. - ..info('git -C ${Repo.shorebird.path} push'); - } -} - -/// Print the versions a given Shorebird or Flutter hash depends on. -class RebaseCommand extends CutlerCommand { - /// Constructs a new [RebaseCommand]. - RebaseCommand(); - @override - final name = 'rebase'; - @override - final description = - 'Print the commands needed to rebase `shorebird/dev` to a new revision.'; - - @override - int run() { - checkouts = Checkouts(config.checkoutsRoot); - updateReposIfNeeded(config); - - // Figure out our current versions, use `shorebird/dev` as our main branch - // This isn't necessarily a self-consistent set of versions. - const devBranch = 'shorebird/dev'; - final dev = getHeadVersions(checkouts, 'origin/$devBranch'); - printVersions(checkouts, dev); - - // Check if the VersionSet described by our Flutter fork actually matches - // what our HEAD is in our `shorebird/dev` branches. This check isn't - // necessary, but seems like a good sanity check to make sure that we're - // not surprised by this script including new commits in its resulting - // VersionSet which were not previously included. - final flutterVersions = getFlutterVersions(checkouts, dev.flutter.hash); - if (flutterVersions != dev) { - logger.warn('shorebirdtech/flutter:HEAD version set does not match ' - 'the latest `$devBranch` version set, this means this script ' - 'will include new commits in its resulting VersionSet which were ' - 'not previously included in the Flutter described by ' - 'shorebirdtech/flutter:HEAD.'); - printVersions(checkouts, flutterVersions); - } - - // Compute the forkpoint of our `shorebird/dev` branches. This is done - // based only on our Flutter fork. Another way to do this might be - // to walk backwards from `shorebird/dev` until we find a commit which - // was not authored by a Shorebird committer. - // We can't just compare - // `shorebird/dev` to `upstream/stable` because `upstream/stable` may - // not be based on the same branch, since `stable` for Flutter is branched - // and updated on the branch, rather than being a tag on main. - final flutterForkpoint = flutter.getForkPoint(dev.flutter.hash); - final flutterHash = flutterForkpoint.hash; - final forkpoint = getFlutterVersions(checkouts, flutterHash); - logger.info('Forkpoint:'); - printVersions(checkouts, forkpoint); - - // Figure out the versions we want to rebase to match upstream. - const upstreamBranch = 'upstream/stable'; - final upstream = getFlutterVersions(checkouts, upstreamBranch); - if (forkpoint == upstream) { - logger.info('forkpoint is current with $upstreamBranch'); - return ExitCode.success.code; - } else { - logger.info('forkpoint is behind $upstreamBranch'); - printVersions(checkouts, upstream); - } - - RebaseContext(upstream, forkpoint, dev, devBranch).printCommands(); - - return ExitCode.success.code; - } -} diff --git a/packages/cutler/lib/commands/validate_command.dart b/packages/cutler/lib/commands/validate_command.dart deleted file mode 100644 index 205efd3e..00000000 --- a/packages/cutler/lib/commands/validate_command.dart +++ /dev/null @@ -1,151 +0,0 @@ -import 'package:cutler/checkout.dart'; -import 'package:cutler/commands/base.dart'; -import 'package:cutler/logger.dart'; -import 'package:cutler/model.dart'; -import 'package:cutler/versions.dart'; -import 'package:io/io.dart'; -import 'package:version/version.dart' as semver; - -/// Check that a tag matches its upstream. -bool ensureTagMatch(Checkout checkout, String tag) { - final origin = checkout.remoteTag(tag: tag, remote: 'origin'); - final upstream = checkout.remoteTag(tag: tag, remote: 'upstream'); - final paddedName = checkout.name.padRight(10); - if (origin != upstream) { - logger.err('❌ $paddedName tag $origin does not match upstream $upstream'); - return false; - } - logger.info('✅ $paddedName ${origin.ref} matches upstream $upstream'); - return true; -} - -/// Check for a flutter_release/$[flutterVersionName] branch in all of our fork -/// repositories and that our Flutter forkpoint is included in the release -/// branch. -bool ensureReleaseBranchesIncludeForkpoint( - Checkouts checkouts, - String flutterVersionName, -) { - final forkpoint = getFlutterVersions(checkouts, flutterVersionName); - final releaseBranch = 'flutter_release/$flutterVersionName'; - final forks = [ - Repo.buildroot, - Repo.dart, - Repo.engine, - Repo.flutter, - ]; - for (final repo in forks) { - final checkout = checkouts[repo]; - final remote = - checkout.remoteBranch(branch: releaseBranch, remote: 'origin'); - final paddedName = checkout.name.padRight(10); - - // Check that the versions at flutter_release/$version include the - // expected flutter forkpoint hash. - final forkpointVersion = forkpoint[repo]; - if (!checkout.isAncestor( - ancestor: forkpointVersion.hash, - descendant: remote.hash, - )) { - logger.err( - '❌ $paddedName $releaseBranch does not include ' - 'forkpoint $forkpointVersion', - ); - return false; - } - logger.info('✅ $paddedName correctly branched'); - } - return true; -} - -/// Validate that a Shorebird release for a given [flutterVersionName] -/// exists and is consistent with its Flutter release. -bool validateRelease(Checkouts checkouts, String flutterVersionName) { - // Check that our flutter fork has the expected tag. - if (!ensureTagMatch(checkouts.flutter, flutterVersionName)) { - return false; - } - // Check that the engine has the expected tag. - if (!ensureTagMatch(checkouts.engine, flutterVersionName)) { - return false; - } - - // Check for flutter_release/$version in all of our forks - // and that our flutter forkpoint is included in the release branch. - if (!ensureReleaseBranchesIncludeForkpoint( - checkouts, - flutterVersionName, - )) { - return false; - } - return true; -} - -/// Return all Flutter versions that are tagged in the upstream Flutter repo. -/// Does not include pre-releases. -/// Returns in descending order (latest release first). -Iterable allFlutterVersions(Checkout flutter) { - final versionTags = flutter.remoteTags(remote: 'upstream'); - final semvers = []; - for (final tag in versionTags) { - // e.g. refs/tags/v1.9.7-hotfix.4 - final tagName = tag.ref; - final versionName = tagName.split('/').last; - // ignore old versions - if (versionName[0] != '3') { - continue; - } - final version = semver.Version.parse(versionName); - logger.info('Found flutter tag $version'); - if (version.isPreRelease) { - continue; - } - semvers.add(version); - } - semvers.sort(); - // Default sort is ascending, we want descending so call reversed. - return semvers.reversed.map((version) => version.toString()); -} - -/// Validate that a Shorebird release is consistent with its Flutter release. -class ValidateCommand extends CutlerCommand { - /// Constructs a new [ValidateCommand]. - ValidateCommand() { - argParser.addFlag( - 'all', - help: 'Validate all Flutter releases.', - ); - } - @override - final name = 'validate'; - @override - final description = - 'Validate that a Shorebird release is consistent with its Flutter ' - 'release.'; - - @override - int run() { - checkouts = Checkouts(config.checkoutsRoot); - - // If they passed --all, validate all Flutter releases. - // Otherwise, validate the versions they passed. - final versions = argResults!['all'] as bool - ? allFlutterVersions(checkouts.flutter) - : argResults!.rest; - - if (versions.isEmpty) { - logger - ..err('No versions to validate.') - ..info(argParser.usage); - return ExitCode.usage.code; - } - - for (final version in versions) { - logger.info('Validating $version'); - if (!validateRelease(checkouts, version)) { - return ExitCode.software.code; - } - } - return ExitCode.success.code; - } -} diff --git a/packages/cutler/lib/commands/versions_command.dart b/packages/cutler/lib/commands/versions_command.dart deleted file mode 100644 index a2d62ddf..00000000 --- a/packages/cutler/lib/commands/versions_command.dart +++ /dev/null @@ -1,74 +0,0 @@ -import 'package:cutler/checkout.dart'; -import 'package:cutler/commands/base.dart'; -import 'package:cutler/logger.dart'; -import 'package:cutler/model.dart'; -import 'package:cutler/versions.dart'; -import 'package:io/io.dart'; - -/// Print the versions a given Shorebird or Flutter hash depends on. -class VersionsCommand extends CutlerCommand { - /// Constructs a new [VersionsCommand]. - VersionsCommand() { - argParser.addOption( - 'repo', - abbr: 'r', - help: 'Repo the hash belongs to.', - allowed: ['shorebird', 'flutter'], - defaultsTo: 'shorebird', - ); - } - @override - final name = 'versions'; - @override - final description = - 'Print the versions a Shorebird or Flutter release hash depends on.'; - - @override - int run() { - checkouts = Checkouts(config.checkoutsRoot); - - final repoName = argResults!['repo'] as String; - final repo = Repo.values.firstWhere((r) => r.name == repoName); - final isShorebird = repo.name == 'shorebird'; - late final String hash; - if (argResults!.rest.isEmpty) { - hash = isShorebird ? 'origin/stable' : 'upstream/stable'; - } else { - hash = argResults!.rest.first; - } - - updateReposIfNeeded(config); - - if (!isShorebird) { - final flutterVersions = getFlutterVersions(checkouts, hash); - logger.info('Flutter $hash:'); - printVersions(checkouts, flutterVersions, indent: 2); - return ExitCode.success.code; - } - - final shorebirdFlutter = - shorebird.contentsAtPath(hash, 'bin/internal/flutter.version'); - final shorebirdVersions = getFlutterVersions(checkouts, shorebirdFlutter); - final flutterForkpoint = - flutter.getForkPoint(shorebirdVersions.flutter.hash); - final flutterHash = flutterForkpoint.hash; - final flutterVersions = getFlutterVersions(checkouts, flutterHash); - - logger.info('Shorebird @ $hash'); - printVersions( - checkouts, - shorebirdVersions, - indent: 2, - upstream: flutterVersions, - ); - logger.info('Upstream'); - printVersions( - checkouts, - flutterVersions, - indent: 2, - trailingNewline: false, - ); - - return ExitCode.success.code; - } -} diff --git a/packages/cutler/lib/config.dart b/packages/cutler/lib/config.dart deleted file mode 100644 index 21814720..00000000 --- a/packages/cutler/lib/config.dart +++ /dev/null @@ -1,68 +0,0 @@ -import 'dart:io'; - -import 'package:path/path.dart' as p; - -// https://github.com/dart-lang/sdk/issues/18466 -// https://github.com/dart-lang/path/issues/117#issuecomment-1034313012 -/// Expands a path that may contain a user directory (`~`). If [env] is -/// provided, it will be used instead of [Platform.environment]. -String expandUser(String path, {Map? env}) { - // This is not "well written", but eventually I guess we should - // write one and publish it if Dart doesn't add an equivalent method. - // If we're in CMD or PowerShell, we need to expand %USERPROFILE%. If we're - // in WSL, we need to expand $HOME. - // This should handle ~ and ~user. - final environment = env ?? Platform.environment; - if (path.startsWith('~')) { - final home = environment['HOME']; - if (home == null) { - throw Exception('Failed to expand $path'); - } - return path.replaceFirst('~', home); - } - return path; -} - -// This behavior belongs in the Dart SDK somewhere. -/// Find the package root for the current running script. -String findPackageRoot({String? scriptPath}) { - final path = scriptPath ?? Platform.script.path; - // e.g. `dart run bin/cutler.dart` - if (path.endsWith('.dart')) { - final binPath = p.dirname(path); - return p.dirname(binPath); - } - // `dart run` pre-compiles into a snapshot and then runs, e.g. - // .../packages/cutler/.dart_tool/pub/bin/cutler/cutler.dart-3.0.2.snapshot - if (path.endsWith('.snapshot') && path.contains('.dart_tool')) { - return path.split('.dart_tool').first; - } - throw UnimplementedError('Could not find package root: $path'); -} - -// Config is basically just our typed ArgResults held as a global. -/// Global configuration object for Cutler. -class Config { - /// Constructs a new [Config]. - Config({ - required this.checkoutsRoot, - required this.dryRun, - required this.doUpdate, - required this.flutterChannel, - }); - - /// The root directory where checkouts can be found. - final String checkoutsRoot; - - /// Whether to perform a dry run. - final bool dryRun; - - /// Whether to update checkouts. - final bool doUpdate; - - /// The Flutter channel to use. - final String flutterChannel; - - /// The name of the release branch for Shorebird. - final String shorebirdReleaseBranch = 'origin/stable'; -} diff --git a/packages/cutler/lib/cutler.dart b/packages/cutler/lib/cutler.dart deleted file mode 100644 index a4d68f21..00000000 --- a/packages/cutler/lib/cutler.dart +++ /dev/null @@ -1,96 +0,0 @@ -import 'dart:io'; - -import 'package:args/args.dart'; -import 'package:args/command_runner.dart'; -import 'package:cutler/commands/commands.dart'; -import 'package:cutler/config.dart'; -import 'package:cutler/logger.dart'; -import 'package:cutler/model.dart'; -import 'package:mason_logger/mason_logger.dart'; -import 'package:path/path.dart' as p; - -/// The main Cutler command runner. -class Cutler extends CommandRunner { - /// Constructs a new [Cutler] command runner. - Cutler() : super('cutler', 'A tool for maintaining forks of Flutter.') { - addCommand(VersionsCommand()); - addCommand(RebaseCommand()); - addCommand(ValidateCommand()); - - argParser - ..addFlag('verbose', abbr: 'v') - ..addOption( - 'root', - help: 'Directory in which to find checkouts.', - ) - ..addOption( - 'flutter-channel', - defaultsTo: 'stable', - help: 'Upstream channel to propose rebasing onto.', - ) - ..addFlag('dry-run', defaultsTo: true, help: 'Do not actually run git.') - ..addFlag('update', defaultsTo: true, help: 'Update checkouts.'); - } - - /// Global config set during arg parsing. - late Config config; - - /// Lists directories missing from the proposed root directory. - Iterable missingDirectories(String rootDir) { - return Repo.values.map((repo) => '$rootDir/${repo.path}').where( - (path) => !Directory(path).existsSync(), - ); - } - - /// Find a valid root directory for checkouts. - String fallbackRootDir() { - final cutlerRoot = findPackageRoot(); - final packagesDir = p.dirname(cutlerRoot); - final shorebirdDir = p.dirname(packagesDir); - final fallbackDirectories = [ - Directory.current.path, - p.dirname(shorebirdDir), - // Internal checkouts use a _shorebird wrapper directory. - p.dirname(p.dirname(shorebirdDir)), - ]; - for (final directory in fallbackDirectories) { - if (missingDirectories(directory).isEmpty) { - logger.info('Using $directory as checkouts root.'); - return directory; - } - } - logger.err('Failed to find a valid checkouts root, tried:\n' - '${fallbackDirectories.join('\n')}'); - return ''; // Returning an invalid directory will cause validation to fail. - } - - @override - ArgResults parse(Iterable args) { - final results = super.parse(args); - - final rootDir = results['root'] as String? ?? fallbackRootDir(); - - final missingDirs = missingDirectories(rootDir); - if (missingDirs.isNotEmpty) { - logger - ..err('Could not find a valid checkouts root.') - ..err('--root must be a directory containing the ' - 'following:\n${Repo.values.map((r) => r.path).join('\n')}') - ..err('Missing directories:\n${missingDirs.join('\n')}'); - exit(1); - } - - config = Config( - checkoutsRoot: expandUser(rootDir), - dryRun: results['dry-run'] as bool, - doUpdate: results['update'] as bool, - flutterChannel: results['flutter-channel'] as String, - ); - - if (results['verbose'] as bool) { - logger.level = Level.verbose; - } - - return results; - } -} diff --git a/packages/cutler/lib/logger.dart b/packages/cutler/lib/logger.dart deleted file mode 100644 index f09f7e54..00000000 --- a/packages/cutler/lib/logger.dart +++ /dev/null @@ -1,8 +0,0 @@ -import 'package:mason_logger/mason_logger.dart'; -import 'package:scoped/scoped.dart'; - -/// A reference to a [Logger] instance. -final loggerRef = create(Logger.new); - -/// The [Logger] instance available in the current zone. -Logger get logger => read(loggerRef); diff --git a/packages/cutler/lib/model.dart b/packages/cutler/lib/model.dart deleted file mode 100644 index ca9e7b52..00000000 --- a/packages/cutler/lib/model.dart +++ /dev/null @@ -1,204 +0,0 @@ -import 'package:meta/meta.dart'; - -/// Configuration information for each of our repos. -enum Repo { - /// Repo configuration representing the Shorebird repo. - shorebird( - name: 'shorebird', - path: '_shorebird/shorebird', - url: 'https://github.com/shorebirdtech/shorebird.git', - // TODO(eseidel): There is no upstream for Shorebird, this should be null. - upstreamBranch: 'origin/main', - directDependencies: [Repo.flutter], - ), - - /// Repo configuration representing the Flutter repo. - flutter( - name: 'flutter', - path: 'flutter', - url: 'https://github.com/shorebirdtech/flutter.git', - upstreamBranch: 'upstream/stable', - directDependencies: [Repo.engine], - ), - - /// Repo configuration representing the engine repo. - engine( - name: 'engine', - path: 'engine/src/flutter', - url: 'https://github.com/shorebirdtech/engine.git', - upstreamBranch: 'upstream/master', - directDependencies: [Repo.dart, Repo.buildroot], - ), - - /// Repo configuration representing the dart-lang/sdk repo. - dart( - name: 'dart', - path: 'engine/src/third_party/dart', - url: 'https://github.com/shorebirdtech/dart-sdk.git', - upstreamBranch: 'upstream/master', - directDependencies: [], - ), - - /// Repo configuration representing the buildroot repo. - buildroot( - name: 'buildroot', - path: 'engine/src', - url: 'https://github.com/shorebirdtech/builddoor.git', - upstreamBranch: 'upstream/master', - directDependencies: [], - ); - - const Repo({ - required this.name, - required this.path, - required this.url, - required this.upstreamBranch, - required this.directDependencies, - }); - - /// Returns the name (e.g. 'engine') of the repo. - final String name; - - /// Returns the path (e.g. 'engine/src/flutter') of the repo. - final String path; - - /// Returns the URL the repo is cloned from. - final String url; - - /// Returns the name of the upstream branch. - final String upstreamBranch; - - /// Returns the direct dependencies of the repo. - final List directDependencies; - - /// Returns the transitive dependencies of a given repo. - Iterable get dependencies { - final deps = {}; - for (final dep in directDependencies) { - deps - ..add(dep) - ..addAll(dep.dependencies); - } - return deps; - } -} - -/// Paths to version files in each repo. -enum Paths { - /// Path to the engine DEPS file in the engine repo. - engineDEPS('DEPS'), - - /// Path to the flutter engine version file in the flutter repo. - flutterEngineVersion('bin/internal/engine.version'), - - /// Path to the flutter version file in the shorebird repo. - shorebirdFlutterVersion('bin/internal/flutter.version'); - - const Paths(this.path); - - /// Returns the path (e.g. 'DEPS') of the file. - final String path; -} - -/// An object to pair a [hash] with a [repo]. -@immutable -class Version { - /// Constructs a new [Version] object for a given [hash] and [repo] - /// with optionally provided [aliases] for the hash (typically tag names). - const Version({ - required this.hash, - required this.repo, - this.aliases = const [], - }); - - /// The hash of the version. - final String hash; - - /// Aliases for the hash (typically tag names). - final List aliases; - - /// The repo the version is from. - final Repo repo; - - /// Returns the first alias for the hash, or the hash if there are no aliases. - String get ref => aliases.isEmpty ? hash : aliases.first; - - @override - String toString() { - final aliasesString = aliases.isEmpty ? '' : " (${aliases.join(', ')})"; - return '$hash$aliasesString'; - } - - @override - bool operator ==(Object other) { - if (other is! Version) { - return false; - } - return other.hash == hash && other.repo == repo; - } - - @override - int get hashCode => Object.hashAll([hash, repo]); -} - -/// An object to hold a set of versions that make up a Flutter release. -@immutable -class VersionSet { - /// Constructs a new [VersionSet] with a given [engine], [flutter], and - /// [buildroot] version. - const VersionSet({ - required this.engine, - required this.flutter, - required this.buildroot, - required this.dart, - }); - - /// The engine version. - final Version engine; - - /// The flutter version. - final Version flutter; - - /// The dart version. - final Version dart; - - /// The buildroot version. - final Version buildroot; - - /// Returns the version for a given [repo]. - Version operator [](Repo repo) => { - Repo.engine: engine, - Repo.flutter: flutter, - Repo.buildroot: buildroot, - Repo.dart: dart, - }[repo]!; - - /// Copies the VersionSet replacing any provided values. - VersionSet copyWith({ - Version? engine, - Version? flutter, - Version? buildroot, - Version? dart, - }) { - return VersionSet( - engine: engine ?? this.engine, - flutter: flutter ?? this.flutter, - buildroot: buildroot ?? this.buildroot, - dart: dart ?? this.dart, - ); - } - - @override - bool operator ==(Object other) { - if (other is! VersionSet) { - return false; - } - return other.engine == engine && - other.flutter == flutter && - other.buildroot == buildroot && - other.dart == dart; - } - - @override - int get hashCode => Object.hashAll([engine, flutter, buildroot, dart]); -} diff --git a/packages/cutler/lib/versions.dart b/packages/cutler/lib/versions.dart deleted file mode 100644 index 76fcd877..00000000 --- a/packages/cutler/lib/versions.dart +++ /dev/null @@ -1,99 +0,0 @@ -import 'package:collection/collection.dart'; -import 'package:cutler/checkout.dart'; -import 'package:cutler/logger.dart'; -import 'package:cutler/model.dart'; - -/// Print VersionSet [versions] to stdout at a given [indent] level. -void printVersions( - Checkouts checkouts, - VersionSet versions, { - int indent = 0, - VersionSet? upstream, - bool trailingNewline = true, -}) { - final repos = [ - Repo.flutter, - Repo.engine, - Repo.dart, - Repo.buildroot, - ]; - for (final repo in repos) { - final checkout = checkouts[repo]; - final string = "${' ' * indent}${repo.name.padRight(9)} ${versions[repo]}"; - // Include number of commits ahead of upstream. - if (upstream != null) { - final upstreamVersion = upstream[repo]; - final commitCount = checkout.countCommits( - from: upstreamVersion.ref, - to: versions[repo].ref, - ); - final commitsString = commitCount != 0 ? ' ($commitCount ahead)' : ''; - logger.info('$string$commitsString'); - } else { - logger.info(string); - } - } - if (trailingNewline) { - logger.info(''); - } -} - -/// Returns a [VersionSet] for Flutter for a given [flutterHash]. -/// e.g. `flutterHash` might be `origin/stable` or `v1.22.0-12.1.pre`. -/// and this would return the set of versions (engine and buildroot) that -/// Flutter depends on for that release. -VersionSet getFlutterVersions(Checkouts checkouts, String flutterHash) { - final flutter = checkouts.flutter; - final engine = checkouts.engine; - final buildroot = checkouts.buildroot; - final dart = checkouts.dart; - final engineHash = - flutter.contentsAtPath(flutterHash, 'bin/internal/engine.version').trim(); - final depsContents = engine.contentsAtPath(engineHash, Paths.engineDEPS.path); - final buildrootHash = parseBuildrootRevision(depsContents); - final dartHash = parseDartRevision(depsContents); - return VersionSet( - engine: engine.versionFrom(engineHash), - flutter: flutter.versionFrom(flutterHash), - buildroot: buildroot.versionFrom(buildrootHash), - dart: dart.versionFrom(dartHash), - ); -} - -/// Parses the given DEPS file contents and returns the buildroot revision. -String parseBuildrootRevision(String depsContents) { - final lines = depsContents.split('\n'); - // Example: - // 'src': 'https://github.com/flutter/buildroot.git' + '@' + '059d155b4d452efd9c4427c45cddfd9445144869', - final buildrootLine = - lines.firstWhereOrNull((line) => line.contains("'src': ")); - if (buildrootLine == null) { - throw Exception('Failed to find buildroot revision in DEPS file'); - } - final regexp = RegExp('([0-9a-f]{40})'); - final match = regexp.firstMatch(buildrootLine); - if (match == null) { - throw Exception('Failed to parse buildroot revision from $buildrootLine'); - } - return match.group(0)!; -} - -/// Parses the given DEPS file contents and returns the dart-lang/sdk revision. -String parseDartRevision(String depsContents) { - final lines = depsContents.split('\n'); - // Example: - // 'dart_sdk_revision': 'ce926bc6dcf649bd31a396e4e3961196115727cd', - // In our fork we use dart_sdk_revision, not dart_revision, since the former - // points to our fork of the Dart SDK and the latter points to some base - // revision for dart.googlesource.com/sdk. - // For upstream we use 'dart_revision'. - final dartLine = lines - .firstWhereOrNull((line) => line.contains("'dart_sdk_revision': ")) ?? - lines.firstWhere((line) => line.contains("'dart_revision': ")); - final regexp = RegExp('([0-9a-f]{40})'); - final match = regexp.firstMatch(dartLine); - if (match == null) { - throw Exception('Failed to parse dart revision from $dartLine'); - } - return match.group(0)!; -} diff --git a/packages/cutler/pubspec.lock b/packages/cutler/pubspec.lock deleted file mode 100644 index 4e228d9c..00000000 --- a/packages/cutler/pubspec.lock +++ /dev/null @@ -1,420 +0,0 @@ -# Generated by pub -# See https://dart.dev/tools/pub/glossary#lockfile -packages: - _fe_analyzer_shared: - dependency: transitive - description: - name: _fe_analyzer_shared - sha256: eb376e9acf6938204f90eb3b1f00b578640d3188b4c8a8ec054f9f479af8d051 - url: "https://pub.dev" - source: hosted - version: "64.0.0" - analyzer: - dependency: transitive - description: - name: analyzer - sha256: "69f54f967773f6c26c7dcb13e93d7ccee8b17a641689da39e878d5cf13b06893" - url: "https://pub.dev" - source: hosted - version: "6.2.0" - args: - dependency: "direct main" - description: - name: args - sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596 - url: "https://pub.dev" - source: hosted - version: "2.4.2" - async: - dependency: transitive - description: - name: async - sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" - url: "https://pub.dev" - source: hosted - version: "2.11.0" - boolean_selector: - dependency: transitive - description: - name: boolean_selector - sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" - url: "https://pub.dev" - source: hosted - version: "2.1.1" - collection: - dependency: "direct main" - description: - name: collection - sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a - url: "https://pub.dev" - source: hosted - version: "1.18.0" - convert: - dependency: transitive - description: - name: convert - sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" - url: "https://pub.dev" - source: hosted - version: "3.1.1" - coverage: - dependency: transitive - description: - name: coverage - sha256: "2fb815080e44a09b85e0f2ca8a820b15053982b2e714b59267719e8a9ff17097" - url: "https://pub.dev" - source: hosted - version: "1.6.3" - crypto: - dependency: transitive - description: - name: crypto - sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab - url: "https://pub.dev" - source: hosted - version: "3.0.3" - ffi: - dependency: transitive - description: - name: ffi - sha256: "7bf0adc28a23d395f19f3f1eb21dd7cfd1dd9f8e1c50051c069122e6853bc878" - url: "https://pub.dev" - source: hosted - version: "2.1.0" - file: - dependency: transitive - description: - name: file - sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" - url: "https://pub.dev" - source: hosted - version: "7.0.0" - frontend_server_client: - dependency: transitive - description: - name: frontend_server_client - sha256: "408e3ca148b31c20282ad6f37ebfa6f4bdc8fede5b74bc2f08d9d92b55db3612" - url: "https://pub.dev" - source: hosted - version: "3.2.0" - glob: - dependency: transitive - description: - name: glob - sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63" - url: "https://pub.dev" - source: hosted - version: "2.1.2" - http_multi_server: - dependency: transitive - description: - name: http_multi_server - sha256: "97486f20f9c2f7be8f514851703d0119c3596d14ea63227af6f7a481ef2b2f8b" - url: "https://pub.dev" - source: hosted - version: "3.2.1" - http_parser: - dependency: transitive - description: - name: http_parser - sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" - url: "https://pub.dev" - source: hosted - version: "4.0.2" - io: - dependency: "direct main" - description: - name: io - sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e" - url: "https://pub.dev" - source: hosted - version: "1.0.4" - js: - dependency: transitive - description: - name: js - sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 - url: "https://pub.dev" - source: hosted - version: "0.6.7" - logging: - dependency: transitive - description: - name: logging - sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340" - url: "https://pub.dev" - source: hosted - version: "1.2.0" - mason_logger: - dependency: "direct main" - description: - name: mason_logger - sha256: "5d2819827d53bf0178637b64c090be546b1801550fa0af7b2780fa7e3ad7b4b7" - url: "https://pub.dev" - source: hosted - version: "0.2.9" - matcher: - dependency: transitive - description: - name: matcher - sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" - url: "https://pub.dev" - source: hosted - version: "0.12.16" - meta: - dependency: "direct main" - description: - name: meta - sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" - url: "https://pub.dev" - source: hosted - version: "1.9.1" - mime: - dependency: transitive - description: - name: mime - sha256: e4ff8e8564c03f255408decd16e7899da1733852a9110a58fe6d1b817684a63e - url: "https://pub.dev" - source: hosted - version: "1.0.4" - mocktail: - dependency: "direct main" - description: - name: mocktail - sha256: "9503969a7c2c78c7292022c70c0289ed6241df7a9ba720010c0b215af29a5a58" - url: "https://pub.dev" - source: hosted - version: "1.0.0" - node_preamble: - dependency: transitive - description: - name: node_preamble - sha256: "6e7eac89047ab8a8d26cf16127b5ed26de65209847630400f9aefd7cd5c730db" - url: "https://pub.dev" - source: hosted - version: "2.0.2" - package_config: - dependency: transitive - description: - name: package_config - sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd" - url: "https://pub.dev" - source: hosted - version: "2.1.0" - path: - dependency: "direct main" - description: - name: path - sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" - url: "https://pub.dev" - source: hosted - version: "1.8.3" - pool: - dependency: transitive - description: - name: pool - sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a" - url: "https://pub.dev" - source: hosted - version: "1.5.1" - pub_semver: - dependency: transitive - description: - name: pub_semver - sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c" - url: "https://pub.dev" - source: hosted - version: "2.1.4" - scoped: - dependency: "direct main" - description: - path: "../scoped" - relative: true - source: path - version: "0.1.0+1" - shelf: - dependency: transitive - description: - name: shelf - sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4 - url: "https://pub.dev" - source: hosted - version: "1.4.1" - shelf_packages_handler: - dependency: transitive - description: - name: shelf_packages_handler - sha256: "89f967eca29607c933ba9571d838be31d67f53f6e4ee15147d5dc2934fee1b1e" - url: "https://pub.dev" - source: hosted - version: "3.0.2" - shelf_static: - dependency: transitive - description: - name: shelf_static - sha256: a41d3f53c4adf0f57480578c1d61d90342cd617de7fc8077b1304643c2d85c1e - url: "https://pub.dev" - source: hosted - version: "1.1.2" - shelf_web_socket: - dependency: transitive - description: - name: shelf_web_socket - sha256: "9ca081be41c60190ebcb4766b2486a7d50261db7bd0f5d9615f2d653637a84c1" - url: "https://pub.dev" - source: hosted - version: "1.0.4" - source_map_stack_trace: - dependency: transitive - description: - name: source_map_stack_trace - sha256: "84cf769ad83aa6bb61e0aa5a18e53aea683395f196a6f39c4c881fb90ed4f7ae" - url: "https://pub.dev" - source: hosted - version: "2.1.1" - source_maps: - dependency: transitive - description: - name: source_maps - sha256: "708b3f6b97248e5781f493b765c3337db11c5d2c81c3094f10904bfa8004c703" - url: "https://pub.dev" - source: hosted - version: "0.10.12" - source_span: - dependency: transitive - description: - name: source_span - sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" - url: "https://pub.dev" - source: hosted - version: "1.10.0" - stack_trace: - dependency: transitive - description: - name: stack_trace - sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" - url: "https://pub.dev" - source: hosted - version: "1.11.1" - stream_channel: - dependency: transitive - description: - name: stream_channel - sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 - url: "https://pub.dev" - source: hosted - version: "2.1.2" - string_scanner: - dependency: transitive - description: - name: string_scanner - sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" - url: "https://pub.dev" - source: hosted - version: "1.2.0" - term_glyph: - dependency: transitive - description: - name: term_glyph - sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 - url: "https://pub.dev" - source: hosted - version: "1.2.1" - test: - dependency: "direct dev" - description: - name: test - sha256: "9b0dd8e36af4a5b1569029949d50a52cb2a2a2fdaa20cebb96e6603b9ae241f9" - url: "https://pub.dev" - source: hosted - version: "1.24.6" - test_api: - dependency: transitive - description: - name: test_api - sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" - url: "https://pub.dev" - source: hosted - version: "0.6.1" - test_core: - dependency: transitive - description: - name: test_core - sha256: "4bef837e56375537055fdbbbf6dd458b1859881f4c7e6da936158f77d61ab265" - url: "https://pub.dev" - source: hosted - version: "0.5.6" - typed_data: - dependency: transitive - description: - name: typed_data - sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c - url: "https://pub.dev" - source: hosted - version: "1.3.2" - version: - dependency: "direct main" - description: - name: version - sha256: "3d4140128e6ea10d83da32fef2fa4003fccbf6852217bb854845802f04191f94" - url: "https://pub.dev" - source: hosted - version: "3.0.2" - very_good_analysis: - dependency: "direct dev" - description: - name: very_good_analysis - sha256: "9ae7f3a3bd5764fb021b335ca28a34f040cd0ab6eec00a1b213b445dae58a4b8" - url: "https://pub.dev" - source: hosted - version: "5.1.0" - vm_service: - dependency: transitive - description: - name: vm_service - sha256: c538be99af830f478718b51630ec1b6bee5e74e52c8a802d328d9e71d35d2583 - url: "https://pub.dev" - source: hosted - version: "11.10.0" - watcher: - dependency: transitive - description: - name: watcher - sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8" - url: "https://pub.dev" - source: hosted - version: "1.1.0" - web_socket_channel: - dependency: transitive - description: - name: web_socket_channel - sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b - url: "https://pub.dev" - source: hosted - version: "2.4.0" - webkit_inspection_protocol: - dependency: transitive - description: - name: webkit_inspection_protocol - sha256: "67d3a8b6c79e1987d19d848b0892e582dbb0c66c57cc1fef58a177dd2aa2823d" - url: "https://pub.dev" - source: hosted - version: "1.2.0" - win32: - dependency: transitive - description: - name: win32 - sha256: "9e82a402b7f3d518fb9c02d0e9ae45952df31b9bf34d77baf19da2de03fc2aaa" - url: "https://pub.dev" - source: hosted - version: "5.0.7" - yaml: - dependency: transitive - description: - name: yaml - sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" - url: "https://pub.dev" - source: hosted - version: "3.1.2" -sdks: - dart: ">=3.0.0 <4.0.0" diff --git a/packages/cutler/pubspec.yaml b/packages/cutler/pubspec.yaml deleted file mode 100644 index aef7dee3..00000000 --- a/packages/cutler/pubspec.yaml +++ /dev/null @@ -1,24 +0,0 @@ -name: cutler -description: A tool for managing Flutter forks. -version: 1.0.0 -repository: https://github.com/shorebirdtech/shorebird -publish_to: none - -environment: - sdk: '>=3.0.0 <4.0.0' - -dev_dependencies: - test: ^1.21.0 - very_good_analysis: ^5.1.0 - -dependencies: - args: ^2.4.0 - collection: ^1.18.0 - io: ^1.0.4 - mason_logger: ^0.2.9 - meta: ^1.9.1 - mocktail: ^1.0.0 - path: ^1.8.3 - scoped: - path: ../scoped - version: ^3.0.2 diff --git a/packages/cutler/test/checkout_test.dart b/packages/cutler/test/checkout_test.dart deleted file mode 100644 index 8b296179..00000000 --- a/packages/cutler/test/checkout_test.dart +++ /dev/null @@ -1,105 +0,0 @@ -import 'dart:io'; - -import 'package:cutler/checkout.dart'; -import 'package:cutler/logger.dart'; -import 'package:cutler/model.dart'; -import 'package:mason_logger/mason_logger.dart'; -import 'package:mocktail/mocktail.dart'; -import 'package:scoped/scoped.dart'; -import 'package:test/test.dart'; - -class _MockLogger extends Mock implements Logger {} - -void main() { - test('runCommand', () { - final dartPath = Platform.executable; - expect( - () => runCommand(dartPath, [], workingDirectory: 'DOES_NOT_EXIST'), - throwsA(isA()), - ); - }); - - test('runCommand with git', () { - final systemTemp = Directory.systemTemp; - final temp = systemTemp.createTempSync(); - // Should this use something like: - // https://pub.dev/packages/process_run? - // or https://dcli.onepub.dev/dcli-api/calling-apps#which - const gitPath = 'git'; - final result = runScoped( - () { - return runCommand(gitPath, ['init'], workingDirectory: temp.path); - }, - values: { - loggerRef.overrideWith(_MockLogger.new), - }, - ); - expect(result, contains('Initialized empty Git repository')); - }); - - test('Checkouts', () { - final checkouts = Checkouts('ROOT'); - expect(checkouts.dart.name, 'dart'); - expect(checkouts.engine.name, 'engine'); - expect(checkouts.flutter.name, 'flutter'); - expect(checkouts.buildroot.name, 'buildroot'); - expect(checkouts.shorebird.name, 'shorebird'); - expect(checkouts.values.length, 5); - expect(checkouts.buildroot.workingDirectory, 'ROOT/engine/src'); - expect(checkouts.engine.workingDirectory, 'ROOT/engine/src/flutter'); - expect(checkouts.dart.workingDirectory, 'ROOT/engine/src/third_party/dart'); - expect(checkouts.flutter.workingDirectory, 'ROOT/flutter'); - expect(checkouts.shorebird.workingDirectory, 'ROOT/_shorebird/shorebird'); - }); - - Directory setupCheckouts() { - final systemTemp = Directory.systemTemp; - final checkoutsRoot = systemTemp.createTempSync(); - for (final repo in Repo.values) { - final dir = Directory('${checkoutsRoot.path}/${repo.path}') - ..createSync(recursive: true); - runCommand('git', ['init'], workingDirectory: dir.path); - final checkout = Checkout(repo, checkoutsRoot.path) - ..writeFile('NAME', repo.name); - runCommand('git', ['add', 'NAME'], workingDirectory: dir.path); - // Git requires user.email user.name to be set before committing. - runCommand( - 'git', - ['config', 'user.email', 'test@shorebird.dev'], - workingDirectory: dir.path, - ); - runCommand( - 'git', - ['config', 'user.name', 'Cutler Checkout Test'], - workingDirectory: dir.path, - ); - checkout.commit('Test commit'); - } - return checkoutsRoot; - } - - test('Checkouts real git commands', () { - runScoped( - () { - final root = setupCheckouts(); - final checkouts = Checkouts(root.path); - expect(checkouts.dart.contentsAtPath('HEAD', 'NAME'), 'dart'); - expect(checkouts.engine.contentsAtPath('HEAD', 'NAME'), 'engine'); - expect(checkouts.flutter.contentsAtPath('HEAD', 'NAME'), 'flutter'); - expect(checkouts.buildroot.contentsAtPath('HEAD', 'NAME'), 'buildroot'); - expect(checkouts.shorebird.contentsAtPath('HEAD', 'NAME'), 'shorebird'); - - // Should not throw. - checkouts.dart.fetchAll(); - expect(checkouts.dart.getTagsFor('HEAD'), equals([])); - expect( - checkouts.dart.getLatestCommit('HEAD'), - equals(checkouts.dart.localHead().hash), - ); - }, - values: { - loggerRef.overrideWith(_MockLogger.new), - }, - ); - }); -} diff --git a/packages/cutler/test/config_test.dart b/packages/cutler/test/config_test.dart deleted file mode 100644 index aa92f289..00000000 --- a/packages/cutler/test/config_test.dart +++ /dev/null @@ -1,30 +0,0 @@ -import 'package:cutler/config.dart'; -import 'package:test/test.dart'; - -void main() { - test('expandUser', () { - final path = expandUser('~/foo/bar', env: {'HOME': '/home/user'}); - expect(path, endsWith('/home/user/foo/bar')); - - // HOME is not set. - expect(() => expandUser('~/foo/bar', env: {}), throwsA(isA())); - }); - - test('packageRootFromScriptPath', () { - // Using Platform.script.path inside a test is sometimes a - // .dill file (from package test) or sometimes a snapshot - // e.g. from very_good test. - expect(findPackageRoot(scriptPath: '/foo/bar/bin/baz.dart'), '/foo/bar'); - expect( - findPackageRoot( - scriptPath: - '/src/foo/.dart_tool/pub/bin/cutler/cutler.dart-3.0.2.snapshot', - ), - '/src/foo/', - ); - expect( - () => findPackageRoot(scriptPath: '/invalid'), - throwsA(isA()), - ); - }); -} diff --git a/packages/cutler/test/fixtures/DEPS b/packages/cutler/test/fixtures/DEPS deleted file mode 100644 index dd4e673d..00000000 --- a/packages/cutler/test/fixtures/DEPS +++ /dev/null @@ -1,965 +0,0 @@ -# Example DEPS file from Flutter Engine -# Used to test our DEPS parsing regex. - -# The dependencies referenced by the Flutter Engine. -# -# This file is referenced by the .gclient file at the root of the checkout. -# To preview changes to the dependencies, update this file and run -# `gclient sync`. -# -# When adding a new dependency, please update the top-level .gitignore file -# to list the dependency's destination directory. - -vars = { - 'chromium_git': 'https://chromium.googlesource.com', - 'swiftshader_git': 'https://swiftshader.googlesource.com', - 'dart_git': 'https://dart.googlesource.com', - 'flutter_git': 'https://flutter.googlesource.com', - 'fuchsia_git': 'https://fuchsia.googlesource.com', - 'github_git': 'https://github.com', - 'skia_git': 'https://skia.googlesource.com', - 'llvm_git': 'https://llvm.googlesource.com', - # OCMock is for testing only so there is no google clone - 'ocmock_git': 'https://github.com/erikdoe/ocmock.git', - 'skia_revision': '0d31aa1f49cb8cfd790c44d92a9a023839524865', - - 'updater_git': 'https://github.com/shorebirdtech/updater.git', - 'updater_rev': '226df7d08dd7899e5cad6b597f2405708e8560d4', - - # WARNING: DO NOT EDIT canvaskit_cipd_instance MANUALLY - # See `lib/web_ui/README.md` for how to roll CanvasKit to a new version. - 'canvaskit_cipd_instance': '61aeJQ9laGfEFF_Vlc_u0MCkqB6xb2hAYHRBxKH-Uw4C', - - # Do not download the Emscripten SDK by default. - # This prevents us from downloading the Emscripten toolchain for builds - # which do not build for the web. This toolchain is needed to build CanvasKit - # for the web engine. - 'download_emsdk': False, - - # For experimental features some dependencies may only be avaialable in the master/main - # channels. This variable is being set when CI is checking out the repository. - 'release_candidate': False, - - - # As Dart does, we use Fuchsia's GN and Clang toolchain. These revision - # should be kept up to date with the revisions pulled by Dart. - # The list of revisions for these tools comes from Fuchsia, here: - # https://fuchsia.googlesource.com/integration/+/HEAD/toolchain - # If there are problems with the toolchain, contact fuchsia-toolchain@. - 'clang_version': 'git_revision:20d06c833d833ef6b2d0f519cc4a7998d49a2803', - - # When updating the Dart revision, ensure that all entries that are - # dependencies of Dart are also updated to match the entries in the - # Dart SDK's DEPS file for that revision of Dart. The DEPS file for - # Dart is: https://github.com/dart-lang/sdk/blob/main/DEPS - # You can use //tools/dart/create_updated_flutter_deps.py to produce - # updated revision list of existing dependencies. - 'dart_revision': '7a6514d1377175decd3a886fe4190fbbebddac3a', - - # WARNING: DO NOT EDIT MANUALLY - # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py - 'dart_binaryen_rev': 'b9b5f162ca8bf5b899ff0f0351491d7d403d7ed9', - 'dart_boringssl_gen_rev': 'ced85ef0a00bbca77ce5a91261a5f2ae61b1e62f', - 'dart_boringssl_rev': '87f316d7748268eb56f2dc147bd593254ae93198', - 'dart_browser_launcher_rev': 'ba4e02851d2e3d5b2889c6b44f6189baea584ce1', - 'dart_clock_rev': '93d9f56106fdba330bc8fade194038a5561ec730', - 'dart_collection_rev': '9db854d03529ccf8d0d665868ded65a4c1403c0f', - 'dart_devtools_rev': '026f0adf03725fbab24d601ac74c811808f258e5', - 'dart_libprotobuf_rev': '24487dd1045c7f3d64a21f38a3f0c06cc4cf2edb', - 'dart_perfetto_rev': 'b8da07095979310818f0efde2ef3c69ea70d62c5', - 'dart_protobuf_gn_rev': 'f872f05cb0378eef9a7a2609076929f0f35b4141', - 'dart_protobuf_rev': 'b90a4c44d56075eb23ee38ae56ce0febfd7f280f', - 'dart_pub_rev': '3e2c92a8bb74935302de52b80b870bf66963756d', - 'dart_root_certificates_rev': '692f6d6488af68e0121317a9c2c9eb393eb0ee50', - 'dart_watcher_rev': '00aa79b0ff5562c9dafb0525891e2e69c51be06d', - 'dart_webdev_rev': 'e887316c2352524baaf3b2e5aadd15ba0773edf6', - 'dart_webkit_inspection_protocol_rev': '8401098ace995e4dcd9855a2741c2dacccaa780b', - 'dart_yaml_edit_rev': '386fd331f206e0cb1d081cd76a4fe92fe016c99d', - 'dart_zlib_rev': '27c2f474b71d0d20764f86f60ef8b00da1a16cda', - - 'ocmock_rev': 'c4ec0e3a7a9f56cfdbd0aa01f4f97bb4b75c5ef8', # v3.7.1 - - # Download a prebuilt Dart SDK by default - 'download_dart_sdk': True, - - # Checkout Android dependencies only on platforms where we build for Android targets. - 'download_android_deps': 'host_os == "mac" or (host_os == "linux" and host_cpu == "x64")', - - # Checkout Windows dependencies only if we are building on Windows. - 'download_windows_deps' : 'host_os == "win"', - - # Checkout Linux dependencies only when building on Linux. - 'download_linux_deps': 'host_os == "linux"', - - # Downloads the fuchsia SDK as listed in fuchsia_sdk_path var. This variable - # is currently only used for the Fuchsia LSC process and is not intended for - # local development. - 'download_fuchsia_sdk': False, - 'fuchsia_sdk_path': '', - - # An LLVM backend needs LLVM binaries and headers. To avoid build time - # increases we can use prebuilts. We don't want to download this on every - # CQ/CI bot nor do we want the average Dart developer to incur that cost. - # So by default we will not download prebuilts. This varible is needed in - # the flutter engine to ensure that Dart gn has access to it as well. - "checkout_llvm": False, - - # Setup Git hooks by default. - "setup_githooks": True, - - # Upstream URLs for third party dependencies, used in - # determining common ancestor commit for vulnerability scanning - # prefixed with 'upstream_' in order to be identified by parsing tool. - # The vulnerabiity database being used in this scan can be browsed - # using this UI https://osv.dev/list - # If a new dependency needs to be added, the upstream (non-mirrored) - # git URL for that dependency should be added to this list - # with the key-value pair being: - # 'upstream_[dep name from last slash and before .git in URL]':'[git URL]' - # example: - "upstream_abseil-cpp": "https://github.com/abseil/abseil-cpp.git", - "upstream_angle": "https://github.com/google/angle.git", - "upstream_archive": "https://github.com/brendan-duncan/archive.git", - "upstream_args": "https://github.com/dart-lang/args.git", - "upstream_async": "https://github.com/dart-lang/async.git", - "upstream_bazel_worker": "https://github.com/dart-lang/bazel_worker.git", - "upstream_benchmark": "https://github.com/google/benchmark.git", - "upstream_boolean_selector": "https://github.com/dart-lang/boolean_selector.git", - "upstream_boringssl_gen": "https://github.com/dart-lang/boringssl_gen.git", - "upstream_boringssl": "https://github.com/openssl/openssl.git", - "upstream_browser_launcher": "https://github.com/dart-lang/browser_launcher.git", - "upstream_buildroot": "https://github.com/flutter/buildroot.git", - "upstream_cli_util": "https://github.com/dart-lang/cli_util.git", - "upstream_clock": "https://github.com/dart-lang/clock.git", - "upstream_collection": "https://github.com/dart-lang/collection.git", - "upstream_colorama": "https://github.com/tartley/colorama.git", - "upstream_convert": "https://github.com/dart-lang/convert.git", - "upstream_crypto": "https://github.com/dart-lang/crypto.git", - "upstream_csslib": "https://github.com/dart-lang/csslib.git", - "upstream_dart_style": "https://github.com/dart-lang/dart_style.git", - "upstream_dartdoc": "https://github.com/dart-lang/dartdoc.git", - "upstream_equatable": "https://github.com/felangel/equatable.git", - "upstream_ffi": "https://github.com/dart-lang/ffi.git", - "upstream_file": "https://github.com/google/file.dart.git", - "upstream_fixnum": "https://github.com/dart-lang/fixnum.git", - "upstream_flatbuffers": "https://github.com/google/flatbuffers.git", - "upstream_fontconfig": "https://gitlab.freedesktop.org/fontconfig/fontconfig.git", - "upstream_freetype2": "https://gitlab.freedesktop.org/freetype/freetype.git", - "upstream_gcloud": "https://github.com/dart-lang/gcloud.git", - "upstream_glfw": "https://github.com/glfw/glfw.git", - "upstream_glob": "https://github.com/dart-lang/glob.git", - "upstream_googleapis": "https://github.com/google/googleapis.dart.git", - "upstream_googletest": "https://github.com/google/googletest.git", - "upstream_gtest-parallel": "https://github.com/google/gtest-parallel.git", - "upstream_harfbuzz": "https://github.com/harfbuzz/harfbuzz.git", - "upstream_html": "https://github.com/dart-lang/html.git", - "upstream_http_multi_server": "https://github.com/dart-lang/http_multi_server.git", - "upstream_http_parser": "https://github.com/dart-lang/http_parser.git", - "upstream_http": "https://github.com/dart-lang/http.git", - "upstream_icu": "https://github.com/unicode-org/icu.git", - "upstream_intl": "https://github.com/dart-lang/intl.git", - "upstream_imgui": "https://github.com/ocornut/imgui.git", - "upstream_inja": "https://github.com/pantor/inja.git", - "upstream_json": "https://github.com/nlohmann/json.git", - "upstream_json_rpc_2": "https://github.com/dart-lang/json_rpc_2.git", - "upstream_libcxx": "https://github.com/llvm-mirror/libcxx.git", - "upstream_libcxxabi": "https://github.com/llvm-mirror/libcxxabi.git", - "upstream_libexpat": "https://github.com/libexpat/libexpat.git", - "upstream_libjpeg-turbo": "https://github.com/libjpeg-turbo/libjpeg-turbo.git", - "upstream_libpng": "https://github.com/glennrp/libpng.git", - "upstream_libtess2": "https://github.com/memononen/libtess2.git", - "upstream_libwebp": "https://chromium.googlesource.com/webm/libwebp.git", - "upstream_libxml": "https://gitlab.gnome.org/GNOME/libxml2.git", - "upstream_linter": "https://github.com/dart-lang/linter.git", - "upstream_logging": "https://github.com/dart-lang/logging.git", - "upstream_markdown": "https://github.com/dart-lang/markdown.git", - "upstream_matcher": "https://github.com/dart-lang/matcher.git", - "upstream_mime": "https://github.com/dart-lang/mime.git", - "upstream_mockito": "https://github.com/dart-lang/mockito.git", - "upstream_oauth2": "https://github.com/dart-lang/oauth2.git", - "upstream_ocmock": "https://github.com/erikdoe/ocmock.git", - "upstream_package_config": "https://github.com/dart-lang/package_config.git", - "upstream_packages": "https://github.com/flutter/packages.git", - "upstream_path": "https://github.com/dart-lang/path.git", - "upstream_platform": "https://github.com/google/platform.dart.git", - "upstream_pool": "https://github.com/dart-lang/pool.git", - "upstream_process_runner": "https://github.com/google/process_runner.git", - "upstream_process": "https://github.com/google/process.dart.git", - "upstream_protobuf": "https://github.com/google/protobuf.dart.git", - "upstream_pub_semver": "https://github.com/dart-lang/pub_semver.git", - "upstream_pub": "https://github.com/dart-lang/pub.git", - "upstream_pyyaml": "https://github.com/yaml/pyyaml.git", - "upstream_quiver-dart": "https://github.com/google/quiver-dart.git", - "upstream_rapidjson": "https://github.com/Tencent/rapidjson.git", - "upstream_root_certificates": "https://github.com/dart-lang/root_certificates.git", - "upstream_sdk": "https://github.com/dart-lang/sdk.git", - "upstream_shaderc": "https://github.com/google/shaderc.git", - "upstream_shelf": "https://github.com/dart-lang/shelf.git", - "upstream_skia": "https://skia.googlesource.com/skia.git", - "upstream_source_map_stack_trace": "https://github.com/dart-lang/source_map_stack_trace.git", - "upstream_source_maps": "https://github.com/dart-lang/source_maps.git", - "upstream_source_span": "https://github.com/dart-lang/source_span.git", - "upstream_sqlite": "https://github.com/sqlite/sqlite.git", - "upstream_sse": "https://github.com/dart-lang/sse.git", - "upstream_stack_trace": "https://github.com/dart-lang/stack_trace.git", - "upstream_stream_channel": "https://github.com/dart-lang/stream_channel.git", - "upstream_string_scanner": "https://github.com/dart-lang/string_scanner.git", - "upstream_SwiftShader": "https://swiftshader.googlesource.com/SwiftShader.git", - "upstream_term_glyph": "https://github.com/dart-lang/term_glyph.git", - "upstream_test_reflective_loader": "https://github.com/dart-lang/test_reflective_loader.git", - "upstream_test": "https://github.com/dart-lang/test.git", - "upstream_tinygltf": "https://github.com/syoyo/tinygltf.git", - "upstream_typed_data": "https://github.com/dart-lang/typed_data.git", - "upstream_usage": "https://github.com/dart-lang/usage.git", - "upstream_vector_math": "https://github.com/google/vector_math.dart.git", - "upstream_Vulkan-Headers": "https://github.com/KhronosGroup/Vulkan-Headers.git", - "upstream_VulkanMemoryAllocator": "https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git", - "upstream_watcher": "https://github.com/dart-lang/watcher.git", - "upstream_web_socket_channel": "https://github.com/dart-lang/web_socket_channel.git", - "upstream_webdev": "https://github.com/dart-lang/webdev.git", - "upstream_webkit_inspection_protocol": "https://github.com/google/webkit_inspection_protocol.dart.git", - "upstream_wuffs-mirror-release-c": "https://github.com/google/wuffs-mirror-release-c.git", - "upstream_yaml_edit": "https://github.com/dart-lang/yaml_edit.git", - "upstream_yaml": "https://github.com/dart-lang/yaml.git", - "upstream_yapf": "https://github.com/google/yapf.git", - "upstream_zlib": "https://github.com/madler/zlib.git", -} - -gclient_gn_args_file = 'src/third_party/dart/build/config/gclient_args.gni' -gclient_gn_args = [ - 'checkout_llvm' -] - -# Only these hosts are allowed for dependencies in this DEPS file. -# If you need to add a new host, contact chrome infrastructure team. -allowed_hosts = [ - 'boringssl.googlesource.com', - 'chrome-infra-packages.appspot.com', - 'chromium.googlesource.com', - 'dart.googlesource.com', - 'flutter.googlesource.com', - 'fuchsia.googlesource.com', - 'llvm.googlesource.com', - 'skia.googlesource.com', - 'swiftshader.googlesource.com', -] - -deps = { - 'src': 'https://github.com/shorebirdtech/buildroot.git' + '@' + 'd6c410f19de5947de40ce110c1e768c887870072', - - # Fuchsia compatibility - # - # The dependencies in this section should match the layout in the Fuchsia gn - # build. Eventually, we'll manage these dependencies together with Fuchsia - # and not have to specific hashes. - - 'src/third_party/rapidjson': - Var('fuchsia_git') + '/third_party/rapidjson' + '@' + 'ef3564c5c8824989393b87df25355baf35ff544b', - - 'src/third_party/harfbuzz': - Var('flutter_git') + '/third_party/harfbuzz' + '@' + '8e1629fbcf9c5b86f5574232dd271496fabaffaf', - - 'src/third_party/libcxx': - Var('llvm_git') + '/llvm-project/libcxx' + '@' + '44079a4cc04cdeffb9cfe8067bfb3c276fb2bab0', - - 'src/third_party/libcxxabi': - Var('llvm_git') + '/llvm-project/libcxxabi' + '@' + '2ce528fb5e0f92e57c97ec3ff53b75359d33af12', - - 'src/third_party/glfw': - Var('fuchsia_git') + '/third_party/glfw' + '@' + 'dd8a678a66f1967372e5a5e3deac41ebf65ee127', - - 'src/third_party/shaderc': - Var('github_git') + '/google/shaderc.git' + '@' + '7ea834ecc59258a5c13c3d3e6fa0582bdde7c543', - - 'src/third_party/vulkan-deps': - Var('chromium_git') + '/vulkan-deps' + '@' + 'a56166d59ebdb0208a7301d267460773df1a1adc', - - 'src/third_party/flatbuffers': - Var('github_git') + '/google/flatbuffers.git' + '@' + '0a80646371179f8a7a5c1f42c31ee1d44dcf6709', - - 'src/third_party/icu': - Var('chromium_git') + '/chromium/deps/icu.git' + '@' + '7698bff409f232537fb6e621a430500c0a81682f', - - 'src/third_party/khronos': - Var('chromium_git') + '/chromium/src/third_party/khronos.git' + '@' + '676d544d2b8f48903b7da9fceffaa534a5613978', - - 'src/third_party/gtest-parallel': - Var('chromium_git') + '/external/github.com/google/gtest-parallel' + '@' + '38191e2733d7cbaeaef6a3f1a942ddeb38a2ad14', - - 'src/third_party/benchmark': - Var('github_git') + '/google/benchmark' + '@' + '431abd149fd76a072f821913c0340137cc755f36', - - 'src/third_party/googletest': - Var('github_git') + '/google/googletest' + '@' + '054a986a8513149e8374fc669a5fe40117ca6b41', - - 'src/third_party/boringssl': - Var('github_git') + '/dart-lang/boringssl_gen.git' + '@' + Var('dart_boringssl_gen_rev'), - - 'src/third_party/yapf': - Var('github_git') + '/google/yapf' + '@' + '212c5b5ad8e172d2d914ae454c121c89cccbcb35', - - 'src/third_party/boringssl/src': - 'https://boringssl.googlesource.com/boringssl.git' + '@' + Var('dart_boringssl_rev'), - - 'src/third_party/perfetto': - Var('fuchsia_git') + "/third_party/android.googlesource.com/platform/external/perfetto" - + '@' + Var('dart_perfetto_rev'), - - 'src/third_party/protobuf': - Var('fuchsia_git') + '/third_party/protobuf' + '@' + Var('dart_libprotobuf_rev'), - - 'src/build/secondary/third_party/protobuf': - Var('fuchsia_git') + '/protobuf-gn' + '@' + Var('dart_protobuf_gn_rev'), - - 'src/third_party/dart': - Var('dart_git') + '/sdk.git' + '@' + Var('dart_revision'), - - # WARNING: Unused Dart dependencies in the list below till "WARNING:" marker are removed automatically - see create_updated_flutter_deps.py. - - 'src/third_party/dart/third_party/binaryen/src': - Var('chromium_git') + '/external/github.com/WebAssembly/binaryen.git@b9b5f162ca8bf5b899ff0f0351491d7d403d7ed9', - - 'src/third_party/dart/third_party/devtools': - {'packages': [{'version': 'git_revision:026f0adf03725fbab24d601ac74c811808f258e5', 'package': 'dart/third_party/flutter/devtools'}], 'dep_type': 'cipd'}, - - 'src/third_party/dart/third_party/pkg/args': - Var('dart_git') + '/args.git@5ac2ba1d93f037c7aee2975703bf071f88597a76', - - 'src/third_party/dart/third_party/pkg/async': - Var('dart_git') + '/async.git@012781315e0f4659bc8d7806352e350e8fff8048', - - 'src/third_party/dart/third_party/pkg/bazel_worker': - Var('dart_git') + '/bazel_worker.git@d5f88375b41def124aa65be1d4da8a2c9e82e076', - - 'src/third_party/dart/third_party/pkg/boolean_selector': - Var('dart_git') + '/boolean_selector.git@28dc03d893e5ac4141b48d8e7ef80eacb04de071', - - 'src/third_party/dart/third_party/pkg/browser_launcher': - Var('dart_git') + '/browser_launcher.git' + '@' + Var('dart_browser_launcher_rev'), - - 'src/third_party/dart/third_party/pkg/cli_util': - Var('dart_git') + '/cli_util.git@6c318c29c4ad0efcbe2e847dd5cebac1e379c8f5', - - 'src/third_party/dart/third_party/pkg/clock': - Var('dart_git') + '/clock.git' + '@' + Var('dart_clock_rev'), - - 'src/third_party/dart/third_party/pkg/collection': - Var('dart_git') + '/collection.git' + '@' + Var('dart_collection_rev'), - - 'src/third_party/dart/third_party/pkg/convert': - Var('dart_git') + '/convert.git@8812e4034235bf90e89eea7635e10512a35d62e6', - - 'src/third_party/dart/third_party/pkg/crypto': - Var('dart_git') + '/crypto.git@8a03816370b2f856ab52bf302472a7bf1286094d', - - 'src/third_party/dart/third_party/pkg/csslib': - Var('dart_git') + '/csslib.git@5836863a4e73da8fb88b9a65901eb653339b1196', - - 'src/third_party/dart/third_party/pkg/dart_style': - Var('dart_git') + '/dart_style.git@33efb2560c62b7b7bf330009cd757495b0e1456a', - - 'src/third_party/dart/third_party/pkg/dartdoc': - Var('dart_git') + '/dartdoc.git@1a7952b13858ed307185a28f9b4ea861c0abb1c5', - - 'src/third_party/dart/third_party/pkg/ffi': - Var('dart_git') + '/ffi.git@04fa38ab45cb2957f9059e03031b53906c2c4385', - - 'src/third_party/dart/third_party/pkg/file': - Var('dart_git') + '/external/github.com/google/file.dart@72a67c33f90bfb7e10057e286e06d2fe3baa4d98', - - 'src/third_party/dart/third_party/pkg/fixnum': - Var('dart_git') + '/fixnum.git@92ec336bbd0d03e02be0208483bdfaf68b4b6b7c', - - 'src/third_party/dart/third_party/pkg/glob': - Var('dart_git') + '/glob.git@eaa878b6af1ec7f7deeab0d2f9e830a7a7da2a8c', - - 'src/third_party/dart/third_party/pkg/html': - Var('dart_git') + '/html.git@57b747d7052aba08901adb366ffb2836facaa04d', - - 'src/third_party/dart/third_party/pkg/http': - Var('dart_git') + '/http.git@ffb44388762716f8d93aaa8541f8c5f2de159b71', - - 'src/third_party/dart/third_party/pkg/http_multi_server': - Var('dart_git') + '/http_multi_server.git@e0b5d357890eb09f0a7b3d26ddf643dee6977c4b', - - 'src/third_party/dart/third_party/pkg/http_parser': - Var('dart_git') + '/http_parser.git@bbe37dd228ec59f58a73df4b328ef747757165c7', - - 'src/third_party/dart/third_party/pkg/intl': - Var('dart_git') + '/intl.git@a958db01c90d041f0cd357d1732ae9813b620ee0', - - 'src/third_party/dart/third_party/pkg/json_rpc_2': - Var('dart_git') + '/json_rpc_2.git@5da270592006e4d43fd5a6ac736829f955881240', - - 'src/third_party/dart/third_party/pkg/linter': - Var('dart_git') + '/linter.git@c0942721fcc1feeff278f95626cb5d27a654301e', - - 'src/third_party/dart/third_party/pkg/logging': - Var('dart_git') + '/logging.git@787030a2b3d0d5d53ce57f1c7dc74f27ecb07b0b', - - 'src/third_party/dart/third_party/pkg/markdown': - Var('dart_git') + '/markdown.git@d437c85188806fe2bfa4f3616159300ba9dc6d2a', - - 'src/third_party/dart/third_party/pkg/matcher': - Var('dart_git') + '/matcher.git@cb6b68c603d2c57a51bbddfff08fa211bba7dcd3', - - 'src/third_party/dart/third_party/pkg/mime': - Var('dart_git') + '/mime.git@2d8496df6a6e851816610c3f99eae0d9663f54c4', - - 'src/third_party/dart/third_party/pkg/mockito': - Var('dart_git') + '/mockito.git@28e8eda2ef16f2e9c5e2e8fef48a834afd33ce44', - - 'src/third_party/dart/third_party/pkg/package_config': - Var('dart_git') + '/package_config.git@7e09db12e968482ef81e309de3ce233463b4cd7e', - - 'src/third_party/dart/third_party/pkg/path': - Var('dart_git') + '/path.git@23e33194c4073c0fdd818a70dd944afd5ad206e6', - - 'src/third_party/dart/third_party/pkg/pool': - Var('dart_git') + '/pool.git@650e5d3eff10529c65ef45b5fcb4bca270c7ea8f', - - 'src/third_party/dart/third_party/pkg/protobuf': - Var('dart_git') + '/protobuf.git' + '@' + Var('dart_protobuf_rev'), - - 'src/third_party/dart/third_party/pkg/pub': - Var('dart_git') + '/pub.git' + '@' + Var('dart_pub_rev'), - - 'src/third_party/dart/third_party/pkg/pub_semver': - Var('dart_git') + '/pub_semver.git@860e3d825ff7ff9f3422091fe5948f5fd0fb0dcd', - - 'src/third_party/dart/third_party/pkg/shelf': - Var('dart_git') + '/shelf.git@9a792b49f07bd9d310d83cd103035cc60a9956af', - - 'src/third_party/dart/third_party/pkg/source_map_stack_trace': - Var('dart_git') + '/source_map_stack_trace.git@08a81a81710fe1442a705c5761bccf3280940a9c', - - 'src/third_party/dart/third_party/pkg/source_maps': - Var('dart_git') + '/source_maps.git@0a4b030b381996c203f054f4f3f93cd256fec83a', - - 'src/third_party/dart/third_party/pkg/source_span': - Var('dart_git') + '/source_span.git@b739fbf161e0b3058d6fda6f95953b359afdd0fb', - - 'src/third_party/dart/third_party/pkg/sse': - Var('dart_git') + '/sse.git@11e83a0810c06b6f468ca8f50117ab97fcf9c92e', - - 'src/third_party/dart/third_party/pkg/stack_trace': - Var('dart_git') + '/stack_trace.git@9c1b1c506053e98602957b79f45930b31ffdba29', - - 'src/third_party/dart/third_party/pkg/stream_channel': - Var('dart_git') + '/stream_channel.git@74646ea6d87cf3b3ef5b08656b2afd326e4e5beb', - - 'src/third_party/dart/third_party/pkg/string_scanner': - Var('dart_git') + '/string_scanner.git@f7a656fdaaab069fc6f8c9d34d3205ce6100dfb1', - - 'src/third_party/dart/third_party/pkg/term_glyph': - Var('dart_git') + '/term_glyph.git@f6856e264f8f88309be36a7eed6defce2ab38b24', - - 'src/third_party/dart/third_party/pkg/test': - Var('dart_git') + '/test.git@8ea42987b0fee4a31ec97c101d0c66a461bf18f3', - - 'src/third_party/dart/third_party/pkg/test_reflective_loader': - Var('dart_git') + '/test_reflective_loader.git@a85a930ad3736f93b96f6cc104d3576c1ae19e0e', - - 'src/third_party/dart/third_party/pkg/tools': - Var('dart_git') + '/tools.git@0304fbbb42989abd9ab6bbdfad26d830c96a7574', - - 'src/third_party/dart/third_party/pkg/typed_data': - Var('dart_git') + '/typed_data.git@d85363d2efb333afce07ec409a529ec32986e1a2', - - 'src/third_party/dart/third_party/pkg/usage': - Var('dart_git') + '/usage.git@0698711985b332432ce9a901bbbd3b1ed227b090', - - 'src/third_party/dart/third_party/pkg/watcher': - Var('dart_git') + '/watcher.git' + '@' + Var('dart_watcher_rev'), - - 'src/third_party/dart/third_party/pkg/web_socket_channel': - Var('dart_git') + '/web_socket_channel.git@40eb2360e10595c2eab33cf61439c45708eb8d29', - - 'src/third_party/dart/third_party/pkg/webdev': - Var('dart_git') + '/webdev.git' + '@' + Var('dart_webdev_rev'), - - 'src/third_party/dart/third_party/pkg/webkit_inspection_protocol': - Var('dart_git') + '/external/github.com/google/webkit_inspection_protocol.dart.git' + '@' + Var('dart_webkit_inspection_protocol_rev'), - - 'src/third_party/dart/third_party/pkg/yaml': - Var('dart_git') + '/yaml.git@56dfaf4fb021ac1c0f1a469e7c8e71ea4f7add2f', - - 'src/third_party/dart/third_party/pkg/yaml_edit': - Var('dart_git') + '/yaml_edit.git' + '@' + Var('dart_yaml_edit_rev'), - - 'src/third_party/dart/tools/sdks': - {'packages': [{'version': 'version:3.0.0-369.0.dev', 'package': 'dart/dart-sdk/${{platform}}'}], 'dep_type': 'cipd'}, - - # WARNING: end of dart dependencies list that is cleaned up automatically - see create_updated_flutter_deps.py. - - # Prebuilt Dart SDK of the same revision as the Dart SDK source checkout - 'src/flutter/prebuilts/linux-x64/dart-sdk': { - 'packages': [ - { - 'package': 'flutter/dart-sdk/linux-amd64', - 'version': 'git_revision:'+Var('dart_revision') - } - ], - 'dep_type': 'cipd', - 'condition': 'host_os == "linux" and download_dart_sdk' - }, - 'src/flutter/prebuilts/linux-arm64/dart-sdk': { - 'packages': [ - { - 'package': 'flutter/dart-sdk/linux-arm64', - 'version': 'git_revision:'+Var('dart_revision') - } - ], - 'dep_type': 'cipd', - 'condition': 'host_os == "linux" and download_dart_sdk' - }, - 'src/flutter/prebuilts/macos-x64/dart-sdk': { - 'packages': [ - { - 'package': 'flutter/dart-sdk/mac-amd64', - 'version': 'git_revision:'+Var('dart_revision') - } - ], - 'dep_type': 'cipd', - 'condition': 'host_os == "mac" and download_dart_sdk' - }, - 'src/flutter/prebuilts/macos-arm64/dart-sdk': { - 'packages': [ - { - 'package': 'flutter/dart-sdk/mac-arm64', - 'version': 'git_revision:'+Var('dart_revision') - } - ], - 'dep_type': 'cipd', - 'condition': 'host_os == "mac" and download_dart_sdk' - }, - 'src/flutter/prebuilts/windows-x64/dart-sdk': { - 'packages': [ - { - 'package': 'flutter/dart-sdk/windows-amd64', - 'version': 'git_revision:'+Var('dart_revision') - } - ], - 'dep_type': 'cipd', - 'condition': 'host_os == "win" and download_dart_sdk' - }, - 'src/flutter/prebuilts/windows-arm64/dart-sdk': { - 'packages': [ - { - 'package': 'flutter/dart-sdk/windows-arm64', - 'version': 'git_revision:'+Var('dart_revision') - } - ], - 'dep_type': 'cipd', - 'condition': 'host_os == "win" and download_dart_sdk and not release_candidate' - }, - - 'src/third_party/colorama/src': - Var('chromium_git') + '/external/colorama.git' + '@' + '799604a1041e9b3bc5d2789ecbd7e8db2e18e6b8', - - 'src/third_party/expat': - Var('chromium_git') + '/external/github.com/libexpat/libexpat.git' + '@' + '654d2de0da85662fcc7644a7acd7c2dd2cfb21f0', - - 'src/third_party/freetype2': - Var('flutter_git') + '/third_party/freetype2' + '@' + '3bea2761290a1cbe7d8f75c1c5a7ad727f826a66', - - 'src/third_party/root_certificates': - Var('dart_git') + '/root_certificates.git' + '@' + Var('dart_root_certificates_rev'), - - 'src/third_party/skia': - Var('skia_git') + '/skia.git' + '@' + Var('skia_revision'), - - 'src/third_party/ocmock': - Var('ocmock_git') + '@' + Var('ocmock_rev'), - - 'src/third_party/updater': - Var('updater_git') + '@' + Var('updater_rev'), - - 'src/third_party/libjpeg-turbo': - Var('fuchsia_git') + '/third_party/libjpeg-turbo' + '@' + '0fb821f3b2e570b2783a94ccd9a2fb1f4916ae9f', - - 'src/third_party/libpng': - Var('flutter_git') + '/third_party/libpng' + '@' + '9187b6e12756317f6d44fc669ac11dfc262bd192', - - 'src/third_party/libwebp': - Var('chromium_git') + '/webm/libwebp.git' + '@' + '7dfde712a477e420968732161539011e0fd446cf', # 1.2.0 - - 'src/third_party/wuffs': - Var('skia_git') + '/external/github.com/google/wuffs-mirror-release-c.git' + '@' + '600cd96cf47788ee3a74b40a6028b035c9fd6a61', - - 'src/third_party/fontconfig/src': - Var('chromium_git') + '/external/fontconfig.git' + '@' + 'c336b8471877371f0190ba06f7547c54e2b890ba', - - 'src/third_party/fontconfig': - Var('flutter_git') + '/third_party/fontconfig' + '@' + '81c83d510ae3aa75589435ce32a5de05139aacb0', - - 'src/third_party/libxml': - Var('flutter_git') + '/third_party/libxml' + '@' + 'a143e452b5fc7d872813eeadc8db421694058098', - - 'src/third_party/zlib': - Var('chromium_git') + '/chromium/src/third_party/zlib.git' + '@' + Var('dart_zlib_rev'), - - 'src/third_party/inja': - Var('flutter_git') + '/third_party/inja' + '@' + '88bd6112575a80d004e551c98cf956f88ff4d445', - - 'src/third_party/libtess2': - Var('flutter_git') + '/third_party/libtess2' + '@' + '725e5e08ec8751477565f1d603fd7eb9058c277c', - - 'src/third_party/sqlite': - Var('flutter_git') + '/third_party/sqlite' + '@' + '0f61bd2023ba94423b4e4c8cfb1a23de1fe6a21c', - - 'src/third_party/pyyaml': - Var('fuchsia_git') + '/third_party/pyyaml.git' + '@' + '25e97546488eee166b1abb229a27856cecd8b7ac', - - # Upstream Khronos Vulkan Headers are part of vulkan-deps - # Downstream Fuchsia Vulkan Headers (v1.2.198) - 'src/third_party/fuchsia-vulkan': - Var('fuchsia_git') + '/third_party/Vulkan-Headers.git' + '@' + '32640ad82ef648768c706c9bf828b77123a09bc2', - - 'src/third_party/swiftshader': - Var('swiftshader_git') + '/SwiftShader.git' + '@' + '5f9ed9b16931c7155171d31f75004f73f0a3abc8', - - 'src/third_party/angle': - Var('chromium_git') + '/angle/angle.git' + '@' + '32175d8a6dc185dd850e5c9988f208085c9c0d80', - - 'src/third_party/vulkan_memory_allocator': - Var('chromium_git') + '/external/github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator' + '@' + '7de5cc00de50e71a3aab22dea52fbb7ff4efceb6', - - 'src/third_party/abseil-cpp': - Var('flutter_git') + '/third_party/abseil-cpp.git' + '@' + '61833f2c057a2b1993d871e8c51156aed1dd4354', - - # Dart packages - 'src/third_party/pkg/archive': - Var('github_git') + '/brendan-duncan/archive.git' + '@' + '9de7a0544457c6aba755ccb65abb41b0dc1db70d', # 3.1.2 - - 'src/third_party/pkg/equatable': - Var('github_git') + '/felangel/equatable.git' + '@' + '0ba67c72db8bed75877fc1caafa74112ee0bd921', # 2.0.2 - - 'src/third_party/pkg/file': - Var('dart_git') + '/external/github.com/google/file.dart.git' + '@' + 'b2e31cb6ef40b223701dbfa0b907fe58468484d7', # 6.1.4 - - 'src/third_party/pkg/flutter_packages': - Var('github_git') + '/flutter/packages.git' + '@' + '25454e63851fe7933f04d025606e68c1eac4fe0f', # various - - 'src/third_party/pkg/gcloud': - Var('github_git') + '/dart-lang/gcloud.git' + '@' + 'a5276b85c4714378e84b1fb478b8feeeb686ac26', # 0.8.6-dev - - 'src/third_party/pkg/googleapis': - Var('github_git') + '/google/googleapis.dart.git' + '@' + '526011f56d98eab183cc6075ee1392e8303e43e2', # various - - 'src/third_party/pkg/platform': - Var('github_git') + '/google/platform.dart.git' + '@' + '1ffad63428bbd1b3ecaa15926bacfb724023648c', # 3.1.0 - - 'src/third_party/pkg/process': - Var('github_git') + '/google/process.dart.git' + '@' + '0c9aeac86dcc4e3a6cf760b76fed507107e244d5', # 4.2.1 - - 'src/third_party/pkg/process_runner': - Var('github_git') + '/google/process_runner.git' + '@' + 'd632ea0bfd814d779fcc53a361ed33eaf3620a0b', # 4.0.1 - - 'src/third_party/pkg/quiver': - Var('github_git') + '/google/quiver-dart.git' + '@' + '90b92bee895e507d435012356a8b5c5f17eafa52', # 3.2.1 - - 'src/third_party/pkg/vector_math': - Var('dart_git') + '/external/github.com/google/vector_math.dart.git' + '@' + '0a5fd95449083d404df9768bc1b321b88a7d2eef', # 2.1.0 - - 'src/third_party/imgui': - Var('github_git') + '/ocornut/imgui.git' + '@' + '3ea0fad204e994d669f79ed29dcaf61cd5cb571d', - - 'src/third_party/tinygltf': - Var('github_git') + '/syoyo/tinygltf.git' + '@' + '9bb5806df4055ac973b970ba5b3e27ce27d98148', - - 'src/third_party/json': - Var('github_git') + '/nlohmann/json.git' + '@' + '17d9eacd248f58b73f4d1be518ef649fe2295642', - - 'src/third_party/gradle': { - 'packages': [ - { - 'version': 'version:7.0.2', - 'package': 'flutter/gradle' - } - ], - 'condition': 'download_android_deps', - 'dep_type': 'cipd' - }, - - 'src/third_party/android_tools/trace_to_text': { - 'packages': [ - { - # 25.0 downloads for both mac-amd64 and mac-arm64 - # 26.1 is not found with either platform - # 27.1 is the latest release of perfetto - 'version': 'git_tag:v25.0', - 'package': 'perfetto/trace_to_text/${{platform}}' - } - ], - 'condition': 'download_android_deps', - 'dep_type': 'cipd' - }, - - 'src/third_party/android_tools/google-java-format': { - 'packages': [ - { - 'package': 'flutter/android/google-java-format', - 'version': 'version:1.7-1' - } - ], - # We want to be able to format these as part of CI, and the CI step that - # checks formatting runs without downloading the rest of the Android build - # tooling. Therefore unlike all the other Android-related tools, we want to - # download this every time. - 'dep_type': 'cipd', - }, - - 'src/third_party/android_tools': { - 'packages': [ - { - 'package': 'flutter/android/sdk/all/${{platform}}', - 'version': 'version:33v6' - } - ], - 'condition': 'download_android_deps', - 'dep_type': 'cipd', - }, - - 'src/third_party/android_embedding_dependencies': { - 'packages': [ - { - 'package': 'flutter/android/embedding_bundle', - 'version': 'last_updated:2021-11-23T12:31:07-0800' - } - ], - 'condition': 'download_android_deps', - 'dep_type': 'cipd', - }, - - 'src/third_party/web_dependencies': { - 'packages': [ - { - 'package': 'flutter/web/canvaskit_bundle', - 'version': Var('canvaskit_cipd_instance') - } - ], - 'dep_type': 'cipd', - }, - - 'src/third_party/java/openjdk': { - 'packages': [ - { - 'package': 'flutter/java/openjdk/${{platform}}', - 'version': 'version:11' - } - ], - 'condition': 'download_android_deps', - 'dep_type': 'cipd', - }, - - 'src/flutter/third_party/gn': { - 'packages': [ - { - 'package': 'gn/gn/${{platform}}', - 'version': 'git_revision:b79031308cc878488202beb99883ec1f2efd9a6d' - }, - ], - 'dep_type': 'cipd', - }, - 'src/flutter/third_party/ninja': { - 'packages': [ - { - 'package': 'infra/3pp/tools/ninja/${{platform}}', - 'version': 'version:2@1.11.1.chromium.4', - } - ], - 'dep_type': 'cipd', - }, - - 'src/buildtools/emsdk': { - 'url': Var('skia_git') + '/external/github.com/emscripten-core/emsdk.git' + '@' + 'fc645b7626ebf86530dbd82fbece74d457e7ae07', - 'condition': 'download_emsdk', - }, - - # Clang on mac and linux are expected to typically be the same revision. - # They are separated out so that the autoroller can more easily manage them. - 'src/buildtools/mac-x64/clang': { - 'packages': [ - { - 'package': 'fuchsia/third_party/clang/mac-amd64', - 'version': Var('clang_version'), - } - ], - 'condition': 'host_os == "mac"', # On ARM64 Macs too because Goma doesn't support the host-arm64 toolchain. - 'dep_type': 'cipd', - }, - - 'src/buildtools/mac-arm64/clang': { - 'packages': [ - { - 'package': 'fuchsia/third_party/clang/mac-arm64', - 'version': Var('clang_version'), - } - ], - 'condition': 'host_os == "mac" and host_cpu == "arm64"', - 'dep_type': 'cipd', - }, - - 'src/buildtools/linux-x64/clang': { - 'packages': [ - { - 'package': 'fuchsia/third_party/clang/linux-amd64', - 'version': Var('clang_version'), - } - ], - 'condition': 'host_os == "linux" and host_cpu == "x64"', - 'dep_type': 'cipd', - }, - - 'src/buildtools/linux-arm64/clang': { - 'packages': [ - { - 'package': 'fuchsia/third_party/clang/linux-arm64', - 'version': Var('clang_version'), - } - ], - 'condition': 'host_os == "linux" and host_cpu == "arm64"', - 'dep_type': 'cipd', - }, - - 'src/buildtools/windows-x64/clang': { - 'packages': [ - { - 'package': 'fuchsia/third_party/clang/windows-amd64', - 'version': Var('clang_version'), - } - ], - 'condition': 'download_windows_deps', - 'dep_type': 'cipd', - }, - - # Get the SDK from https://chrome-infra-packages.appspot.com/p/fuchsia/sdk/core at the 'latest' tag - # Get the toolchain from https://chrome-infra-packages.appspot.com/p/fuchsia/clang at the 'goma' tag - - 'src/fuchsia/sdk/mac': { - 'packages': [ - { - 'package': 'fuchsia/sdk/core/mac-amd64', - 'version': 'f16HBH4MJdaKy7HlfDR0naUyEH1SZ0DUJINh2WDEYaYC' - } - ], - 'condition': 'host_os == "mac" and not download_fuchsia_sdk', - 'dep_type': 'cipd', - }, - 'src/fuchsia/sdk/linux': { - 'packages': [ - { - 'package': 'fuchsia/sdk/core/linux-amd64', - 'version': 'rQKj0gZPJNATiErM86LM5BALaHqREfrozRBvIuYO9u0C' - } - ], - 'condition': 'host_os == "linux" and not download_fuchsia_sdk', - 'dep_type': 'cipd', - }, -} - -recursedeps = [ - 'src/third_party/vulkan-deps', -] - -hooks = [ - { - # Generate the Dart SDK's .dart_tool/package_confg.json file. - 'name': 'Generate .dart_tool/package_confg.json', - 'pattern': '.', - 'action': ['python3', 'src/third_party/dart/tools/generate_package_config.py'], - }, - { - # Generate the sdk/version file. - 'name': 'Generate sdk/version', - 'pattern': '.', - 'action': ['python3', 'src/third_party/dart/tools/generate_sdk_version_file.py'], - }, - { - # Update the Windows toolchain if necessary. - 'name': 'win_toolchain', - 'condition': 'download_windows_deps', - 'pattern': '.', - 'action': ['python3', 'src/build/vs_toolchain.py', 'update'], - }, - { - # Ensure that we don't accidentally reference any .pyc files whose - # corresponding .py files have already been deleted. - 'name': 'remove_stale_pyc_files', - 'pattern': 'src/tools/.*\\.py', - 'action': [ - 'python3', - 'src/tools/remove_stale_pyc_files.py', - 'src/tools', - ], - }, - { - 'name': 'dia_dll', - 'pattern': '.', - 'condition': 'download_windows_deps', - 'action': [ - 'python3', - 'src/flutter/tools/dia_dll.py', - ], - }, - { - 'name': 'linux_sysroot_x64', - 'pattern': '.', - 'condition': 'download_linux_deps', - 'action': [ - 'python3', - 'src/build/linux/sysroot_scripts/install-sysroot.py', - '--arch=x64'], - }, - { - 'name': 'linux_sysroot_arm64', - 'pattern': '.', - 'condition': 'download_linux_deps', - 'action': [ - 'python3', - 'src/build/linux/sysroot_scripts/install-sysroot.py', - '--arch=arm64'], - }, - { - 'name': 'pub get --offline', - 'pattern': '.', - 'action': [ - 'python3', - 'src/flutter/tools/pub_get_offline.py', - ] - }, - { - 'name': 'Download Fuchsia SDK', - 'pattern': '.', - 'condition': 'download_fuchsia_sdk', - 'action': [ - 'python3', - 'src/flutter/tools/download_fuchsia_sdk.py', - '--fail-loudly', - '--verbose', - '--host-os', - Var('host_os'), - '--fuchsia-sdk-path', - Var('fuchsia_sdk_path'), - ] - }, - { - 'name': 'Activate Emscripten SDK', - 'pattern': '.', - 'condition': 'download_emsdk', - 'action': [ - 'python3', - 'src/flutter/tools/activate_emsdk.py', - ] - }, - { - 'name': 'Setup githooks', - 'pattern': '.', - 'condition': 'setup_githooks', - 'action': [ - 'python3', - 'src/flutter/tools/githooks/setup.py', - ] - } -] diff --git a/packages/cutler/test/model_test.dart b/packages/cutler/test/model_test.dart deleted file mode 100644 index bbcb37cf..00000000 --- a/packages/cutler/test/model_test.dart +++ /dev/null @@ -1,121 +0,0 @@ -import 'package:cutler/model.dart'; -import 'package:test/test.dart'; - -void main() { - test('Version', () { - const one = Version( - repo: Repo.flutter, - hash: 'abc123', - ); - const two = Version( - repo: Repo.flutter, - hash: 'abc123', - aliases: ['foo', 'bar'], - ); - const three = Version( - repo: Repo.flutter, - hash: 'def456', - ); - expect(one, equals(two)); - expect(one, isNot(equals(three))); - expect(one.hashCode, equals(two.hashCode)); - expect(one.hashCode, isNot(equals(three.hashCode))); - - expect(one.ref, equals('abc123')); - expect(two.ref, equals('foo')); - expect(three.ref, equals('def456')); - - expect(one.toString(), equals('abc123')); - expect(two.toString(), equals('abc123 (foo, bar)')); - expect(three.toString(), equals('def456')); - }); - - test('VersionSet', () { - const one = VersionSet( - engine: Version( - repo: Repo.engine, - hash: 'e1', - ), - flutter: Version( - repo: Repo.flutter, - hash: 'f1', - ), - buildroot: Version( - repo: Repo.buildroot, - hash: 'b1', - ), - dart: Version( - repo: Repo.dart, - hash: 'd1', - ), - ); - final two = one.copyWith( - engine: const Version( - repo: Repo.engine, - hash: 'e2', - ), - flutter: const Version( - repo: Repo.flutter, - hash: 'f2', - ), - buildroot: const Version( - repo: Repo.buildroot, - hash: 'b2', - ), - dart: const Version( - repo: Repo.dart, - hash: 'd2', - ), - ); - expect(one, isNot(equals(two))); - expect(one.hashCode, isNot(equals(two.hashCode))); - expect( - one[Repo.engine], - equals(const Version(repo: Repo.engine, hash: 'e1')), - ); - expect( - one[Repo.flutter], - equals(const Version(repo: Repo.flutter, hash: 'f1')), - ); - expect( - one[Repo.buildroot], - equals(const Version(repo: Repo.buildroot, hash: 'b1')), - ); - expect(one[Repo.dart], equals(const Version(repo: Repo.dart, hash: 'd1'))); - expect( - two[Repo.engine], - equals(const Version(repo: Repo.engine, hash: 'e2')), - ); - expect( - two[Repo.flutter], - equals(const Version(repo: Repo.flutter, hash: 'f2')), - ); - expect( - two[Repo.buildroot], - equals(const Version(repo: Repo.buildroot, hash: 'b2')), - ); - expect(two[Repo.dart], equals(const Version(repo: Repo.dart, hash: 'd2'))); - final three = one.copyWith(); - expect(one, equals(three)); - expect(one.hashCode, equals(three.hashCode)); - }); - - test('Repo', () { - expect(Repo.engine.name, equals('engine')); - expect(Repo.engine.path, equals('engine/src/flutter')); - expect(Repo.engine.directDependencies, equals({Repo.dart, Repo.buildroot})); - expect(Repo.engine.dependencies, equals({Repo.dart, Repo.buildroot})); - - expect(Repo.dart.name, equals('dart')); - expect(Repo.dart.path, equals('engine/src/third_party/dart')); - expect(Repo.dart.directDependencies, isEmpty); - expect(Repo.dart.dependencies, isEmpty); - - expect(Repo.shorebird.name, equals('shorebird')); - expect(Repo.shorebird.directDependencies, equals({Repo.flutter})); - expect( - Repo.shorebird.dependencies, - equals({Repo.flutter, Repo.engine, Repo.dart, Repo.buildroot}), - ); - }); -} diff --git a/packages/cutler/test/versions_test.dart b/packages/cutler/test/versions_test.dart deleted file mode 100644 index 8089015b..00000000 --- a/packages/cutler/test/versions_test.dart +++ /dev/null @@ -1,24 +0,0 @@ -import 'dart:io'; - -import 'package:cutler/versions.dart'; -import 'package:test/test.dart'; - -void main() { - test('parseBuildrootVersion', () { - final depsContents = File('test/fixtures/DEPS').readAsStringSync(); - final buildrootHash = parseBuildrootRevision(depsContents); - expect(buildrootHash, 'd6c410f19de5947de40ce110c1e768c887870072'); - expect(() => parseBuildrootRevision(''), throwsException); - expect( - () => parseBuildrootRevision( - "'src': 'https://github.com/flutter/buildroot.git'", - ), - throwsException, - ); - }); - test('parseDartVersion', () { - final depsContents = File('test/fixtures/DEPS').readAsStringSync(); - final dartHash = parseDartRevision(depsContents); - expect(dartHash, '7a6514d1377175decd3a886fe4190fbbebddac3a'); - }); -}