Commit graph

31 commits

Author SHA1 Message Date
Anna Gringauze c909e16ee2 Added module information to metadata and use by frontend_sever
- created class representing module metadata, added metadata to JsCode
  class
- added module information to metadata, such as module name, load
  function name
- added import and file uris for libraries
- added experimental-emit-debug-metadata flag to frontend_server
- added frontend server tests to check for saved metadata

Related: https://github.com/dart-lang/sdk/issues/41852
Closes: https://github.com/dart-lang/sdk/issues/40774
Change-Id: Iecbbf1e4eea1919e01f002f45363d30707cb1590
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150181
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Gary Roumanis <grouma@google.com>
2020-06-20 00:40:35 +00:00
Nicholas Shahan d76b5318b4 [ddc] Make amd modules a named function
Apply the same naming used in the ddc module format to amd modules.

Change-Id: Ib766c20cb35c3c6e11a345e45cba5c49f3a34b3b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148941
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Anna Gringauze <annagrin@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-05-27 20:44:07 +00:00
Anna Gringauze 0218c66698 Emit types during incremental expression compilation
During expression compilation, if the compiled expression is using
a type that was not used in the current function, the incremental
compiler and DDC produce code that refers to undefined types.
To fix that, discharge types created during expression compilation
and add their definitions at the beginning of the generated
function.

Added tests to validate the behavior.

Fixes: https://github.com/dart-lang/sdk/issues/41443
Change-Id: If3fdce85a50ab2590d107f3b9e8c19b4768fd482
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148468
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Anna Gringauze <annagrin@google.com>
2020-05-20 18:51:20 +00:00
Anna Gringauze 6f16174d56 remove private fields and modules calculations from expression compiler
- Remove collecting private fields from scope calculation
  We only need to collect the fields from the evaluated
  expression and they are already collected separately.

- Correct private fields calculation
  Currently, library names are assumed to be the same as the module,
  which creates redefinitions of library variable in produced Javascript
  code, and exceptions in chrome for modules that contain more than one
  library.
  The actual fix will come from making DDC incremental by storing more
  information, for now make a best effort to compute correct names for
  library variables from the module data that expression compiler
  receives from chrome. The following code will be produced to calculate
  private symbols _pf1 (from lib1, module1) and _pf2
  (from lib2 module1):

  let lib1 = require('module1.dart').lib1;
  let lib2 = require('module1.dart').lib2;

  let _pf1 = dart.privateNames(lib1, '_pf1');
  let _pf2 = dart.privateNames(lib2, '_pf2');

  Note that this seems to work even if the current breakpoint is inside
  the define statement for lib1, and the lib1 symbol is not exported
  yet.

Closes: https://github.com/dart-lang/sdk/issues/40272
Closes: https://github.com/dart-lang/sdk/issues/41585
Change-Id: I141719d2d5d5c08dd3c0ef5f0406756dce5575ab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145307
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Anna Gringauze <annagrin@google.com>
2020-05-05 17:41:17 +00:00
Anna Gringauze 9f65693f57 Use offset for detecting scope in ExpressionCompiler
ExpressionCompiler currently translates offsets of scopes to line
numbers during the binary search in the library in order to find
the inner-most scope containing the line where debugger has stopped.
This results in many offset-to-line translations per evaluation request,
each translation also performing a binary search in Source.lineStarts
table.

To make scope lookup more efficient, this change uses Source.lineStarts
table to find the offset for the debugger stop once, and uses integer
offset comparisons instead in the scope binary search.

Closes: https://github.com/dart-lang/sdk/issues/40281
Change-Id: I72052b144d15acef684a5f8d29b40f6c5774b723
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142461
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-04-09 22:29:14 +00:00
Anna Gringauze 7466c1f9da [frontend_server] Make module names debugger-friendly
Module names and import module names generated by the frontend server
are currently breaking debugger's assumptions on module names. This
change fixes it to make debugger works with various compiler
configurations, such as build_runner, frontend server with dwds tests,
and unblocks flutter tools to continue debugger and frontend server
integration.

JavaScriptBundle
  - Change module import names to module names instead of file paths,
    omit leading '/' as it cannot be in a module name in requireJS
  - Module name changes are hidden under "debugger-module-names" flag
    to prevent breaking flutter tools.

FrontendServer
  - Always call exit after listening to commands is finished,
    otherwise process running frontend server does not exit on 'quit'
    command.
  - Call computeCanonicalNames after initial compilation to support
    subsequent module importing in compileExpressioToJs calls
  - Add error handling to usage of kernelToJs compilers

ExpressionCompiler
  - Separate library variables from library fields for loading modules,
    as they can be different, for example
    ```main = require('web/main.dart').web__main```

Closes https://github.com/dart-lang/sdk/issues/40832

Change-Id: Ic103c22932c7181ee325f239193d32361d057ed0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138010
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Jonah Williams <jonahwilliams@google.com>
Reviewed-by: Gary Roumanis <grouma@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
2020-03-05 07:39:33 +00:00
Jacob MacDonald 6746579d1b Use package_config instead of package_resolver in frontend_server
We want to deprecate package_resolver and it isn't migrating to the latest package_config format.

Bug: https://github.com/dart-lang/package_resolver/issues/30
Change-Id: I657ff16dfbf9fa75493d0975b5efcc7f4162431c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138322
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
2020-03-04 19:02:06 +00:00
Jens Johansen e5befd1d66 [flutter-frontend-test] Run flutter-frontend compile tests in custom test runner (fix)
The previous commit did not set the exit code properly.

Change-Id: Iba468bb3fb7a71e029e6abe245074db109625f4f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136187
Reviewed-by: Karl Klose <karlklose@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-02-18 14:07:34 +00:00
Jens Johansen 8652404193 [flutter-frontend-test] Run flutter-frontend compile tests in custom test runner
Change-Id: Iecf2f40dd1bc8c0fffd877911e81ccd6055d9dc0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136121
Reviewed-by: Karl Klose <karlklose@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-02-18 10:58:59 +00:00
Anna Gringauze 30213c4188 Fix expression compiler tests on windows
Recent change
[Implementation of evaluation to JS in frontend server]
(25559399ed)
introduced a failure in windows tests due to
using string concatenation passed to Uri.parse.

Use Uri.resolve instead of string concatenation
to create file Uri in expression_compiler_test.dart

Fixes #40592

Change-Id: Ibccb34333eac33f12b4eecd772707f1edb8bed89
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135356
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Anna Gringauze <annagrin@google.com>
2020-02-12 16:20:27 +00:00
Anna Gringauze 25559399ed Reland "Implementation of evaluation to JS in frontend server"
This is a reland of 344c584ec4

First attempt failed due to lack of implementation of the new
API from SDK in Flutter/engine that this change introduces.
Fixed by creating dummy implementation in flutter/engine:

https://github.com/flutter/engine/pull/16309

Original change's description:
> Implementation of evaluation to JS in frontend server
>
>     - made ProgramCompiler somewhat incremental by letting the user
>       set the current library and class
>     - fixed a bug in procedure_builder where extension method wrappers
>       did not have correct fileEndOffset set, which prevented finding
>       dart scope at a line when extension methods are used
>     - added new compileExpressionToJs API to frontend server and
>       frontend compiler interface
>     - added ExpressionCompier class that combines IncrementalCompiler
>       and ProgramCompiler to compile expression at given dart location
>       to JavaScript
>     - in JavascriptBundle, set the module name for library tracking in
>       JavaScript and saved program compilers to a table for incremental
>       reuse in expression compiler
>     - Exposed generator from IncrementalCompiler for use in
>       ExpressionCompiler
>     - added tests for expression compiler
>     - added test for compileExpressionToJs API in frontend server tests
>
>
> Change-Id: Ic5e7829e07030b8ad044da7d35bcf27e9fba81c8
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132701
> Commit-Queue: Anna Gringauze <annagrin@google.com>
> Reviewed-by: Alexander Aprelev <aam@google.com>
> Reviewed-by: Sigmund Cherem <sigmund@google.com>
> Reviewed-by: Gary Roumanis <grouma@google.com>
> Reviewed-by: Jake Macdonald <jakemac@google.com>
> Reviewed-by: Johnni Winther <johnniwinther@google.com>

Change-Id: I56426d2b6d831b2f8d8c57d468d0b54833a0062e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134561
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-02-11 18:31:44 +00:00
Siva Annamalai 0987024f51 Revert "Implementation of evaluation to JS in frontend server"
This reverts commit 344c584ec4.

Reason for revert: It is breaking the flutter builds and is blocking the roll of Dart into Flutter (see https://github.com/flutter/engine/runs/416355895 and
https://ci.chromium.org/p/flutter/builders/try/Linux%20Host%20Engine/3451)

Original change's description:
> Implementation of evaluation to JS in frontend server
> 
>     - made ProgramCompiler somewhat incremental by letting the user set
>       the current library and class
>     - fixed a bug in procedure_builder where extension method wrappers
>       did not have correct fileEndOffset set, which prevented finding
>       dart scope at a line when extension methods are used
>     - added new compileExpressionToJs API to frontend server and
>       frontend compiler interface
>     - added ExpressionCompier class that combines IncrementalCompiler
>       and ProgramCompiler to compile expression at given dart location
>       to JavaScript
>     - in JavascriptBundle, set the module name for library tracking in
>       JavaScript and saved program compilers to a table for incremental
>       reuse in expression compiler
>     - Exposed generator from IncrementalCompiler for use in
>       ExpressionCompiler
>     - added tests for expression compiler
>     - added test for compileExpressionToJs API in frontend server tests
> 
> 
> Change-Id: Ic5e7829e07030b8ad044da7d35bcf27e9fba81c8
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132701
> Commit-Queue: Anna Gringauze <annagrin@google.com>
> Reviewed-by: Alexander Aprelev <aam@google.com>
> Reviewed-by: Sigmund Cherem <sigmund@google.com>
> Reviewed-by: Gary Roumanis <grouma@google.com>
> Reviewed-by: Jake Macdonald <jakemac@google.com>
> Reviewed-by: Johnni Winther <johnniwinther@google.com>

TBR=aam@google.com,jensj@google.com,johnniwinther@google.com,jakemac@google.com,sigmund@google.com,grouma@google.com,nshahan@google.com,jonahwilliams@google.com,markzipan@google.com,annagrin@google.com

Change-Id: I3dc1ab0117df7b3141b8056ae684fc1c3492b2a3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133867
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2020-01-30 02:22:40 +00:00
Anna Gringauze 344c584ec4 Implementation of evaluation to JS in frontend server
- made ProgramCompiler somewhat incremental by letting the user set
      the current library and class
    - fixed a bug in procedure_builder where extension method wrappers
      did not have correct fileEndOffset set, which prevented finding
      dart scope at a line when extension methods are used
    - added new compileExpressionToJs API to frontend server and
      frontend compiler interface
    - added ExpressionCompier class that combines IncrementalCompiler
      and ProgramCompiler to compile expression at given dart location
      to JavaScript
    - in JavascriptBundle, set the module name for library tracking in
      JavaScript and saved program compilers to a table for incremental
      reuse in expression compiler
    - Exposed generator from IncrementalCompiler for use in
      ExpressionCompiler
    - added tests for expression compiler
    - added test for compileExpressionToJs API in frontend server tests


Change-Id: Ic5e7829e07030b8ad044da7d35bcf27e9fba81c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132701
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Gary Roumanis <grouma@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-01-30 00:54:51 +00:00
Jacob MacDonald d3070f4bbc - simplify convertFileOrArgumentToUri to just use resolveInputUri
- Allow non-file uris as a multi-root root

resolveInputUri already does what we need, and also supports other types of uris such as http.

This enables us to set a multi-root uri which is actually pointing to a dev server, thus hiding the server uri from generated kernel files.

Bug:https://github.com/dart-lang/webdev/issues/865
Change-Id: I0994df0594d57f5d2f020ecfe3bfc0657771cb74
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133083
Commit-Queue: Alexander Aprelev <aam@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-01-24 22:52:13 +00:00
Jacob MacDonald 14544a3e2d Allow http uris in frontend_server, front_end, and ddc.
Also updates StrongComponents to prefer the main component as the root if it is in a cycle. This makes bootstrapping more predictable.

This enables a clean integration of build_runner or ddr (internal) and the frontend_server by allowing it to work with any dev server.

All that is needed is a custom .packages file with `http` uris pointing at a dev server which does all code generation, etc.

Bug: https://github.com/dart-lang/webdev/issues/865
Change-Id: I14533d71e5f7ddac58d98073cf016c2589165e9f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132962
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-01-23 23:47:22 +00:00
Jacob MacDonald 4460f95782 Updates frontend_server javascript bundler to be based on import uri instead of file uri.
Converts `package:` import uris into `/packages/` modules.

Also renames the output modules to append `.lib.js` instead of just `.js`. This allows us to distinguish between modules and applications based on extension.

Updates DDC source map code to be able to convert absolute file uris in sources so that they are relative to the source map.

Bug: https://github.com/dart-lang/webdev/issues/865
Change-Id: I55d70aa3761f10cc8bd7e92f5b567478040660de
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132300
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Jonah Williams <jonahwilliams@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
2020-01-21 17:41:02 +00:00
Jens Johansen 871cd09121 Make flutter-frontend test pass again
Ignore a test that us web-only which the current setup doesn't
support.
Also fix a issue with how we answer configurable import questions ---
something that for now is untested (except that it makes a test work here).

Change-Id: Ic19858838c45f1d4ce718aae0f526b2f16f3e9d4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130365
Commit-Queue: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Auto-Submit: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-01-06 14:46:19 +00:00
Nate Bosch 113ff6c993 Enforce that allowInterop is used in DDC
Fixes #39074

DDC emits Dart code that can usually be called with the same semantics
as JS there is no guarantee that a function passed to JS and then
invoked successfully was wrapped with `allowInterop`. The wrapping is
always required in Dart2JS. To make DDC more strict, add interceptors
that check for the usage of `allowInterop`.

Whenever a JS interop function or setter is passed an argument which is
statically typed as a Function, but not wrapped with `allowInterop` at
the call site, wrap it with `assertInterop` which will check the
argument at call time and fail with a clear error if it was not wrapped.

Whenever a JS interop function is torn off, either at the top level or
from an instance, wrap it with a function that will also inject these
checks at runtime.

There are still holes where we can't catch the mistake:
- An argument which is statically dynamic and a Function at runtime
  won't be caught.
- A Function which is stored in a collection won't be caught.
- A JS interop definition where a getter returns a Function which takes
  a Function as an argument is not checked.
- A dynamic call through to javascript is not checked.

Changes:

- Refactor `_isJsLibrary` and add `isJsMember`, and `isAllowInterop`
  utilities to determine what needs wrapping.
- Update `assertInterop` to give a more clear error when it fails, and
  to ignore non function arguments.
- Add `tearoffInterop` to wrap a function an ensure that any function
  typed arguments are wrapped.
- Inject `assertInterop` around Function arguments passed to JS methods.
- Inject `assertInterop` around Function arguments passed to static or
  instance JS setters.
- Inject a runtime wrapper around static or instance Function tearoffs.
- Add a test covering all flavors of checks that are supported.
- Change the interop expando to an `Expando<dynamic>` in the NNBD SDK to work
  around a stricter type check. https://github.com/dart-lang/sdk/issues/39971

Potential improvements:

If the `tearoffInterop` turns out to be too heavy, we could loosen it so
that we only wrap methods if any of their argument types are statically
declared to be a Function.

Change-Id: Ibc92df5b54e1a041b4102a07b8398b774b6bd1d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128462
Commit-Queue: Nate Bosch <nbosch@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2020-01-02 20:24:26 +00:00
Nate Bosch 21d0afad2e Remove int return from main and drop new
The `return 0;` from `main` is misleading because it is not used.

Run `dartfmt --fix` to drop optional `new` usage.

Change-Id: I672ceb7a27f0121006b9a7fcd90b00619baaed8d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128981
Commit-Queue: Alexander Aprelev <aam@google.com>
Auto-Submit: Nate Bosch <nbosch@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2019-12-18 22:47:11 +00:00
Johnni Winther 818ec6db92 [cfe] Implement nnbd-top-merge
+ and use nnbd-top-merge and legacy erasure in hierarchy computation

Change-Id: I4bf06ce8d3c68a9926865ebf84b24b4029828d73
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128065
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2019-12-13 17:19:59 +00:00
Nicholas Shahan 2a13b1fe26 Reland "[dartdevc] Break dart:_debugger dependency on dart:html"
Original change was broken by the fact that DDC expects all types marked as
native have all their superclasses marked as native when the super classes are
compiled.

In this case `MapMixin` from dart:collection was not being marked as native and
the only reason it was working before was that the library dependency enforced
the necessary order.

* Now `MapMixin` is explicitly marked as native.
* Added a test case to use some of the API on `window.localStorage` that is
  inherited from the MapMixin class.

Change-Id: I1584bfb86179016ee12c2acc5cfbbe81d086841e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126906
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2019-12-04 00:51:18 +00:00
Jens Johansen 1c3468a646 [kernel] Remove Library.isExternal
Change-Id: I6638b915c1189838e7081069a0075e4ecd9ee9d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125600
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-12-02 09:24:42 +00:00
Jens Johansen 2e32972929 [pkg/vm] Remove usage of Library.isExternal
Change-Id: I014184e2324ab0379653cb8c23cb7eed52677aeb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124985
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-11-21 08:36:54 +00:00
Alexander Aprelev efbfda2e6d [gardening] Fix frontend-server-test uri vs file path use.
Also fix bracketing for "reject" compiler output (flutter/issues/35924).

Change-Id: I0a0d14665520cf5eb4594cc4e5e552c0b35a136e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124914
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2019-11-14 04:14:26 +00:00
Alexander Markov cd6dbad074 [front-end server] Cleanup --strong in test/frontend_server_flutter.dart
This is the follow-up for the cleanup of --strong option in front-end
server (https://dart.googlesource.com/sdk/+/830b3d5f36408c9d4c594a9a8acee53197b0ae94).

Change-Id: I73b72b96361db92d48a041d732dd8b17f8fb8ee9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124820
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-11-11 20:22:18 +00:00
Jens Johansen 96822518f9 [frontend_server] Add reproduction test of incremental serializer bug
Reproduction of https://github.com/flutter/flutter/issues/44384
and a few fixes to old tests.

Change-Id: I7c20721c34127a2b3fe4f56947b2cfc6465bd6f4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124689
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2019-11-11 12:41:43 +00:00
jonahwilliams f7722a2ecd [frontend_server] write JavaScript source maps
Write JavaScript source map contents as part of the incremental compile. places them in a single file adjacent to the source and offset manifests.

This file contains a map where the module name corresponds to the key and the value is the source map object.

Change-Id: Ice8ac910a5d7119a51d567b8f14cef560cfe8e2e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123360
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Jonah Williams <jonahwilliams@google.com>
2019-10-31 17:50:34 +00:00
jonahwilliams fe3aa126a2 [frontend_server] fix package-scheme crash in dartdevc target
If the entrypoint is not a file URI, we'll crash as the strong components implementation is unable to find it. Fallback to the first library in the component

Change-Id: Ibd1650978ebc904463ca2a97bd219a4069524b60
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122560
Commit-Queue: Jonah Williams <jonahwilliams@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2019-10-28 23:54:53 +00:00
jonahwilliams c26d5969f7 [flutter] JavaScript support to frontend_server
Adds support to the frontend server for producing javascript when
compiling with a target model of dartdevc. This uses the ProgramCompiler
and associated types from the dev_compiler package to output the kernel
AST into a "bundle" format.

dev_compiler:
* Exposes additional types needed for JavaScript compilation.
* Allows  overriding CoreTypes instead of forcing it to be created from
Component. This is require to support compilation of the
partial Components created by the incremental compiler.
* provides extraIndexedLibraries in Target class so the CoreTypes produced by the incremental compiler have indexed them.

frontend_server:
* When the target model is dartdev, JavaScript is output instead of
kernel. For each Component we compile, we first compute the strongly
connected components and produce a List of new Components to interop
with the dev compiler. The file uri is used as module name.

Change-Id: I4cc117b20671ffd48dd43f9786961c016a02d056
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121400
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Jonah Williams <jonahwilliams@google.com>
2019-10-21 15:41:29 +00:00
Jens Johansen 18aed26e83 [frontend_server] Wire up incremental serializer into frontend server / package VM
Change-Id: I4d8dbc2d9b0915c654eccae9e35357d7ec9fa13d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120787
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-10-10 11:39:06 +00:00
jonahwilliams 13fbf569f6 [flutter] split frontend_server from vm package
To support JavaScript compilation, the frontend_server will require a dependency on the dev_compiler. To avoid conflating this with the vm specific functionality, the frontend server will be split from its current location.

This change will require a small corresponding update in flutter/engine, documented in the patches directory
Change-Id: I47923765546f7f6fa43e36ef38f8f466d3a7b2fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120321
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2019-10-08 05:32:59 +00:00