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
ed85dd49
Unverified
Commit
ed85dd49
authored
May 14, 2021
by
Jonah Williams
Committed by
GitHub
May 14, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] use try to delete in web cache (#82478)
parent
0f8a6ab4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
3 deletions
+24
-3
flutter_cache.dart
packages/flutter_tools/lib/src/flutter_cache.dart
+1
-3
cache_test.dart
packages/flutter_tools/test/general.shard/cache_test.dart
+23
-0
No files found.
packages/flutter_tools/lib/src/flutter_cache.dart
View file @
ed85dd49
...
...
@@ -183,9 +183,7 @@ class FlutterWebSdk extends CachedArtifact {
platformName
+=
'windows-x64'
;
}
final
Uri
url
=
Uri
.
parse
(
'
${cache.storageBaseUrl}
/flutter_infra_release/flutter/
$version
/
$platformName
.zip'
);
if
(
location
.
existsSync
())
{
location
.
deleteSync
(
recursive:
true
);
}
ErrorHandlingFileSystem
.
deleteIfExists
(
location
,
recursive:
true
);
await
artifactUpdater
.
downloadZipArchive
(
'Downloading Web SDK...'
,
url
,
location
);
// This is a temporary work-around for not being able to safely download into a shared directory.
final
FileSystem
fileSystem
=
location
.
fileSystem
;
...
...
packages/flutter_tools/test/general.shard/cache_test.dart
View file @
ed85dd49
...
...
@@ -745,6 +745,29 @@ void main() {
expect
(
webStuff
.
childFile
(
'bar'
),
isNot
(
exists
));
});
testWithoutContext
(
'FlutterWebSdk uses tryToDelete to handle directory edge cases'
,
()
async
{
final
FileExceptionHandler
handler
=
FileExceptionHandler
();
final
MemoryFileSystem
fileSystem
=
MemoryFileSystem
.
test
(
opHandle:
handler
.
opHandle
);
final
Directory
webStuff
=
fileSystem
.
directory
(
'web-stuff'
);
final
MockCache
cache
=
MockCache
();
final
MockArtifactUpdater
artifactUpdater
=
MockArtifactUpdater
();
final
FlutterWebSdk
webSdk
=
FlutterWebSdk
(
cache
,
platform:
FakePlatform
(
operatingSystem:
'linux'
));
when
(
cache
.
getWebSdkDirectory
()).
thenReturn
(
webStuff
);
when
(
artifactUpdater
.
downloadZipArchive
(
'Downloading Web SDK...'
,
any
,
any
))
.
thenAnswer
((
Invocation
invocation
)
async
{
final
Directory
location
=
invocation
.
positionalArguments
[
2
]
as
Directory
;
location
.
createSync
(
recursive:
true
);
location
.
childFile
(
'foo'
).
createSync
();
});
webStuff
.
childFile
(
'bar'
).
createSync
(
recursive:
true
);
handler
.
addError
(
webStuff
,
FileSystemOp
.
delete
,
const
FileSystemException
(
''
,
''
,
OSError
(
''
,
2
)));
await
expectLater
(()
=>
webSdk
.
updateInner
(
artifactUpdater
,
fileSystem
,
MockOperatingSystemUtils
()),
throwsToolExit
(
message:
RegExp
(
'The Flutter tool tried to delete the file or directory web-stuff but was unable to'
),
));
});
testWithoutContext
(
'Cache handles exception thrown if stamp file cannot be parsed'
,
()
{
final
FileExceptionHandler
exceptionHandler
=
FileExceptionHandler
();
final
FileSystem
fileSystem
=
MemoryFileSystem
.
test
(
opHandle:
exceptionHandler
.
opHandle
);
...
...
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