Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
412e4dd5
Unverified
Commit
412e4dd5
authored
Apr 08, 2020
by
Jonah Williams
Committed by
GitHub
Apr 08, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] migrate devfs web to package_config (#54299)
parent
dbecf2af
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
24 deletions
+19
-24
devfs_web.dart
packages/flutter_tools/lib/src/build_runner/devfs_web.dart
+14
-14
devfs_web_test.dart
.../flutter_tools/test/general.shard/web/devfs_web_test.dart
+5
-10
No files found.
packages/flutter_tools/lib/src/build_runner/devfs_web.dart
View file @
412e4dd5
...
...
@@ -10,12 +10,7 @@ import 'package:dwds/dwds.dart';
import
'package:logging/logging.dart'
;
import
'package:meta/meta.dart'
;
import
'package:mime/mime.dart'
as
mime
;
// TODO(bkonyi): remove deprecated member usage, https://github.com/flutter/flutter/issues/51951
// ignore: deprecated_member_use
import
'package:package_config/discovery.dart'
;
// TODO(bkonyi): remove deprecated member usage, https://github.com/flutter/flutter/issues/51951
// ignore: deprecated_member_use
import
'package:package_config/packages.dart'
;
import
'package:package_config/package_config.dart'
;
import
'package:shelf/shelf.dart'
as
shelf
;
import
'package:shelf/shelf_io.dart'
as
shelf
;
...
...
@@ -31,6 +26,7 @@ import '../bundle.dart';
import
'../cache.dart'
;
import
'../compile.dart'
;
import
'../convert.dart'
;
import
'../dart/package_map.dart'
;
import
'../devfs.dart'
;
import
'../globals.dart'
as
globals
;
import
'../web/bootstrap.dart'
;
...
...
@@ -142,15 +138,21 @@ class WebAssetServer implements AssetReader {
try
{
final
InternetAddress
address
=
(
await
InternetAddress
.
lookup
(
hostname
)).
first
;
final
HttpServer
httpServer
=
await
HttpServer
.
bind
(
address
,
port
);
// TODO(bkonyi): remove deprecated member usage, https://github.com/flutter/flutter/issues/51951
// ignore: deprecated_member_use
final
Packages
packages
=
await
loadPackagesFile
(
Uri
.
base
.
resolve
(
'.packages'
),
loader:
(
Uri
uri
)
=>
globals
.
fs
.
file
(
uri
).
readAsBytes
());
final
PackageConfig
packageConfig
=
await
loadPackageConfigUri
(
globals
.
fs
.
file
(
PackageMap
.
globalPackagesPath
).
absolute
.
uri
,
loader:
(
Uri
uri
)
{
final
File
file
=
globals
.
fs
.
file
(
uri
);
if
(!
file
.
existsSync
())
{
return
null
;
}
return
file
.
readAsBytes
();
}
);
final
Map
<
String
,
String
>
digests
=
<
String
,
String
>{};
final
Map
<
String
,
String
>
modules
=
<
String
,
String
>{};
final
WebAssetServer
server
=
WebAssetServer
(
httpServer
,
package
s
,
package
Config
,
address
,
modules
,
digests
,
...
...
@@ -248,9 +250,7 @@ class WebAssetServer implements AssetReader {
// RandomAccessFile and read on demand.
final
Map
<
String
,
Uint8List
>
_files
=
<
String
,
Uint8List
>{};
final
Map
<
String
,
Uint8List
>
_sourcemaps
=
<
String
,
Uint8List
>{};
// TODO(bkonyi): remove deprecated member usage, https://github.com/flutter/flutter/issues/51951
// ignore: deprecated_member_use
final
Packages
_packages
;
final
PackageConfig
_packages
;
final
InternetAddress
internetAddress
;
/* late final */
Dwds
dwds
;
Directory
entrypointCacheDirectory
;
...
...
packages/flutter_tools/test/general.shard/web/devfs_web_test.dart
View file @
412e4dd5
...
...
@@ -18,12 +18,7 @@ import 'package:flutter_tools/src/convert.dart';
import
'package:flutter_tools/src/build_runner/devfs_web.dart'
;
import
'package:logging/logging.dart'
;
import
'package:mockito/mockito.dart'
;
// TODO(bkonyi): remove deprecated member usage, https://github.com/flutter/flutter/issues/51951
// ignore: deprecated_member_use
import
'package:package_config/discovery.dart'
;
// TODO(bkonyi): remove deprecated member usage, https://github.com/flutter/flutter/issues/51951
// ignore: deprecated_member_use
import
'package:package_config/packages.dart'
;
import
'package:package_config/package_config.dart'
;
import
'package:platform/platform.dart'
;
import
'package:flutter_tools/src/globals.dart'
as
globals
;
import
'package:shelf/shelf.dart'
;
...
...
@@ -43,14 +38,12 @@ void main() {
Testbed
testbed
;
WebAssetServer
webAssetServer
;
Platform
linux
;
// TODO(bkonyi): remove deprecated member usage, https://github.com/flutter/flutter/issues/51951
// ignore: deprecated_member_use
Packages
packages
;
PackageConfig
packages
;
Platform
windows
;
MockHttpServer
mockHttpServer
;
setUpAll
(()
async
{
packages
=
await
loadPackage
sFile
(
Uri
.
base
.
resolve
(
'.packages'
));
packages
=
await
loadPackage
ConfigUri
(
Uri
.
base
.
resolve
(
'.packages'
));
});
setUp
(()
{
...
...
@@ -354,6 +347,7 @@ void main() {
}));
test
(
'Can start web server with specified assets'
,
()
=>
testbed
.
run
(()
async
{
globals
.
fs
.
file
(
'.packages'
).
writeAsStringSync
(
'
\n
'
);
final
File
outputFile
=
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
'lib'
,
'main.dart'
))
..
createSync
(
recursive:
true
);
outputFile
.
parent
.
childFile
(
'a.sources'
).
writeAsStringSync
(
''
);
...
...
@@ -442,6 +436,7 @@ void main() {
}));
test
(
'Launches DWDS with the correct arguments'
,
()
=>
testbed
.
run
(()
async
{
globals
.
fs
.
file
(
'.packages'
).
writeAsStringSync
(
'
\n
'
);
final
WebAssetServer
server
=
await
WebAssetServer
.
start
(
'localhost'
,
8123
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment