From 33494de2f90e50e2f3e2fb7d688e0076a3d984e8 Mon Sep 17 00:00:00 2001 From: Sigmund Cherem Date: Wed, 2 Oct 2019 22:22:11 +0000 Subject: [PATCH] (ddk modular test) exclude sources from dill files. This fixes the issue we had with shared/diamond depedencies. This also matches more closely how DDK is invoked internally and externally. While the change to use `--dart-sdk-summary` is not necessary, this brings the API closer to how it is used elsewhere. It should be cleaned up in the future to reuse the `--input-summary` flag instead. Change-Id: Iec3695b5541ffaf7f5762a3d77f071a596237da1 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119723 Reviewed-by: Nicholas Shahan Commit-Queue: Sigmund Cherem --- pkg/dev_compiler/test/modular_suite.dart | 11 ++++++++++- tests/modular/diamond/a.dart | 3 +++ tests/modular/diamond/b.dart | 3 +++ tests/modular/diamond/main.dart | 6 ++++++ tests/modular/diamond/modules.yaml | 3 +++ 5 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 tests/modular/diamond/a.dart create mode 100644 tests/modular/diamond/b.dart create mode 100644 tests/modular/diamond/main.dart create mode 100644 tests/modular/diamond/modules.yaml diff --git a/pkg/dev_compiler/test/modular_suite.dart b/pkg/dev_compiler/test/modular_suite.dart index 2442d93cc01..0b4e1e6e81b 100644 --- a/pkg/dev_compiler/test/modular_suite.dart +++ b/pkg/dev_compiler/test/modular_suite.dart @@ -81,6 +81,9 @@ class SourceToSummaryDillStep implements IOModularStep { extraArgs = ['--packages-file', '$rootScheme:/.packages']; } + Module sdkModule = + module.isSdk ? module : module.dependencies.firstWhere((m) => m.isSdk); + List args = [ _kernelWorkerScript, '--summary-only', @@ -93,8 +96,14 @@ class SourceToSummaryDillStep implements IOModularStep { ...extraArgs, '--output', '${toUri(module, dillId)}', + if (!module.isSdk) ...[ + '--dart-sdk-summary', + '${toUri(sdkModule, dillId)}', + '--exclude-non-sources', + ], ...(transitiveDependencies - .expand((m) => ['--input-linked', '${toUri(m, dillId)}'])), + .where((m) => !m.isSdk) + .expand((m) => ['--input-summary', '${toUri(m, dillId)}'])), ...(sources.expand((String uri) => ['--source', uri])), ...(flags.expand((String flag) => ['--enable-experiment', flag])), ]; diff --git a/tests/modular/diamond/a.dart b/tests/modular/diamond/a.dart new file mode 100644 index 00000000000..63956ec64e8 --- /dev/null +++ b/tests/modular/diamond/a.dart @@ -0,0 +1,3 @@ +import 'b.dart'; + +var item = b; diff --git a/tests/modular/diamond/b.dart b/tests/modular/diamond/b.dart new file mode 100644 index 00000000000..07a55aa41a4 --- /dev/null +++ b/tests/modular/diamond/b.dart @@ -0,0 +1,3 @@ +class B {} + +var b = new B(); diff --git a/tests/modular/diamond/main.dart b/tests/modular/diamond/main.dart new file mode 100644 index 00000000000..a112564e81b --- /dev/null +++ b/tests/modular/diamond/main.dart @@ -0,0 +1,6 @@ +import 'b.dart'; +import 'a.dart'; + +main() { + print([item, b]); +} diff --git a/tests/modular/diamond/modules.yaml b/tests/modular/diamond/modules.yaml new file mode 100644 index 00000000000..2fd373c2ed8 --- /dev/null +++ b/tests/modular/diamond/modules.yaml @@ -0,0 +1,3 @@ +dependencies: + main: [a, b] + a: b