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
84ce3f60
Unverified
Commit
84ce3f60
authored
Nov 26, 2019
by
Jonah Williams
Committed by
GitHub
Nov 26, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Serve web source maps in release runner (#45318)
parent
46632f9e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
3 deletions
+42
-3
web_fs.dart
packages/flutter_tools/lib/src/build_runner/web_fs.dart
+19
-3
asset_server_test.dart
...utter_tools/test/general.shard/web/asset_server_test.dart
+23
-0
No files found.
packages/flutter_tools/lib/src/build_runner/web_fs.dart
View file @
84ce3f60
...
...
@@ -353,11 +353,27 @@ abstract class AssetServer {
}
class
ReleaseAssetServer
extends
AssetServer
{
// Locations where source files, assets, or source maps may be located.
final
List
<
Uri
>
_searchPaths
=
<
Uri
>[
fs
.
directory
(
getWebBuildDirectory
()).
uri
,
fs
.
directory
(
Cache
.
flutterRoot
).
parent
.
uri
,
fs
.
currentDirectory
.
childDirectory
(
'lib'
).
uri
,
];
@override
Future
<
Response
>
handle
(
Request
request
)
async
{
final
Uri
artifactUri
=
fs
.
directory
(
getWebBuildDirectory
()).
uri
.
resolveUri
(
request
.
url
);
final
File
file
=
fs
.
file
(
artifactUri
);
if
(
file
.
existsSync
())
{
Uri
fileUri
;
for
(
Uri
uri
in
_searchPaths
)
{
final
Uri
potential
=
uri
.
resolve
(
request
.
url
.
path
);
if
(
potential
==
null
||
!
fs
.
isFileSync
(
potential
.
toFilePath
()))
{
continue
;
}
fileUri
=
potential
;
break
;
}
if
(
fileUri
!=
null
)
{
final
File
file
=
fs
.
file
(
fileUri
);
final
Uint8List
bytes
=
file
.
readAsBytesSync
();
// Fallback to "application/octet-stream" on null which
// makes no claims as to the structure of the data.
...
...
packages/flutter_tools/test/general.shard/web/asset_server_test.dart
View file @
84ce3f60
...
...
@@ -4,6 +4,7 @@
import
'package:flutter_tools/src/artifacts.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/io.dart'
;
import
'package:flutter_tools/src/build_runner/web_fs.dart'
;
import
'package:flutter_tools/src/globals.dart'
;
import
'package:flutter_tools/src/project.dart'
;
...
...
@@ -151,4 +152,26 @@ void main() {
'content-length'
:
'28'
,
});
}));
test
(
'release asset server serves content from flutter root'
,
()
=>
testbed
.
run
(()
async
{
assetServer
=
ReleaseAssetServer
();
fs
.
file
(
fs
.
path
.
join
(
'flutter'
,
'bar.dart'
))
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
'void main() { }'
);
final
Response
response
=
await
assetServer
.
handle
(
Request
(
'GET'
,
Uri
.
parse
(
'http://localhost:8080/flutter/bar.dart'
)));
expect
(
response
.
statusCode
,
HttpStatus
.
ok
);
}));
test
(
'release asset server serves content from project directory'
,
()
=>
testbed
.
run
(()
async
{
assetServer
=
ReleaseAssetServer
();
fs
.
file
(
fs
.
path
.
join
(
'lib'
,
'bar.dart'
))
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
'void main() { }'
);
final
Response
response
=
await
assetServer
.
handle
(
Request
(
'GET'
,
Uri
.
parse
(
'http://localhost:8080/bar.dart'
)));
expect
(
response
.
statusCode
,
HttpStatus
.
ok
);
}));
}
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