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
dc94e479
Commit
dc94e479
authored
Jan 17, 2020
by
Zachary Anderson
Committed by
Flutter GitHub Bot
Jan 17, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tool] Don't crash on failed stamp file update (#49080)
parent
b67d5ec6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
1 deletion
+40
-1
cache.dart
packages/flutter_tools/lib/src/cache.dart
+10
-1
cache_test.dart
packages/flutter_tools/test/general.shard/cache_test.dart
+30
-0
No files found.
packages/flutter_tools/lib/src/cache.dart
View file @
dc94e479
...
...
@@ -511,7 +511,16 @@ abstract class CachedArtifact extends ArtifactSet {
}
}
await
updateInner
();
cache
.
setStampFor
(
stampName
,
version
);
try
{
cache
.
setStampFor
(
stampName
,
version
);
}
on
FileSystemException
catch
(
err
)
{
globals
.
printError
(
'The new artifact "
$name
" was downloaded, but Flutter failed to update '
'its stamp file, receiving the error "
$err
". '
'Flutter can continue, but the artifact may be re-downloaded on '
'subsequent invocations until the problem is resolved.'
,
);
}
_removeDownloadedFiles
();
}
...
...
packages/flutter_tools/test/general.shard/cache_test.dart
View file @
dc94e479
...
...
@@ -115,6 +115,23 @@ void main() {
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
testUsingContext
(
'Continues on failed stamp file update'
,
()
async
{
final
Directory
artifactDir
=
globals
.
fs
.
systemTempDirectory
.
createTempSync
(
'flutter_cache_test_artifact.'
);
final
Directory
downloadDir
=
globals
.
fs
.
systemTempDirectory
.
createTempSync
(
'flutter_cache_test_download.'
);
when
(
mockCache
.
getArtifactDirectory
(
any
)).
thenReturn
(
artifactDir
);
when
(
mockCache
.
getDownloadDir
()).
thenReturn
(
downloadDir
);
when
(
mockCache
.
setStampFor
(
any
,
any
)).
thenAnswer
((
_
)
{
throw
const
FileSystemException
(
'stamp write failed'
);
});
final
FakeSimpleArtifact
artifact
=
FakeSimpleArtifact
(
mockCache
);
await
artifact
.
update
();
expect
(
testLogger
.
errorText
,
contains
(
'stamp write failed'
));
},
overrides:
<
Type
,
Generator
>{
Cache:
()
=>
mockCache
,
FileSystem:
()
=>
memoryFileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
testUsingContext
(
'Gradle wrapper should not be up to date, if some cached artifact is not available'
,
()
{
final
GradleWrapper
gradleWrapper
=
GradleWrapper
(
mockCache
);
final
Directory
directory
=
globals
.
fs
.
directory
(
'/Applications/flutter/bin/cache'
);
...
...
@@ -455,6 +472,19 @@ class FakeCachedArtifact extends EngineCachedArtifact {
List
<
String
>
getPackageDirs
()
=>
packageDirs
;
}
class
FakeSimpleArtifact
extends
CachedArtifact
{
FakeSimpleArtifact
(
Cache
cache
)
:
super
(
'fake'
,
cache
,
DevelopmentArtifact
.
universal
,
);
@override
Future
<
void
>
updateInner
()
async
{
// nop.
}
}
class
FakeDownloadedArtifact
extends
CachedArtifact
{
FakeDownloadedArtifact
(
this
.
downloadedFile
,
Cache
cache
)
:
super
(
'fake'
,
...
...
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