Skip to content

Commit 6e5fb8b

Browse files
natebiggsCommit Queue
authored andcommitted
[dart2wasm] Add support for dynamic module options.
Usage of these flags will be added in subsequent changes but having them checked in unblocks adding references to them from the testing infrastructure. Change-Id: I336f06f57752fac5c19cb2c1c3db623edaef79b5 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/400902 Reviewed-by: Martin Kustermann <[email protected]> Commit-Queue: Nate Biggs <[email protected]>
1 parent 7bea7d1 commit 6e5fb8b

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

pkg/dart2wasm/lib/compiler_options.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ class WasmCompilerOptions {
1616
String outputFile;
1717
String? depFile;
1818
String? outputJSRuntimeFile;
19+
Uri? dynamicModuleMainUri;
20+
Uri? dynamicInterfaceUri;
21+
Uri? dynamicModuleMetadataFile;
1922
Map<String, String> environment = {};
2023
Map<fe.ExperimentalFlag, bool> feExperimentalFlags = const {};
2124
String? multiRootScheme;

pkg/dart2wasm/lib/dart2wasm.dart

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,23 @@ final List<Option> options = [
102102
Flag("enable-multi-module-stress-test-mode",
103103
(o, value) => o.translatorOptions.enableMultiModuleStressTestMode = value,
104104
defaultsTo: _d.translatorOptions.enableMultiModuleStressTestMode),
105+
// Flags for dynamic modules
106+
// The modified dill file produced by the main module compilation for dynamic
107+
// modules. Providing this and not "dynamic-module-interface" indicates that
108+
// this is a compilation of a dynamic module. The dill will contain the AST
109+
// for the main module as well as some annotations to help identify entities
110+
// when compiling dynamic modules.
111+
UriOption(
112+
"dynamic-module-main", (o, value) => o.dynamicModuleMainUri = value),
113+
// A yaml file describing the interface of the main module accessible from
114+
// dynamic modules. Providing this indicates to the dart2wasm that the module
115+
// produced should support dynamic modules.
116+
UriOption(
117+
"dynamic-module-interface", (o, value) => o.dynamicInterfaceUri = value),
118+
// A binary metadata file produced by the main module compilation for dynamic
119+
// modules.
120+
UriOption("dynamic-module-metadata",
121+
(o, value) => o.dynamicModuleMetadataFile = value),
105122
];
106123

107124
Map<fe.ExperimentalFlag, bool> processFeExperimentalFlags(
@@ -116,7 +133,8 @@ Map<String, String> processEnvironment(List<String> defines) =>
116133
if (index == -1) {
117134
throw ArgumentError('Bad define string: $d');
118135
}
119-
return MapEntry<String, String>(d.substring(0, index), d.substring(index + 1));
136+
return MapEntry<String, String>(
137+
d.substring(0, index), d.substring(index + 1));
120138
}));
121139

122140
WasmCompilerOptions parseArguments(List<String> arguments) {

0 commit comments

Comments
 (0)