Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Create a package-able incremental compiler #12681

Merged
merged 13 commits into from
Oct 3, 2019

Conversation

jonahwilliams
Copy link
Member

@jonahwilliams jonahwilliams commented Sep 29, 2019

Description

Packages up package:vm, package:build_integration, package:kernel, package:front_end, and package:frontend_server for downloading by the flutter tool cache. This copies only the lib/ directory and replaces the pubspec, since several of these packages have invalid or outdated constraints.

The incremental compiler can optionally take a single ProgramTransformer which will be applied to the Component after compilation, which will be used for kernel transforms.

Work towards flutter/flutter#36738

@jonahwilliams

This comment has been minimized.

@jonahwilliams jonahwilliams changed the title Allow providing composite transformer to incremental compiler Create a package-able incremental compiler Sep 30, 2019
meta: any
''';

const String frontendServerPubspec = r'''
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason to have pubspec.yaml contents hardcoded in this script?

Copy link
Member Author

Choose a reason for hiding this comment

The 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 any constraints. This will be used by a generated pubspec in the flutter_tool that uses the dependency_overrides section to specify path versions.

Copy link
Member

Choose a reason for hiding this comment

The 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?

Copy link
Member Author

Choose a reason for hiding this comment

The 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.

Copy link
Member

Choose a reason for hiding this comment

The 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?

Copy link
Member Author

Choose a reason for hiding this comment

The 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

@@ -1,19 +0,0 @@
import 'dart:async';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this test being removed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It didn't seem like it had been running.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it pass? Would it be valuable to have running somewhere? Maybe @aam knows.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not high-value test, other build-time things will break if running with --train fails somehow. Also there used to be more tests as part of this, but they were migrated over to dart sdk. I would keep it, but no strong feelings if it is deleted.

@@ -22,36 +26,3 @@ dependencies:
typed_data: any
usage: any
vm: any

dev_dependencies:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these not needed anymore?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No more test

@@ -71,4 +74,115 @@ if (is_fuchsia_host || is_fuchsia) {

inputs = frontend_server_files
}

# Creates a packageable vm.
prebuilt_dart_action("flutter_package_vm") {
Copy link
Member

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.

# we can generate a local frontend_server snapshot in the tools cache.

# Creates a packageable vm.
prebuilt_dart_action("flutter_package_vm") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand the desire to use Dart in publish.dart but this template invocation now uses the Python to list the files, Dart to publish the same, and compiles the host VM (~2000 TUs) to boot. We do have a prebuilt VM you can use for complicated Dart scripts but I'd rather you just replace these steps with a single script action. That will be faster in cases where this copy step is the only step necessary (since you wont have to build the VM) and can be parallelized by the build system when other targets that need the VM are also being built.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood, I'll update the script to use python.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI prebuilt_dart_action() should be using the prebuilt Dart VM. If it isn't then that is a bug.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. I was thinking of dart_action. I suppose I am now significantly less concerned about this but I still think it'd be cleaner and less verbose to just have a single action target that achieves this instead of a target definition that mixes both python and dart with a custom template.

Copy link
Member Author

Choose a reason for hiding this comment

The 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?

Copy link
Member

Choose a reason for hiding this comment

The 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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. A single python script would be great. Thanks.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to use a single/action python script.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to use a single python script


import argparse
import os
import sys
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: alphabetize

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@@ -0,0 +1,114 @@
#!/usr/bin/env python
# Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the right header?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

meta: any
'''

PUBSPECS = {
Copy link
Member

Choose a reason for hiding this comment

The 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

Copy link
Member Author

Choose a reason for hiding this comment

The 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

if not os.path.isdir(os.path.join(args.output, package)):
os.makedirs(os.path.join(args.output, package))

if '.git' in directories:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this have been skipped already by the logic above?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed



if __name__ == '__main__':
sys.exit(main())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: missing newline

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Copy link
Member

@zanderso zanderso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@@ -0,0 +1,110 @@
#!/usr/bin/env python
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@jonahwilliams
Copy link
Member Author

@chinmaygarde was there anything else you'd like me to update for this PR?

@jonahwilliams jonahwilliams merged commit da71c38 into flutter:master Oct 3, 2019
@jonahwilliams jonahwilliams deleted the composite_transformer branch October 3, 2019 19:56
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 3, 2019
engine-flutter-autoroll added a commit to flutter/flutter that referenced this pull request Oct 4, 2019
[email protected]:flutter/engine.git/compare/7d67e275ff82...8aa4732

git log 7d67e27..8aa4732 --no-merges --oneline
2019-10-03 [email protected] Fix Metal builds. (flutter/engine#12777)
2019-10-03 [email protected] Revert "Manage resource and onscreen contexts using separate IOSGLContext objects (#12277)" (flutter/engine#12773)
2019-10-03 [email protected] Roll src/third_party/dart afac6a3714..07a63a17a4 (6 commits)
2019-10-03 [email protected] roll buildroot to 01e9235 (flutter/engine#12771)
2019-10-03 [email protected] Create a package-able incremental compiler (flutter/engine#12681)
2019-10-03 [email protected] add windows embedding test (flutter/engine#12423)
2019-10-03 [email protected] Roll fuchsia/sdk/core/mac-amd64 from g-PD1... to wYLiQ... (flutter/engine#12770)


If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC [email protected] on the revert to ensure that a human
is aware of the problem.

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
Inconnu08 pushed a commit to Inconnu08/flutter that referenced this pull request Nov 26, 2019
[email protected]:flutter/engine.git/compare/7d67e275ff82...8aa4732

git log 7d67e27..8aa4732 --no-merges --oneline
2019-10-03 [email protected] Fix Metal builds. (flutter/engine#12777)
2019-10-03 [email protected] Revert "Manage resource and onscreen contexts using separate IOSGLContext objects (flutter#12277)" (flutter/engine#12773)
2019-10-03 [email protected] Roll src/third_party/dart afac6a3714..07a63a17a4 (6 commits)
2019-10-03 [email protected] roll buildroot to 01e9235 (flutter/engine#12771)
2019-10-03 [email protected] Create a package-able incremental compiler (flutter/engine#12681)
2019-10-03 [email protected] add windows embedding test (flutter/engine#12423)
2019-10-03 [email protected] Roll fuchsia/sdk/core/mac-amd64 from g-PD1... to wYLiQ... (flutter/engine#12770)


If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC [email protected] on the revert to ensure that a human
is aware of the problem.

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants