@@ -41,54 +41,43 @@ class SdkAssetGenerator {
4141 // normally generated by setup tools and their builds,
4242 // i.e. flutter SDK or build_web_compilers.
4343 // Generate missing files for tests if needed.
44- await _generateSdkJavaScript (
45- canaryFeatures: canaryFeatures,
46- );
44+ await _generateSdkJavaScript (canaryFeatures: canaryFeatures);
4745
4846 // SDK does not contain any weak assets, generate them.
49- await _generateSdkJavaScript (
50- canaryFeatures: canaryFeatures,
51- );
47+ await _generateSdkJavaScript (canaryFeatures: canaryFeatures);
5248 await _generateSdkSummary ();
5349 }
5450 }
5551
56- String resolveSdkJsPath ({
57- required bool canaryFeatures,
58- }) =>
52+ String resolveSdkJsPath ({required bool canaryFeatures}) =>
5953 switch (ddcModuleFormat) {
6054 ModuleFormat .amd => sdkLayout.amdJsPath,
6155 ModuleFormat .ddc => sdkLayout.ddcJsPath,
62- _ => throw Exception ('Unsupported DDC module format $ddcModuleFormat .' )
56+ _ => throw Exception ('Unsupported DDC module format $ddcModuleFormat .' ),
6357 };
6458
65- String resolveSdkSourcemapPath ({
66- required bool canaryFeatures,
67- }) =>
59+ String resolveSdkSourcemapPath ({required bool canaryFeatures}) =>
6860 switch (ddcModuleFormat) {
6961 ModuleFormat .amd => sdkLayout.amdJsMapPath,
7062 ModuleFormat .ddc => sdkLayout.ddcJsMapPath,
71- _ => throw Exception ('Unsupported DDC module format $ddcModuleFormat .' )
63+ _ => throw Exception ('Unsupported DDC module format $ddcModuleFormat .' ),
7264 };
7365
74- String resolveSdkJsFilename ({
75- required bool canaryFeatures,
76- }) =>
66+ String resolveSdkJsFilename ({required bool canaryFeatures}) =>
7767 switch (ddcModuleFormat) {
7868 ModuleFormat .amd => sdkLayout.amdJsFileName,
7969 ModuleFormat .ddc => sdkLayout.ddcJsFileName,
80- _ => throw Exception ('Unsupported DDC module format $ddcModuleFormat .' )
70+ _ => throw Exception ('Unsupported DDC module format $ddcModuleFormat .' ),
8171 };
8272
83- Future <void > _generateSdkJavaScript ({
84- required bool canaryFeatures,
85- }) async {
73+ Future <void > _generateSdkJavaScript ({required bool canaryFeatures}) async {
8674 Directory ? outputDir;
8775 try {
8876 // Files to copy generated files to.
8977 final outputJsPath = resolveSdkJsPath (canaryFeatures: canaryFeatures);
90- final outputJsMapPath =
91- resolveSdkSourcemapPath (canaryFeatures: canaryFeatures);
78+ final outputJsMapPath = resolveSdkSourcemapPath (
79+ canaryFeatures: canaryFeatures,
80+ );
9281 final outputFullDillPath = sdkLayout.fullDillPath;
9382
9483 final hasJsAsset = _exists (outputJsPath);
@@ -104,7 +93,9 @@ class SdkAssetGenerator {
10493
10594 // Files to generate
10695 final jsPath = p.join (
107- outputDir.path, resolveSdkJsFilename (canaryFeatures: canaryFeatures));
96+ outputDir.path,
97+ resolveSdkJsFilename (canaryFeatures: canaryFeatures),
98+ );
10899 final jsMapPath = p.setExtension (jsPath, '.js.map' );
109100 final fullDillPath = p.setExtension (jsPath, '.dill' );
110101
@@ -132,24 +123,27 @@ class SdkAssetGenerator {
132123
133124 final output = < String > [];
134125 _logger.fine ('Executing dart ${args .join (' ' )}' );
135- final process = await Process .start (sdkLayout.dartPath, args,
136- workingDirectory: sdkLayout.sdkDirectory);
126+ final process = await Process .start (
127+ sdkLayout.dartPath,
128+ args,
129+ workingDirectory: sdkLayout.sdkDirectory,
130+ );
137131
138132 process.stdout
139133 .transform <String >(utf8.decoder)
140134 .transform <String >(const LineSplitter ())
141135 .listen ((line) {
142- _logger.fine (line);
143- output.add (line);
144- });
136+ _logger.fine (line);
137+ output.add (line);
138+ });
145139
146140 process.stderr
147141 .transform <String >(utf8.decoder)
148142 .transform <String >(const LineSplitter ())
149143 .listen ((line) {
150- _logger.warning (line);
151- output.add (line);
152- });
144+ _logger.warning (line);
145+ output.add (line);
146+ });
153147
154148 await process.exitCode.then ((int code) {
155149 if (code != 0 ) {
@@ -169,7 +163,10 @@ class SdkAssetGenerator {
169163 _logger.info ('Done generating js and full dill SDK files.' );
170164 } catch (e, s) {
171165 _logger.severe (
172- 'Failed to generate SDK js, source map, and full dill' , e, s);
166+ 'Failed to generate SDK js, source map, and full dill' ,
167+ e,
168+ s,
169+ );
173170 rethrow ;
174171 } finally {
175172 outputDir? .deleteSync (recursive: true );
@@ -213,30 +210,34 @@ class SdkAssetGenerator {
213210 ];
214211
215212 _logger.fine ('Executing dart ${args .join (' ' )}' );
216- final process = await Process .start (sdkLayout.dartPath, args,
217- workingDirectory: sdkLayout.sdkDirectory);
213+ final process = await Process .start (
214+ sdkLayout.dartPath,
215+ args,
216+ workingDirectory: sdkLayout.sdkDirectory,
217+ );
218218
219219 final output = < String > [];
220220 process.stdout
221221 .transform <String >(utf8.decoder)
222222 .transform <String >(const LineSplitter ())
223223 .listen ((line) {
224- _logger.fine (line);
225- output.add (line);
226- });
224+ _logger.fine (line);
225+ output.add (line);
226+ });
227227
228228 process.stderr
229229 .transform <String >(utf8.decoder)
230230 .transform <String >(const LineSplitter ())
231231 .listen ((line) {
232- _logger.warning (line);
233- output.add (line);
234- });
232+ _logger.warning (line);
233+ output.add (line);
234+ });
235235
236236 await process.exitCode.then ((int code) {
237237 if (code != 0 ) {
238- _logger
239- .warning ('Error generating $summaryPath : ${output .join ('\n ' )}' );
238+ _logger.warning (
239+ 'Error generating $summaryPath : ${output .join ('\n ' )}' ,
240+ );
240241 throw Exception ('The Dart kernel worker exited unexpectedly' );
241242 }
242243 });
0 commit comments