mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Hide the NDK warning that should never happen with a regexp (#14503)
This commit is contained in:
parent
225b52bc0e
commit
7982694a0c
@ -36,6 +36,14 @@ enum FlutterPluginVersion {
|
||||
managed,
|
||||
}
|
||||
|
||||
// Investigation documented in #13975 suggests the filter should be a subset
|
||||
// of the impact of -q, but users insist they see the error message sometimes
|
||||
// anyway. If we can prove it really is impossible, delete the filter.
|
||||
final RegExp ndkMessageFilter = new RegExp(r'^(?!NDK is missing a ".*" directory'
|
||||
r'|If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning'
|
||||
r'|If you are using NDK, verify the ndk.dir is set to a valid NDK directory. It is currently set to .*)');
|
||||
|
||||
|
||||
bool isProjectUsingGradle() {
|
||||
return fs.isFileSync('android/build.gradle');
|
||||
}
|
||||
@ -309,6 +317,7 @@ Future<Null> _buildGradleProjectV2(String gradle, BuildInfo buildInfo, String ta
|
||||
workingDirectory: 'android',
|
||||
allowReentrantFlutter: true,
|
||||
environment: _gradleEnv,
|
||||
filter: logger.isVerbose ? null : ndkMessageFilter,
|
||||
);
|
||||
status.stop();
|
||||
|
||||
|
@ -8,6 +8,28 @@ import 'package:flutter_tools/src/build_info.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
void main() {
|
||||
group('gradle build', () {
|
||||
test('regexp should only match lines without the error message', () {
|
||||
final List<String> nonMatchingLines = <String>[
|
||||
'NDK is missing a "platforms" directory.',
|
||||
'If you are using NDK, verify the ndk.dir is set to a valid NDK directory. It is currently set to /usr/local/company/home/username/Android/Sdk/ndk-bundle.',
|
||||
'If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.',
|
||||
];
|
||||
final List<String> matchingLines = <String>[
|
||||
':app:preBuild UP-TO-DATE',
|
||||
'BUILD SUCCESSFUL in 0s',
|
||||
'',
|
||||
'Something NDK related mentioning ANDROID_NDK_HOME',
|
||||
];
|
||||
for (String m in nonMatchingLines) {
|
||||
expect(ndkMessageFilter.hasMatch(m), isFalse);
|
||||
}
|
||||
for (String m in matchingLines) {
|
||||
expect(ndkMessageFilter.hasMatch(m), isTrue);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
group('gradle project', () {
|
||||
GradleProject projectFrom(String properties) => new GradleProject.fromAppProperties(properties);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user