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
383e90eb
Unverified
Commit
383e90eb
authored
Nov 06, 2019
by
Jonah Williams
Committed by
GitHub
Nov 06, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use platform appropriate filepaths when constructing asset bundle (#44221)
parent
aa333fda
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
10 deletions
+7
-10
assets.dart
...es/flutter_tools/lib/src/build_system/targets/assets.dart
+1
-1
bundle.dart
packages/flutter_tools/lib/src/bundle.dart
+1
-1
assets_test.dart
.../test/general.shard/build_system/targets/assets_test.dart
+5
-8
No files found.
packages/flutter_tools/lib/src/build_system/targets/assets.dart
View file @
383e90eb
...
@@ -34,7 +34,7 @@ Future<Depfile> copyAssets(Environment environment, Directory outputDirectory) a
...
@@ -34,7 +34,7 @@ Future<Depfile> copyAssets(Environment environment, Directory outputDirectory) a
assetBundle
.
entries
.
entries
.
map
<
Future
<
void
>>((
MapEntry
<
String
,
DevFSContent
>
entry
)
async
{
assetBundle
.
entries
.
entries
.
map
<
Future
<
void
>>((
MapEntry
<
String
,
DevFSContent
>
entry
)
async
{
final
PoolResource
resource
=
await
pool
.
request
();
final
PoolResource
resource
=
await
pool
.
request
();
try
{
try
{
final
File
file
=
fs
.
file
(
fs
.
path
.
join
(
outputDirectory
.
path
,
entry
.
key
));
final
File
file
=
fs
.
file
(
outputDirectory
.
uri
.
resolve
(
entry
.
key
));
outputs
.
add
(
file
);
outputs
.
add
(
file
);
file
.
parent
.
createSync
(
recursive:
true
);
file
.
parent
.
createSync
(
recursive:
true
);
final
DevFSContent
content
=
entry
.
value
;
final
DevFSContent
content
=
entry
.
value
;
...
...
packages/flutter_tools/lib/src/bundle.dart
View file @
383e90eb
...
@@ -182,7 +182,7 @@ Future<void> writeBundle(
...
@@ -182,7 +182,7 @@ Future<void> writeBundle(
assetEntries
.
entries
.
map
<
Future
<
void
>>((
MapEntry
<
String
,
DevFSContent
>
entry
)
async
{
assetEntries
.
entries
.
map
<
Future
<
void
>>((
MapEntry
<
String
,
DevFSContent
>
entry
)
async
{
final
PoolResource
resource
=
await
pool
.
request
();
final
PoolResource
resource
=
await
pool
.
request
();
try
{
try
{
final
File
file
=
fs
.
file
(
fs
.
path
.
join
(
bundleDir
.
path
,
entry
.
key
));
final
File
file
=
fs
.
file
(
bundleDir
.
uri
.
resolve
(
entry
.
key
));
file
.
parent
.
createSync
(
recursive:
true
);
file
.
parent
.
createSync
(
recursive:
true
);
await
file
.
writeAsBytes
(
await
entry
.
value
.
contentsAsBytes
());
await
file
.
writeAsBytes
(
await
entry
.
value
.
contentsAsBytes
());
}
finally
{
}
finally
{
...
...
packages/flutter_tools/test/general.shard/build_system/targets/assets_test.dart
View file @
383e90eb
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
import
'dart:io'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/build_system/build_system.dart'
;
import
'package:flutter_tools/src/build_system/build_system.dart'
;
import
'package:flutter_tools/src/build_system/targets/assets.dart'
;
import
'package:flutter_tools/src/build_system/targets/assets.dart'
;
...
@@ -47,14 +45,14 @@ flutter:
...
@@ -47,14 +45,14 @@ flutter:
expect
(
fs
.
file
(
fs
.
path
.
join
(
environment
.
buildDir
.
path
,
'flutter_assets'
,
'AssetManifest.json'
)).
existsSync
(),
true
);
expect
(
fs
.
file
(
fs
.
path
.
join
(
environment
.
buildDir
.
path
,
'flutter_assets'
,
'AssetManifest.json'
)).
existsSync
(),
true
);
expect
(
fs
.
file
(
fs
.
path
.
join
(
environment
.
buildDir
.
path
,
'flutter_assets'
,
'FontManifest.json'
)).
existsSync
(),
true
);
expect
(
fs
.
file
(
fs
.
path
.
join
(
environment
.
buildDir
.
path
,
'flutter_assets'
,
'FontManifest.json'
)).
existsSync
(),
true
);
expect
(
fs
.
file
(
fs
.
path
.
join
(
environment
.
buildDir
.
path
,
'flutter_assets'
,
'LICENSE'
)).
existsSync
(),
true
);
expect
(
fs
.
file
(
fs
.
path
.
join
(
environment
.
buildDir
.
path
,
'flutter_assets'
,
'LICENSE'
)).
existsSync
(),
true
);
// See https://github.com/flutter/flutter/issues/35293
expect
(
fs
.
file
(
fs
.
path
.
join
(
environment
.
buildDir
.
path
,
'flutter_assets'
,
'assets'
,
'foo'
,
'bar.png'
)).
existsSync
(),
true
);
expect
(
fs
.
file
(
fs
.
path
.
join
(
environment
.
buildDir
.
path
,
'flutter_assets'
,
'assets/foo/bar.png'
)).
existsSync
(),
true
);
}));
}));
test
(
'Does not leave stale files in build directory'
,
()
=>
testbed
.
run
(()
async
{
test
(
'Does not leave stale files in build directory'
,
()
=>
testbed
.
run
(()
async
{
await
buildSystem
.
build
(
const
CopyAssets
(),
environment
);
await
buildSystem
.
build
(
const
CopyAssets
(),
environment
);
final
File
assetFile
=
fs
.
file
(
fs
.
path
.
join
(
environment
.
buildDir
.
path
,
'flutter_assets'
,
'assets'
,
'foo'
,
'bar.png'
));
expect
(
fs
.
file
(
fs
.
path
.
join
(
environment
.
buildDir
.
path
,
'flutter_assets'
,
'assets/foo/bar.png'
))
.
existsSync
(),
true
);
expect
(
assetFile
.
existsSync
(),
true
);
// Modify manifest to remove asset.
// Modify manifest to remove asset.
fs
.
file
(
'pubspec.yaml'
)
fs
.
file
(
'pubspec.yaml'
)
..
createSync
()
..
createSync
()
...
@@ -65,9 +63,8 @@ flutter:
...
@@ -65,9 +63,8 @@ flutter:
'''
);
'''
);
await
buildSystem
.
build
(
const
CopyAssets
(),
environment
);
await
buildSystem
.
build
(
const
CopyAssets
(),
environment
);
// See https://github.com/flutter/flutter/issues/35293
expect
(
assetFile
.
existsSync
(),
false
);
expect
(
fs
.
file
(
fs
.
path
.
join
(
environment
.
buildDir
.
path
,
'flutter_assets'
,
'assets/foo/bar.png'
)).
existsSync
(),
false
);
}));
}),
skip:
Platform
.
isWindows
);
// See https://github.com/google/file.dart/issues/131
test
(
'FlutterPlugins updates required files as needed'
,
()
=>
testbed
.
run
(()
async
{
test
(
'FlutterPlugins updates required files as needed'
,
()
=>
testbed
.
run
(()
async
{
fs
.
file
(
'pubspec.yaml'
)
fs
.
file
(
'pubspec.yaml'
)
...
...
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