From 89cc735f59f5efd5e76f386d00f209e3b7b132b0 Mon Sep 17 00:00:00 2001 From: Vyacheslav Egorov Date: Thu, 24 May 2018 23:58:58 +0200 Subject: [PATCH] Generate .packages for both flutter_kernel_transformers and frontend_server in the same way (flutter/engine#5362) * Generate .packages for both flutter_kernel_transformers and frontend_server in the same way * Generate more precise .packages --- DEPS | 6 +- .../flutter_kernel_transformers/pubspec.yaml | 99 ------------------- .../flutter/tools/frontend_server_packages.py | 26 ----- .../flutter/tools/generate_package_files.py | 38 +++++++ 4 files changed, 41 insertions(+), 128 deletions(-) delete mode 100644 engine/src/flutter/tools/frontend_server_packages.py create mode 100644 engine/src/flutter/tools/generate_package_files.py diff --git a/DEPS b/DEPS index 797656e265..d674e4d206 100644 --- a/DEPS +++ b/DEPS @@ -420,10 +420,10 @@ hooks = [ 'action': ['python', 'src/tools/dart/update.py'], }, { - 'name': 'frontend_server_packages', + 'name': 'generate_package_files', 'pattern': '.', - 'cwd': 'src/flutter/frontend_server/', - 'action': ['python', '../tools/frontend_server_packages.py'], + 'cwd': 'src/', + 'action': ['python', 'flutter/tools/generate_package_files.py'], }, { # Ensure that we don't accidentally reference any .pyc files whose diff --git a/engine/src/flutter/flutter_kernel_transformers/pubspec.yaml b/engine/src/flutter/flutter_kernel_transformers/pubspec.yaml index 65b2734b5c..e23088b859 100644 --- a/engine/src/flutter/flutter_kernel_transformers/pubspec.yaml +++ b/engine/src/flutter/flutter_kernel_transformers/pubspec.yaml @@ -11,102 +11,3 @@ dependencies: dev_dependencies: test: any when: any - -dependency_overrides: - args: - path: ../../third_party/dart/third_party/pkg/args - async: - path: ../../third_party/dart/third_party/pkg/async - charcode: - path: ../../third_party/dart/third_party/pkg/charcode - collection: - path: ../../third_party/dart/third_party/pkg/collection - convert: - path: ../../third_party/dart/third_party/pkg/convert - crypto: - path: ../../third_party/dart/third_party/pkg/crypto - front_end: - path: ../../third_party/dart/pkg/front_end/ - kernel: - path: ../../third_party/dart/pkg/kernel/ - logging: - path: ../../third_party/dart/third_party/pkg/logging - meta: - path: ../../third_party/dart/pkg/meta - quiver: - path: ../../third_party/dart/third_party/pkg/quiver - package_config: - path: ../../third_party/dart/third_party/pkg_tested/package_config - path: - path: ../../third_party/dart/third_party/pkg/path - source_span: - path: ../../third_party/dart/third_party/pkg/source_span - typed_data: - path: ../../third_party/dart/third_party/pkg/typed_data - usage: - path: ../../third_party/dart/third_party/pkg/usage - vm: - path: ../../third_party/dart/pkg/vm/ - - analyzer: - path: ../../third_party/dart/pkg/analyzer - boolean_selector: - path: ../../third_party/dart/third_party/pkg/boolean_selector - cli_util: - path: ../../third_party/dart/third_party/pkg/cli_util - csslib: - path: ../../third_party/dart/third_party/pkg/csslib - glob: - path: ../../third_party/dart/third_party/pkg/glob - html: - path: ../../third_party/dart/third_party/pkg/html - http: - path: ../../third_party/dart/third_party/pkg/http - http_multi_server: - path: ../../third_party/dart/third_party/pkg/http_multi_server - http_parser: - path: ../../third_party/dart/third_party/pkg/http_parser - matcher: - path: ../../third_party/dart/third_party/pkg/matcher - mime: - path: ../../third_party/dart/third_party/pkg/mime - mockito: - path: ../../third_party/dart/third_party/pkg/mockito - package_resolver: - path: ../../third_party/dart/third_party/pkg_tested/package_resolver - plugin: - path: ../../third_party/dart/third_party/pkg/plugin - pool: - path: ../../third_party/dart/third_party/pkg/pool - pub_semver: - path: ../../third_party/dart/third_party/pkg/pub_semver - shelf: - path: ../../third_party/dart/third_party/pkg/shelf - shelf_packages_handler: - path: ../../third_party/dart/third_party/pkg/shelf_packages_handler - shelf_static: - path: ../../third_party/dart/third_party/pkg/shelf_static - shelf_web_socket: - path: ../../third_party/dart/third_party/pkg/shelf_web_socket - source_map_stack_trace: - path: ../../third_party/dart/third_party/pkg/source_map_stack_trace - source_maps: - path: ../../third_party/dart/third_party/pkg/source_maps - stack_trace: - path: ../../third_party/dart/third_party/pkg/stack_trace - stream_channel: - path: ../../third_party/dart/third_party/pkg/stream_channel - string_scanner: - path: ../../third_party/dart/third_party/pkg/string_scanner - test: - path: ../../third_party/dart/third_party/pkg/test - utf: - path: ../../third_party/dart/third_party/pkg/utf - watcher: - path: ../../third_party/dart/third_party/pkg/watcher - web_socket_channel: - path: ../../third_party/dart/third_party/pkg/web_socket_channel - when: - path: ../../third_party/pkg/when - yaml: - path: ../../third_party/dart/third_party/pkg/yaml diff --git a/engine/src/flutter/tools/frontend_server_packages.py b/engine/src/flutter/tools/frontend_server_packages.py deleted file mode 100644 index 1c2bbe28c5..0000000000 --- a/engine/src/flutter/tools/frontend_server_packages.py +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env python -# Copyright 2018 The Flutter Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# This script generates .packages file for frontend server from -# Dart SDKs .packages file located in third_party/dart/.packages - -import os -import shutil - -DOT_PACKAGES = '.packages' -FRONTEND_SERVER_DIR = os.getcwd() -SRC_DIR = os.path.dirname(os.path.dirname(FRONTEND_SERVER_DIR)) -DART_PACKAGES_FILE = os.path.join(SRC_DIR, 'third_party', 'dart', DOT_PACKAGES) - -with open(DOT_PACKAGES, 'w') as packages: - with open(DART_PACKAGES_FILE, 'r') as dart_packages: - for line in dart_packages: - if line.startswith('#'): - packages.write(line) - else: - [package, path] = line.split(':', 1) - packages.write('%s:../../third_party/dart/%s' % (package, path)) - packages.write('frontend_server:./lib\n') - packages.write('flutter_kernel_transformers:../flutter_kernel_transformers/lib\n') diff --git a/engine/src/flutter/tools/generate_package_files.py b/engine/src/flutter/tools/generate_package_files.py new file mode 100644 index 0000000000..b32044d272 --- /dev/null +++ b/engine/src/flutter/tools/generate_package_files.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python +# Copyright 2018 The Flutter Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# This script generates .packages file for frontend_server and +# flutter_kernel_transformers from Dart SDKs .packages file located in +# third_party/dart/.packages + +import os +import shutil + +ALL_PACKAGES = { + 'frontend_server': ['flutter_kernel_transformers'], + 'flutter_kernel_transformers': [], +} + +SRC_DIR = os.getcwd() + +DOT_PACKAGES = '.packages' +DART_PACKAGES_FILE = os.path.join(SRC_DIR, 'third_party', 'dart', DOT_PACKAGES) + +# Generate .packages file in the given package. +def GeneratePackages(package, local_deps): + with open(os.path.join('flutter', package, DOT_PACKAGES), 'w') as packages: + with open(DART_PACKAGES_FILE, 'r') as dart_packages: + for line in dart_packages: + if line.startswith('#'): + packages.write(line) + else: + [name, path] = line.split(':', 1) + packages.write('%s:../../third_party/dart/%s' % (name, path)) + packages.write('%s:./lib\n' % (package)) + for other_package in local_deps: + packages.write('%s:../%s/lib\n' % (other_package, other_package)) + +for package, local_deps in ALL_PACKAGES.iteritems(): + GeneratePackages(package, local_deps)