From 092e19a7caead03d25b161f33cff6ca520630aac Mon Sep 17 00:00:00 2001 From: William Hesse Date: Fri, 22 Mar 2024 11:59:12 +0100 Subject: [PATCH] Migrate Dart dependency roller to new location of Dart SDK in checkout (#830) This change will need to be landed when moving the position of the Dart SDK source checkout from [buildroot]/third_party/dart to [flutter_engine]/third_party/dart in a Flutter engine source checkout. It cannot be landed before that point. This script copies changed pinned dependencies from the Dart DEPS to the Flutter engine DEPS, when rolling a new version of Dart into engine. Bug: https://github.com/flutter/flutter/issues/143335 --- tools/dart/create_updated_flutter_deps.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tools/dart/create_updated_flutter_deps.py b/tools/dart/create_updated_flutter_deps.py index 838488c63c..2f51a97440 100755 --- a/tools/dart/create_updated_flutter_deps.py +++ b/tools/dart/create_updated_flutter_deps.py @@ -15,8 +15,9 @@ import sys DART_SCRIPT_DIR = os.path.dirname(sys.argv[0]) -DART_ROOT = os.path.realpath(os.path.join(DART_SCRIPT_DIR, '../../third_party/dart')) -FLUTTER_ROOT = os.path.realpath(os.path.join(DART_SCRIPT_DIR, '../../flutter')) +OLD_DART_DEPS = os.path.realpath(os.path.join(DART_SCRIPT_DIR, '../../third_party/dart/DEPS')) +DART_DEPS = os.path.realpath(os.path.join(DART_SCRIPT_DIR, '../../flutter/third_party/dart/DEPS')) +FLUTTER_DEPS = os.path.realpath(os.path.join(DART_SCRIPT_DIR, '../../flutter/DEPS')) class VarImpl(object): def __init__(self, local_scope): @@ -56,15 +57,17 @@ def ParseArgs(args): parser.add_argument('--dart_deps', '-d', type=str, help='Dart DEPS file.', - default=os.path.join(DART_ROOT, 'DEPS')) + default=DART_DEPS) parser.add_argument('--flutter_deps', '-f', type=str, help='Flutter DEPS file.', - default=os.path.join(FLUTTER_ROOT, 'DEPS')) + default=FLUTTER_DEPS) return parser.parse_args(args) def Main(argv): args = ParseArgs(argv) + if args.dart_deps == DART_DEPS and not os.path.isfile(DART_DEPS): + args.dart_deps = OLD_DART_DEPS (new_vars, new_deps) = ParseDepsFile(args.dart_deps) (old_vars, old_deps) = ParseDepsFile(args.flutter_deps) @@ -104,7 +107,8 @@ def Main(argv): while i < len(lines) and (lines[i].startswith(" # WARNING: end of dart dependencies") == 0): i = i + 1 for (k, v) in sorted(old_deps.items()): - if (k.startswith('src/third_party/dart/')): + if (k.startswith('src/flutter/third_party/dart/') or + k.startswith('src/third_party/dart/')): for (dart_k, dart_v) in (list(new_deps.items())): dart_k_suffix = dart_k[len('sdk/') if dart_k.startswith('sdk/') else 0:] if (k.endswith(dart_k_suffix)):