mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
[flutter_tool] Suggest fix for transform input (#82309)
This commit is contained in:
parent
b70f20b539
commit
93c87e92b3
@ -74,6 +74,7 @@ final List<GradleHandledError> gradleErrors = <GradleHandledError>[
|
||||
r8FailureHandler,
|
||||
androidXFailureHandler,
|
||||
minSdkVersion,
|
||||
transformInputIssue,
|
||||
];
|
||||
|
||||
// Permission defined error message.
|
||||
@ -394,3 +395,37 @@ final GradleHandledError minSdkVersion = GradleHandledError(
|
||||
},
|
||||
eventLabel: 'plugin-min-sdk',
|
||||
);
|
||||
|
||||
/// Handler when https://issuetracker.google.com/issues/141126614 or
|
||||
/// https://github.com/flutter/flutter/issues/58247 is triggered.
|
||||
@visibleForTesting
|
||||
final GradleHandledError transformInputIssue = GradleHandledError(
|
||||
test: (String line) {
|
||||
return line.contains('https://issuetracker.google.com/issues/158753935');
|
||||
},
|
||||
handler: ({
|
||||
String line,
|
||||
FlutterProject project,
|
||||
bool usesAndroidX,
|
||||
bool shouldBuildPluginAsAar,
|
||||
}) async {
|
||||
final File gradleFile = project.directory
|
||||
.childDirectory('android')
|
||||
.childDirectory('app')
|
||||
.childFile('build.gradle');
|
||||
|
||||
globals.printStatus(
|
||||
'\nThis issue appears to be https://github.com/flutter/flutter/issues/58247.\n'+
|
||||
globals.logger.terminal.bolden(
|
||||
'Fix this issue by adding the following to the file ${gradleFile.path}:\n'
|
||||
'android {\n'
|
||||
' lintOptions {\n'
|
||||
' checkReleaseBuilds false\n'
|
||||
' }\n'
|
||||
'}'
|
||||
)
|
||||
);
|
||||
return GradleBuildStatus.exit;
|
||||
},
|
||||
eventLabel: 'transform-input-issue',
|
||||
);
|
||||
|
@ -30,6 +30,7 @@ void main() {
|
||||
r8FailureHandler,
|
||||
androidXFailureHandler,
|
||||
minSdkVersion,
|
||||
transformInputIssue,
|
||||
])
|
||||
);
|
||||
});
|
||||
@ -688,6 +689,44 @@ assembleProfile
|
||||
ProcessManager: () => FakeProcessManager.empty(),
|
||||
});
|
||||
});
|
||||
|
||||
// https://issuetracker.google.com/issues/141126614
|
||||
group('transform input issue', () {
|
||||
testWithoutContext('pattern', () {
|
||||
expect(
|
||||
transformInputIssue.test(
|
||||
'https://issuetracker.google.com/issues/158753935'
|
||||
),
|
||||
isTrue,
|
||||
);
|
||||
});
|
||||
|
||||
testUsingContext('suggestion', () async {
|
||||
await transformInputIssue.handler(
|
||||
project: FlutterProject.fromDirectoryTest(globals.fs.currentDirectory),
|
||||
);
|
||||
|
||||
expect(
|
||||
testLogger.statusText,
|
||||
contains(
|
||||
'\n'
|
||||
'This issue appears to be https://github.com/flutter/flutter/issues/58247.\n'
|
||||
'Fix this issue by adding the following to the file /android/app/build.gradle:\n'
|
||||
'android {\n'
|
||||
' lintOptions {\n'
|
||||
' checkReleaseBuilds false\n'
|
||||
' }\n'
|
||||
'}\n'
|
||||
''
|
||||
)
|
||||
);
|
||||
}, overrides: <Type, Generator>{
|
||||
GradleUtils: () => FakeGradleUtils(),
|
||||
Platform: () => fakePlatform('android'),
|
||||
FileSystem: () => MemoryFileSystem.test(),
|
||||
ProcessManager: () => FakeProcessManager.empty(),
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
bool formatTestErrorMessage(String errorMessage, GradleHandledError error) {
|
||||
|
Loading…
Reference in New Issue
Block a user