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
975fb0f0
Unverified
Commit
975fb0f0
authored
Mar 24, 2021
by
Jonah Williams
Committed by
GitHub
Mar 24, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tool] fix deletion of gradle wrapper artifacts in cache (#78911)
parent
64d9650e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
3 deletions
+34
-3
cache.dart
packages/flutter_tools/lib/src/cache.dart
+5
-3
cache_test.dart
packages/flutter_tools/test/general.shard/cache_test.dart
+29
-0
No files found.
packages/flutter_tools/lib/src/cache.dart
View file @
975fb0f0
...
@@ -1293,11 +1293,13 @@ class GradleWrapper extends CachedArtifact {
...
@@ -1293,11 +1293,13 @@ class GradleWrapper extends CachedArtifact {
OperatingSystemUtils
operatingSystemUtils
,
OperatingSystemUtils
operatingSystemUtils
,
)
async
{
)
async
{
final
Uri
archiveUri
=
_toStorageUri
(
version
);
final
Uri
archiveUri
=
_toStorageUri
(
version
);
await
artifactUpdater
.
downloadZippedTarball
(
'Downloading Gradle Wrapper...'
,
archiveUri
,
location
);
await
artifactUpdater
.
downloadZippedTarball
(
'Downloading Gradle Wrapper...'
,
archiveUri
,
location
);
// Delete property file, allowing templates to provide it.
// Delete property file, allowing templates to provide it.
fileSystem
.
file
(
fileSystem
.
path
.
join
(
location
.
path
,
'gradle'
,
'wrapper'
,
'gradle-wrapper.properties'
)).
deleteSync
();
// Remove NOTICE file. Should not be part of the template.
// Remove NOTICE file. Should not be part of the template.
fileSystem
.
file
(
fileSystem
.
path
.
join
(
location
.
path
,
'NOTICE'
)).
deleteSync
();
final
File
propertiesFile
=
fileSystem
.
file
(
fileSystem
.
path
.
join
(
location
.
path
,
'gradle'
,
'wrapper'
,
'gradle-wrapper.properties'
));
final
File
noticeFile
=
fileSystem
.
file
(
fileSystem
.
path
.
join
(
location
.
path
,
'NOTICE'
));
ErrorHandlingFileSystem
.
deleteIfExists
(
propertiesFile
);
ErrorHandlingFileSystem
.
deleteIfExists
(
noticeFile
);
}
}
@override
@override
...
...
packages/flutter_tools/test/general.shard/cache_test.dart
View file @
975fb0f0
...
@@ -136,6 +136,28 @@ void main() {
...
@@ -136,6 +136,28 @@ void main() {
expect
(
gradleWrapper
.
isUpToDateInner
(
fileSystem
),
false
);
expect
(
gradleWrapper
.
isUpToDateInner
(
fileSystem
),
false
);
});
});
testWithoutContext
(
'Gradle wrapper will delete .properties/NOTICES if they exist'
,
()
async
{
final
FileSystem
fileSystem
=
MemoryFileSystem
.
test
();
final
Cache
cache
=
Cache
.
test
(
fileSystem:
fileSystem
,
processManager:
FakeProcessManager
.
any
());
final
OperatingSystemUtils
operatingSystemUtils
=
OperatingSystemUtils
(
processManager:
FakeProcessManager
.
any
(),
platform:
FakePlatform
(),
logger:
BufferLogger
.
test
(),
fileSystem:
fileSystem
,
);
final
GradleWrapper
gradleWrapper
=
GradleWrapper
(
cache
);
final
Directory
directory
=
cache
.
getCacheDir
(
fileSystem
.
path
.
join
(
'artifacts'
,
'gradle_wrapper'
));
final
File
propertiesFile
=
fileSystem
.
file
(
fileSystem
.
path
.
join
(
directory
.
path
,
'gradle'
,
'wrapper'
,
'gradle-wrapper.properties'
))
..
createSync
(
recursive:
true
);
final
File
noticeFile
=
fileSystem
.
file
(
fileSystem
.
path
.
join
(
directory
.
path
,
'NOTICE'
))
..
createSync
(
recursive:
true
);
await
gradleWrapper
.
updateInner
(
FakeArtifactUpdater
(),
fileSystem
,
operatingSystemUtils
);
expect
(
propertiesFile
,
isNot
(
exists
));
expect
(
noticeFile
,
isNot
(
exists
));
});
testWithoutContext
(
'Gradle wrapper should be up to date, only if all cached artifact are available'
,
()
{
testWithoutContext
(
'Gradle wrapper should be up to date, only if all cached artifact are available'
,
()
{
final
FileSystem
fileSystem
=
MemoryFileSystem
.
test
();
final
FileSystem
fileSystem
=
MemoryFileSystem
.
test
();
final
Cache
cache
=
Cache
.
test
(
fileSystem:
fileSystem
,
processManager:
FakeProcessManager
.
any
());
final
Cache
cache
=
Cache
.
test
(
fileSystem:
fileSystem
,
processManager:
FakeProcessManager
.
any
());
...
@@ -941,3 +963,10 @@ class FakeAndroidSdk extends Fake implements AndroidSdk {
...
@@ -941,3 +963,10 @@ class FakeAndroidSdk extends Fake implements AndroidSdk {
reinitialized
=
true
;
reinitialized
=
true
;
}
}
}
}
class
FakeArtifactUpdater
extends
Fake
implements
ArtifactUpdater
{
@override
Future
<
void
>
downloadZippedTarball
(
String
message
,
Uri
url
,
Directory
location
)
async
{
return
;
}
}
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