From 1ee0894631985cd004d65130bcc223b727484cb3 Mon Sep 17 00:00:00 2001 From: Nicholas Shahan Date: Thu, 13 Feb 2025 08:30:33 -0800 Subject: [PATCH] [modular_test] Delete support for macro execution Mostly a revert of https://dart-review.googlesource.com/c/sdk/+/361261. A straight revert contained merge conflicts that I resolved manually but I left some of the cleanup or refactoring in place. Change-Id: I2add9f4951d7c6c2399d8c95f36b1483279eea44 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/409401 Commit-Queue: Nicholas Shahan Reviewed-by: Johnni Winther Reviewed-by: Jake Macdonald --- pkg/compiler/tool/modular_test_suite.dart | 2 - .../tool/modular_test_suite_helper.dart | 16 +-- pkg/dev_compiler/lib/src/command/command.dart | 3 +- pkg/dev_compiler/test/modular_helpers.dart | 22 +--- pkg/dev_compiler/test/modular_suite.dart | 2 - .../test/modular_suite_canary.dart | 2 - pkg/front_end/lib/src/api_unstable/ddc.dart | 2 - pkg/modular_test/lib/src/io_pipeline.dart | 21 +--- pkg/modular_test/lib/src/loader.dart | 24 +---- .../lib/src/steps/macro_precompile_aot.dart | 100 ------------------ pkg/modular_test/lib/src/suite.dart | 10 -- .../lib/src/test_specification_parser.dart | 65 +----------- pkg/modular_test/pubspec.yaml | 1 - pkg/modular_test/test/io_pipeline_test.dart | 15 --- pkg/modular_test/test/pipeline_common.dart | 7 +- .../test/validate_suite_test.dart | 28 ++--- 16 files changed, 32 insertions(+), 288 deletions(-) delete mode 100644 pkg/modular_test/lib/src/steps/macro_precompile_aot.dart diff --git a/pkg/compiler/tool/modular_test_suite.dart b/pkg/compiler/tool/modular_test_suite.dart index 256abaf7e08..de71f7871ea 100644 --- a/pkg/compiler/tool/modular_test_suite.dart +++ b/pkg/compiler/tool/modular_test_suite.dart @@ -11,7 +11,6 @@ import 'dart:async'; import 'package:modular_test/src/io_pipeline.dart'; import 'package:modular_test/src/runner.dart'; -import 'package:modular_test/src/steps/macro_precompile_aot.dart'; import 'modular_test_suite_helper.dart'; Future main(List args) async { @@ -23,7 +22,6 @@ Future main(List args) async { 'tests/modular', options, IOPipeline([ - PrecompileMacroAotStep(verbose: options.verbose), OutlineDillCompilationStep(), FullDillCompilationStep(), ConcatenateDillsStep(), diff --git a/pkg/compiler/tool/modular_test_suite_helper.dart b/pkg/compiler/tool/modular_test_suite_helper.dart index c9a975bd386..c7ad8f66ebb 100644 --- a/pkg/compiler/tool/modular_test_suite_helper.dart +++ b/pkg/compiler/tool/modular_test_suite_helper.dart @@ -20,7 +20,6 @@ import 'package:modular_test/src/io_pipeline.dart'; import 'package:modular_test/src/pipeline.dart'; import 'package:modular_test/src/runner.dart'; import 'package:modular_test/src/suite.dart'; -import 'package:modular_test/src/steps/macro_precompile_aot.dart'; import 'package:modular_test/src/steps/util.dart'; import 'package:path/path.dart' as p; @@ -157,11 +156,6 @@ abstract class CFEStep extends IOModularStep { ...(transitiveDependencies.expand( (m) => ['--input-summary', '${toUri(m, inputData)}'], )), - ...transitiveDependencies - .where((m) => m.macroConstructors.isNotEmpty) - .expand( - (m) => ['--precompiled-macro', '${precompiledMacroArg(m, toUri)};'], - ), ...(sources.expand((String uri) => ['--source', uri])), ...(flags.expand((String flag) => ['--enable-experiment', flag])), ]; @@ -196,10 +190,7 @@ class OutlineDillCompilationStep extends CFEStep { bool get needsSources => true; @override - List get dependencyDataNeeded => const [ - dillSummaryId, - precompiledMacroId, - ]; + List get dependencyDataNeeded => const [dillSummaryId]; @override List get moduleDataNeeded => const []; @@ -229,10 +220,7 @@ class FullDillCompilationStep extends CFEStep { bool get needsSources => true; @override - List get dependencyDataNeeded => const [ - dillSummaryId, - precompiledMacroId, - ]; + List get dependencyDataNeeded => const [dillSummaryId]; @override List get moduleDataNeeded => const []; diff --git a/pkg/dev_compiler/lib/src/command/command.dart b/pkg/dev_compiler/lib/src/command/command.dart index 5cc88c5db2e..e9bab198aa4 100644 --- a/pkg/dev_compiler/lib/src/command/command.dart +++ b/pkg/dev_compiler/lib/src/command/command.dart @@ -335,8 +335,7 @@ Future _compile(List args, environmentDefines: declaredVariables, trackNeededDillLibraries: recordUsedInputs, nnbdMode: - options.soundNullSafety ? fe.NnbdMode.Strong : fe.NnbdMode.Weak, - precompiledMacros: options.precompiledMacros); + options.soundNullSafety ? fe.NnbdMode.Strong : fe.NnbdMode.Weak); var incrementalCompiler = compilerState.incrementalCompiler!; var cachedSdkInput = compileSdk ? null diff --git a/pkg/dev_compiler/test/modular_helpers.dart b/pkg/dev_compiler/test/modular_helpers.dart index 550c83e58fa..4214ff18553 100644 --- a/pkg/dev_compiler/test/modular_helpers.dart +++ b/pkg/dev_compiler/test/modular_helpers.dart @@ -9,7 +9,6 @@ import 'package:modular_test/src/create_package_config.dart'; import 'package:modular_test/src/io_pipeline.dart'; import 'package:modular_test/src/pipeline.dart'; import 'package:modular_test/src/runner.dart'; -import 'package:modular_test/src/steps/macro_precompile_aot.dart'; import 'package:modular_test/src/steps/util.dart'; import 'package:modular_test/src/suite.dart'; import 'package:path/path.dart' as p; @@ -34,7 +33,7 @@ class SourceToSummaryDillStep implements IOModularStep { bool get needsSources => true; @override - List get dependencyDataNeeded => const [dillId, precompiledMacroId]; + List get dependencyDataNeeded => const [dillId]; @override List get moduleDataNeeded => const []; @@ -108,10 +107,6 @@ class SourceToSummaryDillStep implements IOModularStep { ...transitiveDependencies .where((m) => !m.isSdk) .expand((m) => ['--input-summary', '${toUri(m, dillId)}']), - ...transitiveDependencies - .where((m) => m.macroConstructors.isNotEmpty) - .expand((m) => - ['--precompiled-macro', '${precompiledMacroArg(m, toUri)};']), ...sources.expand((String uri) => ['--source', uri]), ...flags.expand((String flag) => ['--enable-experiment', flag]), ]; @@ -125,9 +120,6 @@ class SourceToSummaryDillStep implements IOModularStep { void notifyCached(Module module) { if (_options.verbose) print('\ncached step: source-to-dill on $module'); } - - @override - bool shouldExecute(Module module) => true; } class DDCStep implements IOModularStep { @@ -142,7 +134,7 @@ class DDCStep implements IOModularStep { bool get needsSources => true; @override - List get dependencyDataNeeded => const [dillId, precompiledMacroId]; + List get dependencyDataNeeded => const [dillId]; @override List get moduleDataNeeded => const [dillId]; @@ -206,10 +198,6 @@ class DDCStep implements IOModularStep { ...transitiveDependencies .where((m) => !m.isSdk) .expand((m) => ['-s', '${toUri(m, dillId)}=${m.name}']), - ...transitiveDependencies - .where((m) => m.macroConstructors.isNotEmpty) - .expand((m) => - ['--precompiled-macro', '${precompiledMacroArg(m, toUri)};']), '-o', '$output', ]; @@ -222,9 +210,6 @@ class DDCStep implements IOModularStep { void notifyCached(Module module) { if (_options.verbose) print('\ncached step: ddc on $module'); } - - @override - bool shouldExecute(Module module) => true; } class RunD8 implements IOModularStep { @@ -287,9 +272,6 @@ class RunD8 implements IOModularStep { void notifyCached(Module module) { if (_options.verbose) print('\ncached step: d8 on $module'); } - - @override - bool shouldExecute(Module module) => true; } String get _d8executable { diff --git a/pkg/dev_compiler/test/modular_suite.dart b/pkg/dev_compiler/test/modular_suite.dart index dfab3631b89..792cd6bce0b 100644 --- a/pkg/dev_compiler/test/modular_suite.dart +++ b/pkg/dev_compiler/test/modular_suite.dart @@ -9,7 +9,6 @@ library; import 'package:modular_test/src/io_pipeline.dart'; import 'package:modular_test/src/runner.dart'; -import 'package:modular_test/src/steps/macro_precompile_aot.dart'; import 'modular_helpers.dart'; @@ -21,7 +20,6 @@ void main(List args) async { 'tests/modular', options, IOPipeline([ - PrecompileMacroAotStep(verbose: options.verbose), SourceToSummaryDillStep(), DDCStep(canaryFeatures: false), RunD8(), diff --git a/pkg/dev_compiler/test/modular_suite_canary.dart b/pkg/dev_compiler/test/modular_suite_canary.dart index 9646abf263d..cdd1faee47c 100644 --- a/pkg/dev_compiler/test/modular_suite_canary.dart +++ b/pkg/dev_compiler/test/modular_suite_canary.dart @@ -9,7 +9,6 @@ library; import 'package:modular_test/src/io_pipeline.dart'; import 'package:modular_test/src/runner.dart'; -import 'package:modular_test/src/steps/macro_precompile_aot.dart'; import 'modular_helpers.dart'; @@ -21,7 +20,6 @@ void main(List args) async { 'tests/modular', options, IOPipeline([ - PrecompileMacroAotStep(verbose: options.verbose), SourceToSummaryDillStep(), DDCStep(canaryFeatures: true), RunD8(), diff --git a/pkg/front_end/lib/src/api_unstable/ddc.dart b/pkg/front_end/lib/src/api_unstable/ddc.dart index 19296878735..95333281cf5 100644 --- a/pkg/front_end/lib/src/api_unstable/ddc.dart +++ b/pkg/front_end/lib/src/api_unstable/ddc.dart @@ -161,8 +161,6 @@ Future initializeIncrementalCompiler( required Map explicitExperimentalFlags, required Map environmentDefines, bool trackNeededDillLibraries = false, - bool requirePrebuiltMacros = false, - List precompiledMacros = const [], required NnbdMode nnbdMode}) { return modular.initializeIncrementalCompiler( oldState, diff --git a/pkg/modular_test/lib/src/io_pipeline.dart b/pkg/modular_test/lib/src/io_pipeline.dart index d089e4aa009..38bbbf1365b 100644 --- a/pkg/modular_test/lib/src/io_pipeline.dart +++ b/pkg/modular_test/lib/src/io_pipeline.dart @@ -26,10 +26,6 @@ abstract class IOModularStep extends ModularStep { /// should be stored under `root.resolveUri(toUri(module, resultKind))`. Future execute(Module module, Uri root, ModuleDataToRelativeUri toUri, List flags); - - /// Whether this step should apply to [module]. Most steps apply to all - /// modules, but not all. - bool shouldExecute(Module module) => true; } class IOPipeline extends Pipeline { @@ -104,9 +100,6 @@ class IOPipeline extends Pipeline { @override Future runStep(IOModularStep step, Module module, Map> visibleData, List flags) async { - // Skip it if we aren't expected to run. - if (!step.shouldExecute(module)) return; - final resultsFolderUri = _resultsFolderUri!; if (cacheSharedModules && module.isShared) { // If all expected outputs are already available, skip the step. @@ -134,13 +127,8 @@ class IOPipeline extends Pipeline { for (var dataId in visibleData[module]!) { var assetUri = resultsFolderUri .resolve(_toFileName(module, dataId, configSpecific: true)); - var originalFile = File.fromUri(assetUri); - // Some steps don't actually have an output, if they implement - // shouldExecute. - if (!(await originalFile.exists())) continue; - var newPath = - stepFolder.uri.resolve(_toFileName(module, dataId)).toFilePath(); - await originalFile.copy(newPath); + await File.fromUri(assetUri).copy( + stepFolder.uri.resolve(_toFileName(module, dataId)).toFilePath()); } } if (step.needsSources) { @@ -163,10 +151,9 @@ class IOPipeline extends Pipeline { "Step '${step.runtimeType}' on module '${module.name}' didn't " "produce an output file"); } - var newPath = resultsFolderUri + await outputFile.copy(resultsFolderUri .resolve(_toFileName(module, dataId, configSpecific: true)) - .toFilePath(); - await outputFile.copy(newPath); + .toFilePath()); } await stepFolder.delete(recursive: true); } diff --git a/pkg/modular_test/lib/src/loader.dart b/pkg/modular_test/lib/src/loader.dart index 7e7126ec058..61fa60ea913 100644 --- a/pkg/modular_test/lib/src/loader.dart +++ b/pkg/modular_test/lib/src/loader.dart @@ -60,7 +60,7 @@ Future loadTest(Uri uri) async { } var relativeUri = Uri.parse(fileName); var isMain = moduleName == 'main'; - var module = Module(moduleName, [], testUri, [relativeUri], {}, + var module = Module(moduleName, [], testUri, [relativeUri], mainSource: isMain ? relativeUri : null, isMain: isMain, packageBase: Uri.parse('.')); @@ -87,7 +87,7 @@ Future loadTest(Uri uri) async { return _moduleConflict(moduleName, modules[moduleName]!, testUri); } var sources = await _listModuleSources(entryUri); - modules[moduleName] = Module(moduleName, [], testUri, sources, {}, + modules[moduleName] = Module(moduleName, [], testUri, sources, packageBase: Uri.parse('$moduleName/')); } } @@ -109,7 +109,6 @@ Future loadTest(Uri uri) async { await _addModulePerPackage(spec.packages, testUri, modules); _attachDependencies(spec.dependencies, modules); _attachDependencies(defaultTestSpecification.dependencies, modules); - _attachMacros(spec.macros, modules); _addSdkDependencies(modules, sdkModule); _detectCyclesAndRemoveUnreachable(modules, mainModule); var sortedModules = modules.values.toList() @@ -155,20 +154,6 @@ void _attachDependencies( }); } -void _attachMacros(Map>>> macros, - Map modules) { - macros.forEach((name, macroConstructors) { - final module = modules[name]; - if (module == null) { - _invalidTest("declared macros for a nonexistent module named '$name'"); - } - if (module.macroConstructors.isNotEmpty) { - _invalidTest("Module macros have already been declared on $name."); - } - module.macroConstructors.addAll(macroConstructors); - }); -} - /// Make every module depend on the sdk module. void _addSdkDependencies(Map modules, Module sdkModule) { for (var module in modules.values) { @@ -192,8 +177,7 @@ Future _addModulePerPackage(Map packages, Uri configRoot, // TODO(sigmund): validate that we don't use a different alias for a // module that is part of the test (package name and module name should // match). - modules[packageName] = Module( - packageName, [], packageRootUri, sources, {}, + modules[packageName] = Module(packageName, [], packageRootUri, sources, isPackage: true, packageBase: Uri.parse('lib/'), isShared: true); } } @@ -221,7 +205,7 @@ Future _createSdkModule(Uri root) async { } } sources.sort((a, b) => a.path.compareTo(b.path)); - return Module('sdk', [], root, sources, {}, isSdk: true, isShared: true); + return Module('sdk', [], root, sources, isSdk: true, isShared: true); } /// Trim the set of modules, and detect cycles while we are at it. diff --git a/pkg/modular_test/lib/src/steps/macro_precompile_aot.dart b/pkg/modular_test/lib/src/steps/macro_precompile_aot.dart deleted file mode 100644 index 5f5b4b8b1b6..00000000000 --- a/pkg/modular_test/lib/src/steps/macro_precompile_aot.dart +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file -// for details. 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'; - -// ignore: implementation_imports -import 'package:macros/src/bootstrap.dart'; -// ignore: implementation_imports -import 'package:macros/src/executor/serialization.dart'; - -import 'util.dart'; -import '../create_package_config.dart'; -import '../io_pipeline.dart'; -import '../pipeline.dart'; -import '../suite.dart'; - -const precompiledMacroId = DataId('macro.exe'); - -/// Bootstraps a macro program and compiles it to an AOT executable. -class PrecompileMacroAotStep implements IOModularStep { - final bool verbose; - - PrecompileMacroAotStep({required this.verbose}); - - @override - List get resultData => const [precompiledMacroId]; - - @override - bool get needsSources => true; - - @override - List get dependencyDataNeeded => const []; - - @override - List get moduleDataNeeded => const []; - - @override - bool get onlyOnMain => false; - - @override - bool get onlyOnSdk => false; - - @override - bool get notOnSdk => true; - - @override - Future execute(Module module, Uri root, ModuleDataToRelativeUri toUri, - List flags) async { - if (verbose) { - print('\nstep: precompile-macro-aot on $module'); - } - - var transitiveDependencies = computeTransitiveDependencies(module); - var packageConfigUri = await writePackageConfig( - module, transitiveDependencies, root, - useRealPaths: true); - - var bootstrapContent = bootstrapMacroIsolate( - module.macroConstructors, SerializationMode.byteData) - // TODO: Don't do this https://github.com/dart-lang/sdk/issues/55388 - .replaceFirst('dev-dart-app:/', ''); - var bootstrapFile = File.fromUri( - root.replace(path: '${root.path}/${module.name}.macro.bootstrap.dart')); - await bootstrapFile.create(recursive: true); - await bootstrapFile.writeAsString(bootstrapContent); - - var args = [ - 'compile', - 'exe', - '--packages', - packageConfigUri.toFilePath(), - '--output', - '${toUri(module, precompiledMacroId)}', - ...flags.expand((String flag) => ['--enable-experiment', flag]), - bootstrapFile.path, - ]; - - var result = await runProcess( - Platform.resolvedExecutable, args, root.toFilePath(), verbose); - checkExitCode(result, this, module, verbose); - } - - @override - void notifyCached(Module module) { - if (verbose) { - print('\ncached step: precompile-macro-aot on $module'); - } - } - - @override - bool shouldExecute(Module module) => module.macroConstructors.isNotEmpty; -} - -// The value of the --precompiled-macro argument for macros coming from -// `module`. -String precompiledMacroArg(Module module, ModuleDataToRelativeUri toUri) { - var executableUri = toUri(module, precompiledMacroId); - return '$executableUri;${module.macroConstructors.keys.join(';')}'; -} diff --git a/pkg/modular_test/lib/src/suite.dart b/pkg/modular_test/lib/src/suite.dart index fd4e590742d..709ae7ae27e 100644 --- a/pkg/modular_test/lib/src/suite.dart +++ b/pkg/modular_test/lib/src/suite.dart @@ -65,17 +65,7 @@ class Module { /// will be true only for the SDK and shared packages like `package:expect`. bool isShared; - /// A map containing information about the macros defined in the module. - /// - /// The outer map is keyed on the source URI, and the values are the macros - /// defined in that source. - /// - /// The inner map is keyed on class names, and the values are lists of the - /// names of the public constructors for those macros. - Map>> macroConstructors; - Module(this.name, this.dependencies, this.rootUri, this.sources, - this.macroConstructors, {this.mainSource, this.isPackage = false, this.isMain = false, diff --git a/pkg/modular_test/lib/src/test_specification_parser.dart b/pkg/modular_test/lib/src/test_specification_parser.dart index 2650cd41d53..aa34403ab9f 100644 --- a/pkg/modular_test/lib/src/test_specification_parser.dart +++ b/pkg/modular_test/lib/src/test_specification_parser.dart @@ -110,60 +110,7 @@ TestSpecification parseTestSpecification(String contents) { _invalidSpecification("packages is not a map"); } } - - final Map>>> normalizedMacros = - {}; - var macros = spec['macros']; - if (macros != null) { - if (macros is Map) { - macros.forEach((module, macroConfig) { - if (module is! String) { - _invalidSpecification("macros key $module was not a String"); - } - if (macroConfig is! Map) { - _invalidSpecification( - "macros[$module] value $macroConfig was not a Map"); - } - var normalizedConfig = normalizedMacros[module] = {}; - macroConfig.forEach((library, macroConstructors) { - if (library is! String) { - _invalidSpecification( - "macros[$module] key `$library` was not a String"); - } - if (macroConstructors is! Map) { - _invalidSpecification( - "macros[$module][$library] value `$macroConstructors` was not " - "a Map"); - } - var normalizedConstructors = normalizedConfig[library] = {}; - macroConstructors.forEach((clazz, constructors) { - if (clazz is! String) { - _invalidSpecification( - "macros[$module][$library] key `$clazz` was not a String"); - } - if (constructors is! List) { - _invalidSpecification( - "macro[$module][$library][$clazz] value `$constructors` was " - "not a List"); - } - var constructorNames = normalizedConstructors[clazz] = []; - for (var constructor in constructors) { - if (constructor is! String) { - _invalidSpecification( - "macros[$module][$library][$clazz] element `$constructor` " - "was not a String"); - } - constructorNames.add(constructor); - } - }); - }); - }); - } else { - _invalidSpecification("macros is not a Map"); - } - } - return TestSpecification( - normalizedFlags, normalizedMap, normalizedPackages, normalizedMacros); + return TestSpecification(normalizedFlags, normalizedMap, normalizedPackages); } /// Data specifying details about a modular test including dependencies and @@ -189,15 +136,7 @@ class TestSpecification { /// where this test specification was defined. final Map packages; - /// A map containing information about the macros defined in each module. - /// - /// The keys are the macro names, and the values describe the macros in each - /// module. - /// - /// See the `Module` class for more information about the values. - final Map>>> macros; - - TestSpecification(this.flags, this.dependencies, this.packages, this.macros); + TestSpecification(this.flags, this.dependencies, this.packages); } Never _invalidSpecification(String message) { diff --git a/pkg/modular_test/pubspec.yaml b/pkg/modular_test/pubspec.yaml index 8a73b3c3c28..505ca79fdbf 100644 --- a/pkg/modular_test/pubspec.yaml +++ b/pkg/modular_test/pubspec.yaml @@ -12,7 +12,6 @@ environment: # Use 'any' constraints here; we get our versions from the DEPS file. dependencies: args: any - macros: any package_config: any yaml: any diff --git a/pkg/modular_test/test/io_pipeline_test.dart b/pkg/modular_test/test/io_pipeline_test.dart index d30c5adc811..aa4e818f06e 100644 --- a/pkg/modular_test/test/io_pipeline_test.dart +++ b/pkg/modular_test/test/io_pipeline_test.dart @@ -136,9 +136,6 @@ class SourceOnlyStep implements IOModularStep { @override void notifyCached(Module module) {} - - @override - bool shouldExecute(Module module) => true; } class ModuleDataStep implements IOModularStep { @@ -175,9 +172,6 @@ class ModuleDataStep implements IOModularStep { @override void notifyCached(Module module) {} - - @override - bool shouldExecute(Module module) => true; } class TwoOutputStep implements IOModularStep { @@ -220,9 +214,6 @@ class TwoOutputStep implements IOModularStep { @override void notifyCached(Module module) {} - - @override - bool shouldExecute(Module module) => true; } class LinkStep implements IOModularStep { @@ -264,9 +255,6 @@ class LinkStep implements IOModularStep { @override void notifyCached(Module module) {} - - @override - bool shouldExecute(Module module) => true; } class MainOnlyStep implements IOModularStep { @@ -308,9 +296,6 @@ class MainOnlyStep implements IOModularStep { @override void notifyCached(Module module) {} - - @override - bool shouldExecute(Module module) => true; } Future _readHelper(Module module, Uri root, DataId dataId, diff --git a/pkg/modular_test/test/pipeline_common.dart b/pkg/modular_test/test/pipeline_common.dart index 7e13902ccca..7cef7e3eff5 100644 --- a/pkg/modular_test/test/pipeline_common.dart +++ b/pkg/modular_test/test/pipeline_common.dart @@ -101,12 +101,11 @@ runPipelineTest(PipelineTestStrategy testStrategy) { }; var m1 = Module("a", const [], testStrategy.testRootUri, - [Uri.parse("a1.dart"), Uri.parse("a2.dart")], {}, + [Uri.parse("a1.dart"), Uri.parse("a2.dart")], isShared: true); var m2 = Module("b", [m1], testStrategy.testRootUri, - [Uri.parse("b/b1.dart"), Uri.parse("b/b2.dart")], {}); - var m3 = Module( - "c", [m2], testStrategy.testRootUri, [Uri.parse("c.dart")], {}, + [Uri.parse("b/b1.dart"), Uri.parse("b/b2.dart")]); + var m3 = Module("c", [m2], testStrategy.testRootUri, [Uri.parse("c.dart")], isMain: true); var singleModuleInput = ModularTest([m1], m1, []); diff --git a/pkg/modular_test/test/validate_suite_test.dart b/pkg/modular_test/test/validate_suite_test.dart index 6e98c314dc7..742a9ef4f3b 100644 --- a/pkg/modular_test/test/validate_suite_test.dart +++ b/pkg/modular_test/test/validate_suite_test.dart @@ -10,23 +10,23 @@ import 'package:modular_test/src/suite.dart'; main() { test('module test is not empty', () { - var m = Module("a", [], Uri.parse("app:/"), [], {}); + var m = Module("a", [], Uri.parse("app:/"), []); expect(() => ModularTest([], m, []), throwsA(TypeMatcher())); }); test('package must depend on package', () { var m1a = Module("a", const [], Uri.parse("app:/"), - [Uri.parse("a1.dart"), Uri.parse("a2.dart")], {}, + [Uri.parse("a1.dart"), Uri.parse("a2.dart")], isPackage: false); var m1b = Module("a", const [], Uri.parse("app:/"), - [Uri.parse("a1.dart"), Uri.parse("a2.dart")], {}, + [Uri.parse("a1.dart"), Uri.parse("a2.dart")], isPackage: true); var m2a = Module("b", [m1a], Uri.parse("app:/"), - [Uri.parse("b/b1.dart"), Uri.parse("b/b2.dart")], {}, + [Uri.parse("b/b1.dart"), Uri.parse("b/b2.dart")], isPackage: true); var m2b = Module("b", [m1b], Uri.parse("app:/"), - [Uri.parse("b/b1.dart"), Uri.parse("b/b2.dart")], {}, + [Uri.parse("b/b1.dart"), Uri.parse("b/b2.dart")], isPackage: true); expect(() => ModularTest([m1a, m2a], m2a, []), throwsA(TypeMatcher())); @@ -35,17 +35,17 @@ main() { test('shared module must depend on shared modules', () { var m1a = Module("a", const [], Uri.parse("app:/"), - [Uri.parse("a1.dart"), Uri.parse("a2.dart")], {}, + [Uri.parse("a1.dart"), Uri.parse("a2.dart")], isShared: false); var m1b = Module("a", const [], Uri.parse("app:/"), - [Uri.parse("a1.dart"), Uri.parse("a2.dart")], {}, + [Uri.parse("a1.dart"), Uri.parse("a2.dart")], isShared: true); var m2a = Module("b", [m1a], Uri.parse("app:/"), - [Uri.parse("b/b1.dart"), Uri.parse("b/b2.dart")], {}, + [Uri.parse("b/b1.dart"), Uri.parse("b/b2.dart")], isShared: true); var m2b = Module("b", [m1b], Uri.parse("app:/"), - [Uri.parse("b/b1.dart"), Uri.parse("b/b2.dart")], {}, + [Uri.parse("b/b1.dart"), Uri.parse("b/b2.dart")], isShared: true); expect(() => ModularTest([m1a, m2a], m2a, []), throwsA(TypeMatcher())); @@ -54,17 +54,17 @@ main() { test('sdk module must not have dependencies', () { var m1a = Module("a", const [], Uri.parse("app:/"), - [Uri.parse("a1.dart"), Uri.parse("a2.dart")], {}, + [Uri.parse("a1.dart"), Uri.parse("a2.dart")], isSdk: false); var m1b = Module("a", const [], Uri.parse("app:/"), - [Uri.parse("a1.dart"), Uri.parse("a2.dart")], {}, + [Uri.parse("a1.dart"), Uri.parse("a2.dart")], isSdk: true); var m2a = Module("b", [m1a], Uri.parse("app:/"), - [Uri.parse("b/b1.dart"), Uri.parse("b/b2.dart")], {}, + [Uri.parse("b/b1.dart"), Uri.parse("b/b2.dart")], isSdk: true); var m2b = Module("b", [m1b], Uri.parse("app:/"), - [Uri.parse("b/b1.dart"), Uri.parse("b/b2.dart")], {}, + [Uri.parse("b/b1.dart"), Uri.parse("b/b2.dart")], isSdk: true); expect(() => ModularTest([m1a, m2a], m2a, []), throwsA(TypeMatcher())); @@ -74,7 +74,7 @@ main() { test('sdk module cannot be package module', () { var m = Module("a", const [], Uri.parse("app:/"), - [Uri.parse("a1.dart"), Uri.parse("a2.dart")], {}, + [Uri.parse("a1.dart"), Uri.parse("a2.dart")], isSdk: true); expect(ModularTest([m], m, []), isNotNull);