dart-sdk/utils
Bob Nystrom cf8a477cb7 Support test packages in dartdevk in test.dart.
This allows dartdevk to compile tests that import packages like expect.
There are a few pieces to this:

- Add support to build_pkgs.dart to build the kernel summaries for each
  test package (in addition to the analyzer summaries it already
  builds).

- Plumb that through the dartdevc_test target in the GN build as well.

- While we're at it, use GN to build the ddc_sdk.dill file and have
  test.dart load that one instead of the manually built one from calling
  ./tool/kernel_sdk.dart.

- Add command-line arguments to dartdevk for passing in the path to the
  SDK summary and the other summaries to compile against.

- Fix a little typo in processed_options.dart that was preventing it
  from resolving "package:" URIs.

- In test.dart, when compiling a test, link in the summaries for all of
  the test packages.

At runtime, it still uses the JS for those packages generated from the
old analyzer-based front end since the kernel-based compiler isn't
complete enough to compile any of those packages yet.

With all of this, if I change a test to:

  import "package:expect/expect.dart";

  main() {
    Expect.equals("a", "b");
  }

Then it compiles but fails at runtime. The compiler is completing, but
the generated code has some bugs. I don't know enough to fix them
myself, but here's what I've found out:

- In _libraryToModule(), the Library we get from kernel has a null
  fileUri, so this returns an empty string. That in turn means the
  generated JS tries to use "$" as the module name.

  Using this works around it temporarily:

      if (moduleName.isEmpty) moduleName = library.name;

- In _emitTopLevelNameNoInterop(), it doesn't handle the case where the
  NamedNode is a static method on a class. It just generates the library
  and method name, skipping the class, so "Expect.equals(1, 2)" gets
  compiled to "expect.equals(1, 2)" instead of
  "expect.Expect.equals(1, 2)".

Change-Id: I6bd9d98bc9706965160d8fb7cf70b20eeebab3a8
Reviewed-on: https://dart-review.googlesource.com/16687
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
2017-10-27 21:25:58 +00:00
..
analysis_server [infra] Begin removing gyp 2017-08-04 22:19:35 -07:00
compiler Address comments from CL 11506. 2017-10-20 13:59:58 +00:00
dartanalyzer [infra] Begin removing gyp 2017-08-04 22:19:35 -07:00
dartdevc Support test packages in dartdevk in test.dart. 2017-10-27 21:25:58 +00:00
dartdoc [infra] Begin removing gyp 2017-08-04 22:19:35 -07:00
dartfmt [infra] Begin removing gyp 2017-08-04 22:19:35 -07:00
kernel-service [VM] Pass --strong down to DFE isolate 2017-10-23 11:27:47 +00:00
peg Spelling fixes e to i. 2017-06-24 13:41:39 +02:00
pub [infra] Begin removing gyp 2017-08-04 22:19:35 -07:00
tests/peg Delete old tests that aren't used and/or useful any more. 2017-07-18 14:12:57 -07:00
application_snapshot.gni Allow caller of application_snapshot to override .packages. 2017-08-15 16:10:20 -07:00
compile_platform.gni compile_platform should work when there's no checked-in dart binary. 2017-10-17 11:29:50 +00:00
create_timestamp.gni
generate_patch_sdk.gni Remove compiling platform.dill from patch_sdk.dart 2017-10-06 15:34:37 +00:00