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
8251f552
Unverified
Commit
8251f552
authored
Jun 25, 2021
by
Lau Ching Jun
Committed by
GitHub
Jun 25, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Make sure that the asset directory on devfs always exist. (#85267)" (#85353)
parent
782212d2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
144 deletions
+1
-144
devfs.dart
packages/flutter_tools/lib/src/devfs.dart
+0
-9
devfs_test.dart
packages/flutter_tools/test/general.shard/devfs_test.dart
+1
-135
No files found.
packages/flutter_tools/lib/src/devfs.dart
View file @
8251f552
...
...
@@ -480,8 +480,6 @@ class DevFS {
final
Directory
rootDirectory
;
final
Set
<
String
>
assetPathsToEvict
=
<
String
>{};
static
const
String
kAssetDirectoryPlaceholderFilename
=
'.__dummy_flutter_asset'
;
List
<
Uri
>
sources
=
<
Uri
>[];
DateTime
lastCompiled
;
DateTime
_previousCompiled
;
...
...
@@ -633,13 +631,6 @@ class DevFS {
assetPathsToEvict
.
add
(
archivePath
);
}
});
// When the bundle is first uploaded, include a dummy file to make sure
// that the assets directory on DevFS is created.
if
(
bundleFirstUpload
)
{
final
Uri
deviceUri
=
_fileSystem
.
path
.
toUri
(
_fileSystem
.
path
.
join
(
assetDirectory
,
kAssetDirectoryPlaceholderFilename
));
dirtyEntries
[
deviceUri
]
=
DevFSByteContent
(<
int
>[]);
}
}
final
CompilerOutput
compilerOutput
=
await
pendingCompilerOutput
;
if
(
compilerOutput
==
null
||
compilerOutput
.
errorCount
>
0
)
{
...
...
packages/flutter_tools/test/general.shard/devfs_test.dart
View file @
8251f552
...
...
@@ -10,7 +10,6 @@ import 'dart:convert';
import
'package:file/file.dart'
;
import
'package:file/memory.dart'
;
import
'package:file_testing/file_testing.dart'
;
import
'package:flutter_tools/src/asset.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/io.dart'
;
import
'package:flutter_tools/src/base/logger.dart'
;
...
...
@@ -429,6 +428,7 @@ void main() {
testWithoutContext
(
'DevFS correctly records the elapsed time'
,
()
async
{
final
FileSystem
fileSystem
=
MemoryFileSystem
.
test
();
// final FakeDevFSWriter writer = FakeDevFSWriter();
final
FakeVmServiceHost
fakeVmServiceHost
=
FakeVmServiceHost
(
requests:
<
VmServiceExpectation
>[
createDevFSRequest
],
httpAddress:
Uri
.
parse
(
'http://localhost'
),
...
...
@@ -470,115 +470,6 @@ void main() {
expect
(
report
.
compileDuration
,
const
Duration
(
seconds:
3
));
expect
(
report
.
transferDuration
,
const
Duration
(
seconds:
5
));
});
group
(
'DevFS with AssetBundle'
,
()
{
FileSystem
fileSystem
;
FakeDevFSWriter
writer
;
DevFS
devFS
;
FakeResidentCompiler
residentCompiler
;
setUp
(()
{
fileSystem
=
MemoryFileSystem
.
test
();
writer
=
FakeDevFSWriter
();
final
FakeVmServiceHost
fakeVmServiceHost
=
FakeVmServiceHost
(
requests:
<
VmServiceExpectation
>[
createDevFSRequest
],
);
devFS
=
DevFS
(
fakeVmServiceHost
.
vmService
,
'test'
,
fileSystem
.
currentDirectory
,
fileSystem:
fileSystem
,
logger:
BufferLogger
.
test
(),
osUtils:
FakeOperatingSystemUtils
(),
httpClient:
FakeHttpClient
.
any
(),
);
residentCompiler
=
FakeResidentCompiler
()
..
onRecompile
=
(
Uri
mainUri
,
List
<
Uri
>
invalidatedFiles
)
async
{
fileSystem
.
file
(
'example'
).
createSync
();
return
const
CompilerOutput
(
'lib/foo.txt.dill'
,
0
,
<
Uri
>[]);
};
});
testUsingContext
(
'skip uploading assets when bundleFirstUpload'
,
()
async
{
final
FakeAssetBundle
fakeAssetBundle
=
FakeAssetBundle
(<
String
,
DevFSContent
>{
'assets/modified.png'
:
FakeDevFSByteContent
(
bytes:
<
int
>[
0
],
isModified:
true
,
),
'assets/not_modified.png'
:
FakeDevFSByteContent
(
bytes:
<
int
>[
0
],
isModified:
false
,
),
});
await
devFS
.
create
();
expect
(
writer
.
written
,
false
);
final
UpdateFSReport
report
=
await
devFS
.
update
(
mainUri:
Uri
.
parse
(
'lib/main.dart'
),
generator:
residentCompiler
,
dillOutputPath:
'lib/foo.dill'
,
pathToReload:
'lib/foo.txt.dill'
,
trackWidgetCreation:
false
,
invalidatedFiles:
<
Uri
>[],
packageConfig:
PackageConfig
.
empty
,
devFSWriter:
writer
,
bundle:
fakeAssetBundle
,
bundleFirstUpload:
true
,
);
expect
(
report
.
success
,
true
);
expect
(
writer
.
written
,
true
);
expect
(
writer
.
lastWrittenEntries
.
keys
,
<
Uri
>[
Uri
.
parse
(
'build/flutter_assets/
${DevFS.kAssetDirectoryPlaceholderFilename}
'
),
]);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
testUsingContext
(
'uploads updated assets when bundleFirstUpload'
,
()
async
{
final
FakeAssetBundle
fakeAssetBundle
=
FakeAssetBundle
(<
String
,
DevFSContent
>{
'assets/modified.png'
:
FakeDevFSByteContent
(
bytes:
<
int
>[
0
],
isModified:
true
,
),
'assets/not_modified.png'
:
FakeDevFSByteContent
(
bytes:
<
int
>[
0
],
isModified:
false
,
),
});
await
devFS
.
create
();
expect
(
writer
.
written
,
false
);
final
UpdateFSReport
report
=
await
devFS
.
update
(
mainUri:
Uri
.
parse
(
'lib/main.dart'
),
generator:
residentCompiler
,
dillOutputPath:
'lib/foo.dill'
,
pathToReload:
'lib/foo.txt.dill'
,
trackWidgetCreation:
false
,
invalidatedFiles:
<
Uri
>[],
packageConfig:
PackageConfig
.
empty
,
devFSWriter:
writer
,
bundle:
fakeAssetBundle
,
bundleFirstUpload:
false
,
);
expect
(
report
.
success
,
true
);
expect
(
writer
.
written
,
true
);
expect
(
writer
.
lastWrittenEntries
.
keys
,
<
Uri
>[
Uri
.
parse
(
'build/flutter_assets/assets/modified.png'
),
Uri
.
parse
(
'lib/foo.txt.dill'
),
]);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
});
}
class
FakeResidentCompiler
extends
Fake
implements
ResidentCompiler
{
...
...
@@ -593,34 +484,9 @@ class FakeResidentCompiler extends Fake implements ResidentCompiler {
class
FakeDevFSWriter
implements
DevFSWriter
{
bool
written
=
false
;
Map
<
Uri
,
DevFSContent
>
lastWrittenEntries
;
@override
Future
<
void
>
write
(
Map
<
Uri
,
DevFSContent
>
entries
,
Uri
baseUri
,
DevFSWriter
parent
)
async
{
written
=
true
;
lastWrittenEntries
=
entries
;
}
}
class
FakeAssetBundle
extends
Fake
implements
AssetBundle
{
FakeAssetBundle
(
this
.
entries
);
@override
Map
<
String
,
DevFSContent
>
entries
;
}
class
FakeDevFSByteContent
extends
Fake
implements
DevFSByteContent
{
FakeDevFSByteContent
({
this
.
bytes
,
this
.
isModified
,
});
@override
List
<
int
>
bytes
;
@override
bool
isModified
;
@override
int
get
size
=>
bytes
.
length
;
}
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