-
Notifications
You must be signed in to change notification settings - Fork 6k
Create a package-able incremental compiler #12681
Changes from all commits
517ab4b
11510fe
8300b76
7855df1
5ab9de1
b91fcb9
64aa2b1
b3129a7
ee3730f
bb64ee1
5b4a902
2d0b97b
543105e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,110 @@ | ||
| #!/usr/bin/env python | ||
| # Copyright 2013 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. | ||
|
|
||
| import argparse | ||
| import os | ||
| import shutil | ||
| import sys | ||
|
|
||
| # The list of packages copied from the Dart SDK. | ||
| PACKAGES = [ | ||
| "vm", "build_integration", "kernel", "front_end", "frontend_server", | ||
| ] | ||
|
|
||
| VM_PUBSPEC = r'''name: vm | ||
| version: 0.0.1 | ||
| environment: | ||
| sdk: ">=2.2.2 <3.0.0" | ||
|
|
||
| dependencies: | ||
| front_end: any | ||
| kernel: any | ||
| meta: any | ||
| build_integration: any | ||
| ''' | ||
|
|
||
| BUILD_INTEGRATION_PUBSPEC = r'''name: build_integration | ||
| version: 0.0.1 | ||
| environment: | ||
| sdk: ">=2.2.2 <3.0.0" | ||
|
|
||
| dependencies: | ||
| front_end: any | ||
| meta: any | ||
| ''' | ||
|
|
||
| FRONTEND_SERVER_PUBSPEC = r'''name: frontend_server | ||
| version: 0.0.1 | ||
| environment: | ||
| sdk: ">=2.2.2 <3.0.0" | ||
|
|
||
| dependencies: | ||
| args: any | ||
| path: any | ||
| vm: any | ||
| ''' | ||
|
|
||
| KERNEL_PUBSPEC = r'''name: kernel | ||
| version: 0.0.1 | ||
| environment: | ||
| sdk: '>=2.2.2 <3.0.0' | ||
|
|
||
| dependencies: | ||
| args: any | ||
| meta: any | ||
| ''' | ||
|
|
||
| FRONT_END_PUBSPEC = r'''name: front_end | ||
| version: 0.0.1 | ||
| environment: | ||
| sdk: '>=2.2.2 <3.0.0' | ||
| dependencies: | ||
| kernel: any | ||
| package_config: any | ||
| meta: any | ||
| ''' | ||
|
|
||
| PUBSPECS = { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does the engine repo use the google3 style (4 space indent) or the chrome style (2 space indent) for python? @chinmaygarde
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I switched to 2-space, that looks like the rest of the repo |
||
| 'vm': VM_PUBSPEC, | ||
| 'build_integration': BUILD_INTEGRATION_PUBSPEC, | ||
| 'frontend_server': FRONTEND_SERVER_PUBSPEC, | ||
| 'kernel': KERNEL_PUBSPEC, | ||
| 'front_end': FRONT_END_PUBSPEC, | ||
| } | ||
|
|
||
| def main(): | ||
| parser = argparse.ArgumentParser() | ||
| parser.add_argument('--input-root', type=str, dest='input', action='store') | ||
| parser.add_argument('--output-root', type=str, dest='output', action='store') | ||
|
|
||
| args = parser.parse_args() | ||
| for package in PACKAGES: | ||
| package_root = os.path.join(args.input, package) | ||
| for root, directories, files in os.walk(package_root): | ||
| # We only care about actual source files, not generated code or tests. | ||
| for skip_dir in ['.git', 'gen', 'test']: | ||
| if skip_dir in directories: | ||
| directories.remove(skip_dir) | ||
|
|
||
| # Ensure we have a dest directory | ||
| if not os.path.isdir(os.path.join(args.output, package)): | ||
| os.makedirs(os.path.join(args.output, package)) | ||
|
|
||
| for filename in files: | ||
| if filename.endswith('.dart') and not filename.endswith('_test.dart'): | ||
| destination_file = os.path.join(args.output, package, | ||
| os.path.relpath(os.path.join(root, filename), start=package_root)) | ||
| parent_path = os.path.abspath(os.path.join(destination_file, os.pardir)) | ||
| if not os.path.isdir(parent_path): | ||
| os.makedirs(parent_path) | ||
| shutil.copyfile(os.path.join(root, filename), destination_file) | ||
|
|
||
| # Write the overriden pubspec for each package. | ||
| pubspec_file = os.path.join(args.output, package, 'pubspec.yaml') | ||
| with open(pubspec_file, 'w+') as output_file: | ||
| output_file.write(PUBSPECS[package]) | ||
|
|
||
| if __name__ == '__main__': | ||
| sys.exit(main()) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,10 @@ description: Communication pipe to Dart Frontend | |
| homepage: http://flutter.io | ||
| author: Flutter Authors <[email protected]> | ||
|
|
||
| environment: | ||
| # The pub client defaults to an <2.0.0 sdk constraint which we need to explicitly overwrite. | ||
| sdk: ">=2.2.2 <3.0.0" | ||
|
|
||
| dependencies: | ||
| args: any | ||
| async: any | ||
|
|
@@ -22,36 +26,3 @@ dependencies: | |
| typed_data: any | ||
| usage: any | ||
| vm: any | ||
|
|
||
| dev_dependencies: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are these not needed anymore?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No more test |
||
| analyzer: any | ||
| boolean_selector: any | ||
| cli_util: any | ||
| csslib: any | ||
| glob: any | ||
| html: any | ||
| http: any | ||
| http_multi_server: any | ||
| http_parser: any | ||
| matcher: any | ||
| mime: any | ||
| mockito: any | ||
| package_resolver: any | ||
| plugin: any | ||
| pool: any | ||
| pub_semver: any | ||
| shelf: any | ||
| shelf_packages_handler: any | ||
| shelf_static: any | ||
| shelf_web_socket: any | ||
| source_map_stack_trace: any | ||
| source_maps: any | ||
| stack_trace: any | ||
| stream_channel: any | ||
| string_scanner: any | ||
| test: any | ||
| utf: any | ||
| watcher: any | ||
| web_socket_channel: any | ||
| when: any | ||
| yaml: any | ||
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure this file has the execute bit set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed