@@ -10,22 +10,17 @@ import 'dart:io';
1010
1111import 'package:dwds/dwds.dart' ;
1212import 'package:file/file.dart' ;
13- import 'package:logging/logging.dart' ;
1413import 'package:meta/meta.dart' ;
1514import 'package:package_config/package_config.dart' ;
1615import 'package:path/path.dart' as p;
1716
18- import 'asset.dart' ;
1917import 'asset_server.dart' ;
2018import 'bootstrap.dart' ;
21- import 'devfs_content.dart' ;
2219import 'frontend_server_client.dart' ;
2320import 'utilities.dart' ;
2421
2522final String dartWebSdkPath = p.join (dartSdkPath, 'lib' , 'dev_compiler' );
2623
27- Logger _logger = Logger ('WebDevFs' );
28-
2924class WebDevFS {
3025 WebDevFS ({
3126 this .fileSystem,
@@ -71,7 +66,6 @@ class WebDevFS {
7166
7267 Future <UpdateFSReport > update ({
7368 String mainPath,
74- AssetBundle bundle,
7569 String dillOutputPath,
7670 @required ResidentCompiler generator,
7771 List <Uri > invalidatedFiles,
@@ -101,17 +95,8 @@ class WebDevFS {
10195 soundNullSafety ? dartSdkSourcemapSound : dartSdkSourcemap;
10296 assetServer.writeFile ('/dart_sdk.js' , sdk.readAsStringSync ());
10397 assetServer.writeFile ('/dart_sdk.js.map' , sdkSourceMap.readAsStringSync ());
104- // TODO(jonahwilliams): refactor the asset code in this and the regular devfs to
105- // be shared.
106- if (bundle != null ) {
107- await writeBundle (
108- fileSystem.directory (p.joinAll (['build' , 'assets' ])),
109- bundle.entries,
110- );
111- }
11298
11399 generator.reset ();
114-
115100 var compilerOutput = await generator.recompile (
116101 Uri .parse ('org-dartlang-app:///$mainPath ' ), invalidatedFiles,
117102 outputPath: p.join (dillOutputPath, 'app.dill' ),
@@ -191,6 +176,30 @@ class WebDevFS {
191176 ));
192177}
193178
179+ class UpdateFSReport {
180+ final bool _success;
181+ final int _invalidatedSourcesCount;
182+ final int _syncedBytes;
183+
184+ UpdateFSReport ({
185+ bool success = false ,
186+ int invalidatedSourcesCount = 0 ,
187+ int syncedBytes = 0 ,
188+ }) : _success = success,
189+ _invalidatedSourcesCount = invalidatedSourcesCount,
190+ _syncedBytes = syncedBytes;
191+
192+ bool get success => _success;
193+ int get invalidatedSourcesCount => _invalidatedSourcesCount;
194+ int get syncedBytes => _syncedBytes;
195+
196+ /// JavaScript modules produced by the incremental compiler in `dartdevc`
197+ /// mode.
198+ ///
199+ /// Only used for JavaScript compilation.
200+ List <String > invalidatedModules;
201+ }
202+
194203String _filePathToUriFragment (String path) {
195204 if (Platform .isWindows) {
196205 var startWithSlash = path.startsWith ('/' );
@@ -203,26 +212,3 @@ String _filePathToUriFragment(String path) {
203212 }
204213 return path;
205214}
206-
207- Future <void > writeBundle (
208- Directory bundleDir, Map <String , DevFSContent > assetEntries) async {
209- if (bundleDir.existsSync ()) {
210- try {
211- bundleDir.deleteSync (recursive: true );
212- } on FileSystemException catch (e, s) {
213- _logger.warning (
214- 'Failed to clean up asset directory ${bundleDir .path }.\n '
215- 'To clean build artifacts, use the command "flutter clean".' ,
216- e,
217- s);
218- }
219- }
220- bundleDir.createSync (recursive: true );
221-
222- await Future .wait <void >(assetEntries.entries
223- .map <Future <void >>((MapEntry <String , DevFSContent > entry) async {
224- var file = fileSystem.file (fileSystem.path.join (bundleDir.path, entry.key));
225- file.parent.createSync (recursive: true );
226- await file.writeAsBytes (await entry.value.contentsAsBytes ());
227- }));
228- }
0 commit comments