[flutter_tools] add a gradle error handler for could not open cache directory (#129222)

Works around part of https://github.com/flutter/flutter/issues/128866
This commit is contained in:
Christopher Fujino
2023-06-21 13:13:40 -07:00
committed by GitHub
parent d2c4b5a109
commit 5cef69dd49
2 changed files with 48 additions and 2 deletions

View File

@@ -83,6 +83,7 @@ final List<GradleHandledError> gradleErrors = <GradleHandledError>[
zipExceptionHandler,
incompatibleJavaAndGradleVersionsHandler,
remoteTerminatedHandshakeHandler,
couldNotOpenCacheDirectoryHandler,
];
const String _boxTitle = 'Flutter Fix';
@@ -715,3 +716,22 @@ final GradleHandledError remoteTerminatedHandshakeHandler = GradleHandledError(
},
eventLabel: 'remote-terminated-handshake',
);
@visibleForTesting
final GradleHandledError couldNotOpenCacheDirectoryHandler = GradleHandledError(
test: (String line) => line.contains('> Could not open cache directory '),
handler: ({
required String line,
required FlutterProject project,
required bool usesAndroidX,
required bool multidexEnabled,
}) async {
globals.printError(
'${globals.logger.terminal.warningMark} '
'Gradle threw an error while resolving dependencies.'
);
return GradleBuildStatus.retry;
},
eventLabel: 'could-not-open-cache-directory',
);