@@ -10,22 +10,17 @@ import 'dart:io';
10
10
11
11
import 'package:dwds/dwds.dart' ;
12
12
import 'package:file/file.dart' ;
13
- import 'package:logging/logging.dart' ;
14
13
import 'package:meta/meta.dart' ;
15
14
import 'package:package_config/package_config.dart' ;
16
15
import 'package:path/path.dart' as p;
17
16
18
- import 'asset.dart' ;
19
17
import 'asset_server.dart' ;
20
18
import 'bootstrap.dart' ;
21
- import 'devfs_content.dart' ;
22
19
import 'frontend_server_client.dart' ;
23
20
import 'utilities.dart' ;
24
21
25
22
final String dartWebSdkPath = p.join (dartSdkPath, 'lib' , 'dev_compiler' );
26
23
27
- Logger _logger = Logger ('WebDevFs' );
28
-
29
24
class WebDevFS {
30
25
WebDevFS ({
31
26
this .fileSystem,
@@ -71,7 +66,6 @@ class WebDevFS {
71
66
72
67
Future <UpdateFSReport > update ({
73
68
String mainPath,
74
- AssetBundle bundle,
75
69
String dillOutputPath,
76
70
@required ResidentCompiler generator,
77
71
List <Uri > invalidatedFiles,
@@ -101,17 +95,8 @@ class WebDevFS {
101
95
soundNullSafety ? dartSdkSourcemapSound : dartSdkSourcemap;
102
96
assetServer.writeFile ('/dart_sdk.js' , sdk.readAsStringSync ());
103
97
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
- }
112
98
113
99
generator.reset ();
114
-
115
100
var compilerOutput = await generator.recompile (
116
101
Uri .parse ('org-dartlang-app:///$mainPath ' ), invalidatedFiles,
117
102
outputPath: p.join (dillOutputPath, 'app.dill' ),
@@ -191,6 +176,30 @@ class WebDevFS {
191
176
));
192
177
}
193
178
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
+
194
203
String _filePathToUriFragment (String path) {
195
204
if (Platform .isWindows) {
196
205
var startWithSlash = path.startsWith ('/' );
@@ -203,26 +212,3 @@ String _filePathToUriFragment(String path) {
203
212
}
204
213
return path;
205
214
}
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