Unverified Commit 04fe25e6 authored by Zachary Anderson's avatar Zachary Anderson Committed by GitHub

[flutter_tools] Don't try to execute gradle wrapper out of /tmp (#56706)

parent d5634982
...@@ -111,7 +111,7 @@ class Cache { ...@@ -111,7 +111,7 @@ class Cache {
_artifacts.add(MaterialFonts(this)); _artifacts.add(MaterialFonts(this));
_artifacts.add(GradleWrapper(this)); _artifacts.add(GradleWrapper(this));
_artifacts.add(AndroidMavenArtifacts()); _artifacts.add(AndroidMavenArtifacts(this));
_artifacts.add(AndroidGenSnapshotArtifacts(this)); _artifacts.add(AndroidGenSnapshotArtifacts(this));
_artifacts.add(AndroidInternalBuildArtifacts(this)); _artifacts.add(AndroidInternalBuildArtifacts(this));
...@@ -990,12 +990,15 @@ class AndroidInternalBuildArtifacts extends EngineCachedArtifact { ...@@ -990,12 +990,15 @@ class AndroidInternalBuildArtifacts extends EngineCachedArtifact {
/// A cached artifact containing the Maven dependencies used to build Android projects. /// A cached artifact containing the Maven dependencies used to build Android projects.
class AndroidMavenArtifacts extends ArtifactSet { class AndroidMavenArtifacts extends ArtifactSet {
AndroidMavenArtifacts() : super(DevelopmentArtifact.androidMaven); AndroidMavenArtifacts(this.cache) : super(DevelopmentArtifact.androidMaven);
final Cache cache;
@override @override
Future<void> update() async { Future<void> update() async {
final Directory tempDir = final Directory tempDir = cache.getRoot().createTempSync(
globals.fs.systemTempDirectory.createTempSync('flutter_gradle_wrapper.'); 'flutter_gradle_wrapper.',
);
gradleUtils.injectGradleWrapperIfNeeded(tempDir); gradleUtils.injectGradleWrapperIfNeeded(tempDir);
final Status status = globals.logger.startProgress('Downloading Android Maven dependencies...', final Status status = globals.logger.startProgress('Downloading Android Maven dependencies...',
......
...@@ -370,12 +370,15 @@ void main() { ...@@ -370,12 +370,15 @@ void main() {
}); });
test('development artifact', () async { test('development artifact', () async {
final AndroidMavenArtifacts mavenArtifacts = AndroidMavenArtifacts(); final AndroidMavenArtifacts mavenArtifacts = AndroidMavenArtifacts(mockCache);
expect(mavenArtifacts.developmentArtifact, DevelopmentArtifact.androidMaven); expect(mavenArtifacts.developmentArtifact, DevelopmentArtifact.androidMaven);
}); });
testUsingContext('update', () async { testUsingContext('update', () async {
final AndroidMavenArtifacts mavenArtifacts = AndroidMavenArtifacts(); final Directory cacheRoot = globals.fs.directory('/bin/cache')
..createSync(recursive: true);
when(mockCache.getRoot()).thenReturn(cacheRoot);
final AndroidMavenArtifacts mavenArtifacts = AndroidMavenArtifacts(mockCache);
expect(mavenArtifacts.isUpToDate(), isFalse); expect(mavenArtifacts.isUpToDate(), isFalse);
final Directory gradleWrapperDir = globals.fs.systemTempDirectory.createTempSync('flutter_cache_test_gradle_wrapper.'); final Directory gradleWrapperDir = globals.fs.systemTempDirectory.createTempSync('flutter_cache_test_gradle_wrapper.');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment