-
Notifications
You must be signed in to change notification settings - Fork 6k
Create a package-able incremental compiler #12681
Changes from 8 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 |
|---|---|---|
|
|
@@ -44,6 +44,9 @@ if (is_fuchsia_host || is_fuchsia) { | |
| main_dart = "bin/starter.dart" | ||
| deps = [ | ||
| "$flutter_root/lib/snapshot:kernel_platform_files", | ||
| ":flutter_package_vm", | ||
| ":flutter_package_build_integration", | ||
| ":flutter_package_frontend_server", | ||
| ] | ||
| dot_packages = rebase_path(".packages") | ||
| flutter_patched_sdk = rebase_path("$root_out_dir/flutter_patched_sdk") | ||
|
|
@@ -71,4 +74,115 @@ if (is_fuchsia_host || is_fuchsia) { | |
|
|
||
| inputs = frontend_server_files | ||
| } | ||
|
|
||
| # Creates a packageable vm. | ||
| prebuilt_dart_action("flutter_package_vm") { | ||
|
Contributor
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 understand the desire to use Dart in
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. Understood, I'll update the script to use python.
Contributor
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. FYI
Contributor
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. You're right. I was thinking of
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. What would be the resolution here - to write this as a single target in python? dart?
Contributor
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. @chinmaygarde Would a single python script wrapped in a GN template scoped to this file address your concerns?
Contributor
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. Yes. A single python script would be great. Thanks.
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. Updated to use a single/action python script.
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. Updated to use a single python script |
||
| packages = "//third_party/dart/.packages" | ||
|
|
||
| script = "$flutter_root/frontend_server/publish.dart" | ||
|
|
||
| inputs = exec_script("//third_party/dart/tools/list_dart_files.py", | ||
| [ | ||
| "absolute", | ||
| rebase_path("../../third_party/dart/pkg/vm"), | ||
| ], | ||
| "list lines") | ||
|
|
||
| outputs = ["$root_build_dir/dist/packages/vm/pubspec.yaml"] | ||
|
|
||
| args = [ | ||
| rebase_path("//third_party/dart/pkg/vm"), | ||
| rebase_path("$root_gen_dir/dart-pkg/vm"), | ||
| "vm", | ||
| ] | ||
| } | ||
|
|
||
| # Creates a packageable build_integration. | ||
| prebuilt_dart_action("flutter_package_build_integration") { | ||
| packages = "//third_party/dart/.packages" | ||
|
|
||
| script = "$flutter_root/frontend_server/publish.dart" | ||
|
|
||
| inputs = exec_script("//third_party/dart/tools/list_dart_files.py", | ||
| [ | ||
| "absolute", | ||
| rebase_path("../../third_party/dart/pkg/build_integration"), | ||
| ], | ||
| "list lines") | ||
|
|
||
| outputs = ["$root_build_dir/dist/packages/build_integration/pubspec.yaml"] | ||
|
|
||
| args = [ | ||
| rebase_path("//third_party/dart/pkg/build_integration"), | ||
| rebase_path("$root_gen_dir/dart-pkg/build_integration"), | ||
| "build_integration", | ||
| ] | ||
|
|
||
| } | ||
|
|
||
| # Creates a packageable frontend_server. | ||
| prebuilt_dart_action("flutter_package_frontend_server") { | ||
| packages = "//third_party/dart/.packages" | ||
|
|
||
| script = "$flutter_root/frontend_server/publish.dart" | ||
|
|
||
| inputs = exec_script("//third_party/dart/tools/list_dart_files.py", | ||
| [ | ||
| "absolute", | ||
| rebase_path("lib"), | ||
| ], | ||
| "list lines") | ||
|
|
||
| outputs = ["$root_build_dir/dist/packages/frontend_server/pubspec.yaml"] | ||
|
|
||
| args = [ | ||
| rebase_path("lib"), | ||
| rebase_path("$root_gen_dir/dart-pkg/frontend_server"), | ||
| "frontend_server", | ||
| ] | ||
| } | ||
|
|
||
| # Creates a packageable front_end. | ||
| prebuilt_dart_action("flutter_package_front_end") { | ||
| packages = "//third_party/dart/.packages" | ||
|
|
||
| script = "$flutter_root/frontend_server/publish.dart" | ||
|
|
||
| inputs = exec_script("//third_party/dart/tools/list_dart_files.py", | ||
| [ | ||
| "absolute", | ||
| rebase_path("lib"), | ||
| ], | ||
| "list lines") | ||
|
|
||
| outputs = ["$root_build_dir/dist/packages/front_end/pubspec.yaml"] | ||
|
|
||
| args = [ | ||
| rebase_path("lib"), | ||
| rebase_path("$root_gen_dir/dart-pkg/front_end"), | ||
| "front_end", | ||
| ] | ||
| } | ||
|
|
||
| # Creates a packageable kernel. | ||
| prebuilt_dart_action("flutter_package_kernel") { | ||
| packages = "//third_party/dart/.packages" | ||
|
|
||
| script = "$flutter_root/frontend_server/publish.dart" | ||
|
|
||
| inputs = exec_script("//third_party/dart/tools/list_dart_files.py", | ||
| [ | ||
| "absolute", | ||
| rebase_path("lib"), | ||
| ], | ||
| "list lines") | ||
|
|
||
| outputs = ["$root_build_dir/dist/packages/kernel/pubspec.yaml"] | ||
|
|
||
| args = [ | ||
| rebase_path("lib"), | ||
| rebase_path("$root_gen_dir/dart-pkg/kernel"), | ||
| "kernel", | ||
| ] | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| // 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 'dart:io'; | ||
| import 'package:path/path.dart' as path; | ||
|
|
||
| const String vmPubspec = r''' | ||
| name: vm | ||
| version: 0.0.1 | ||
| environment: | ||
| sdk: ">=2.2.2 <3.0.0" | ||
|
|
||
| dependencies: | ||
| front_end: any | ||
| kernel: any | ||
| meta: any | ||
| build_integratioon: any | ||
| '''; | ||
|
|
||
| const String buildIntegrationPubspec = r''' | ||
| name: build_integration | ||
| version: 0.0.1 | ||
| environment: | ||
| sdk: ">=2.2.2 <3.0.0" | ||
|
|
||
| dependencies: | ||
| front_end: any | ||
| meta: any | ||
| '''; | ||
|
|
||
| const String frontendServerPubspec = r''' | ||
|
Contributor
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. What is the reason to have
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. The pubspec of vm/build_integration are not valid, while the pubspec of front_end and kernel say not to rely on the versions. To ensure I don't have version solving issues, I've replace the pubspecs here with
Contributor
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. Do you know why those packages have invalid or reuse-discouraging pubspec.yamls? Is that to prevent deploying and distributing those packages for some reason? If we intend to have those packages to be distributed and available, wouldn't be cleaner to fix their pubspec.yamls instead of providing our replacements for those?
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'm not really distributing or publishing them though, I'm just allowing them to be vendored by the flutter SDK. The versions/constraints are not really meaningful in that content, as they won't be user visible.
Contributor
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. Sorry what does "vendored by the flutter SDK" mean? Does this effectively gives flutter tools (and only flutter tools, because nobody else downloads flutter engine artifacts) access to those packages, while currently those packages(well, frontend server only) is only available as executable snapshot?
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. Yes, the would be in the cache artifacts where flutter_tools can see the source, and use them to regenerate the snapshot to include other kernel transforms per flutter/flutter#36738 |
||
| name: frontend_server | ||
| version: 0.0.1 | ||
| environment: | ||
| sdk: ">=2.2.2 <3.0.0" | ||
|
|
||
| dependencies: | ||
| args: any | ||
| path: any | ||
| vm: any | ||
| '''; | ||
|
|
||
| const String kernelPubspec = r''' | ||
| name: kernel | ||
| version: 0.0.1 | ||
| environment: | ||
| sdk: '>=2.2.2 <3.0.0' | ||
|
|
||
| dependencies: | ||
| args: any | ||
| meta: any | ||
| '''; | ||
|
|
||
| const String frontendPubspec = r''' | ||
| name: front_end | ||
| version: 0.0.1 | ||
| environment: | ||
| sdk: '>=2.2.2 <3.0.0' | ||
| dependencies: | ||
| kernel: any | ||
| package_config: any | ||
| meta: any | ||
| '''; | ||
|
|
||
| const Map<String, String> packages = <String, String>{ | ||
| 'vm': vmPubspec, | ||
| 'build_integration': buildIntegrationPubspec, | ||
| 'frontend_server': frontendServerPubspec, | ||
| 'kernel': kernelPubspec, | ||
| 'front_end': frontendPubspec, | ||
| }; | ||
|
|
||
| // A script for creating a packagable version of several SDK libraries. | ||
| void main(List<String> arguments) { | ||
| final Directory packageSource = Directory(arguments[0]); | ||
| final String destination = arguments[1]; | ||
| final String packageName = arguments[2]; | ||
| for (File file in packageSource.listSync(recursive: true).whereType<File>()) { | ||
| if (!file.path.contains('lib')) { | ||
| // Skip test/bin directories and pubspec. | ||
| continue; | ||
| } | ||
| final File destinationFile = File(path.join(destination, path.relative(file.path, from: packageSource.path))); | ||
| destinationFile.parent.createSync(recursive: true); | ||
| file.copySync(destinationFile.path); | ||
| } | ||
| if (packages.containsKey(packageName)) { | ||
| File(path.join(destination, 'pubspec.yaml')) | ||
| .writeAsStringSync(packages[packageName]); | ||
| } | ||
| } | ||
| 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 <flutter-dev@googlegroups.com> | ||
|
|
||
| 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: | ||
|
Contributor
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.
As discussed offline, add comments about these artifacts pointing at the github issue and add a reviewer from the engine team.