Unverified Commit c11a64e9 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

[devicelab] turn down android X migration gradle tests (#68110)

These androidx migration tests require downloading firebase, which is a large library with a number of dependencies - this causes frequent enough flakes.

AndroidX migration is ~2 years in the past, and while it would be nice to confirm this still works, ideally that would be done in a reduced manner.
parent 537cf33a
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:io';
import 'package:flutter_devicelab/framework/apk_utils.dart';
import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/framework/task_result.dart';
import 'package:flutter_devicelab/framework/utils.dart';
import 'package:path/path.dart' as path;
final String gradlew = Platform.isWindows ? 'gradlew.bat' : 'gradlew';
final String gradlewExecutable = Platform.isWindows ? '.\\$gradlew' : './$gradlew';
final String platformLineSep = Platform.isWindows ? '\r\n': '\n';
/// Tests that Jetifier can translate plugins that use support libraries.
Future<void> main() async {
await task(() async {
section('Find Java');
final String javaHome = await findJavaHome();
if (javaHome == null)
return TaskResult.failure('Could not find Java');
print('\nUsing JAVA_HOME=$javaHome');
section('Create Flutter AndroidX app project');
final Directory tempDir = Directory.systemTemp.createTempSync('flutter_module_test.');
final Directory projectDir = Directory(path.join(tempDir.path, 'hello'));
try {
await inDirectory(tempDir, () async {
await flutter(
'create',
options: <String>[
'--org', 'io.flutter.devicelab',
'hello',
],
);
});
section('Add plugin that uses support libraries');
final File pubspec = File(path.join(projectDir.path, 'pubspec.yaml'));
String content = pubspec.readAsStringSync();
content = content.replaceFirst(
'${platformLineSep}dependencies:$platformLineSep',
'${platformLineSep}dependencies:$platformLineSep firebase_auth: 0.7.0$platformLineSep',
);
pubspec.writeAsStringSync(content, flush: true);
await inDirectory(projectDir, () async {
await flutter(
'packages',
options: <String>['get'],
);
});
section('Update proguard rules');
// Don't obfuscate the input class files, since the test is checking if some classes are in the DEX.
final File proguardRules = File(path.join(projectDir.path, 'android', 'app', 'proguard-rules.pro'));
proguardRules.writeAsStringSync('-dontobfuscate', flush: true);
section('Build release APK');
await inDirectory(projectDir, () async {
await flutter(
'build',
options: <String>[
'apk',
'--target-platform', 'android-arm',
'--no-shrink',
'--verbose',
],
);
});
final File releaseApk = File(path.join(
projectDir.path,
'build',
'app',
'outputs',
'flutter-apk',
'app-release.apk',
));
if (!exists(releaseApk)) {
return TaskResult.failure('Failed to build release APK.');
}
checkApkContainsClasses(releaseApk, <String>[
// The plugin class defined by `firebase_auth`.
'io.flutter.plugins.firebaseauth.FirebaseAuthPlugin',
// Used by `firebase_auth`.
'com.google.firebase.FirebaseApp',
// Base class for activities that enables composition of higher level components.
'androidx.core.app.ComponentActivity',
]);
section('Build debug APK');
await inDirectory(projectDir, () async {
await flutter(
'build',
options: <String>[
'apk',
'--target-platform', 'android-arm',
'--debug',
'--no-shrink',
'--verbose',
],
);
});
final File debugApk = File(path.join(
projectDir.path,
'build',
'app',
'outputs',
'flutter-apk',
'app-debug.apk',
));
if (!exists(debugApk)) {
return TaskResult.failure('Failed to build debug APK.');
}
checkApkContainsClasses(debugApk, <String>[
// The plugin class defined by `firebase_auth`.
'io.flutter.plugins.firebaseauth.FirebaseAuthPlugin',
// Used by `firebase_auth`.
'com.google.firebase.FirebaseApp',
// Base class for activities that enables composition of higher level components.
'androidx.core.app.ComponentActivity',
]);
return TaskResult.success(null);
} catch (e) {
return TaskResult.failure(e.toString());
} finally {
rmTree(tempDir);
}
});
}
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:io';
import 'package:flutter_devicelab/framework/apk_utils.dart';
import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/framework/task_result.dart';
import 'package:flutter_devicelab/framework/utils.dart';
import 'package:path/path.dart' as path;
final String gradlew = Platform.isWindows ? 'gradlew.bat' : 'gradlew';
final String gradlewExecutable = Platform.isWindows ? '.\\$gradlew' : './$gradlew';
/// Tests that projects can include plugins that have a transitive dependency in common.
/// For more info see: https://github.com/flutter/flutter/issues/27254.
Future<void> main() async {
await task(() async {
section('Find Java');
final String javaHome = await findJavaHome();
if (javaHome == null)
return TaskResult.failure('Could not find Java');
print('\nUsing JAVA_HOME=$javaHome');
section('Create Flutter AndroidX app project');
final Directory tempDir = Directory.systemTemp.createTempSync('flutter_module_test.');
final Directory projectDir = Directory(path.join(tempDir.path, 'hello'));
try {
await inDirectory(tempDir, () async {
await flutter(
'create',
options: <String>[
'--org', 'io.flutter.devicelab',
'hello',
],
);
});
section('Add plugin that have conflicting dependencies');
final File pubspec = File(path.join(projectDir.path, 'pubspec.yaml'));
String content = pubspec.readAsStringSync();
// `flutter_local_notifications` uses `androidx.core:core:1.0.1`
// `firebase_core` and `firebase_messaging` use `androidx.core:core:1.0.0`.
content = content.replaceFirst(
'\ndependencies:\n',
'\ndependencies:\n flutter_local_notifications: 0.7.1+3\n firebase_core:\n firebase_messaging:\n',
);
pubspec.writeAsStringSync(content, flush: true);
await inDirectory(projectDir, () async {
await flutter(
'packages',
options: <String>['get'],
);
});
section('Build release APK');
await inDirectory(projectDir, () async {
await flutter(
'build',
options: <String>[
'apk',
'--target-platform', 'android-arm',
'--verbose',
],
);
});
final File releaseApk = File(path.join(
projectDir.path,
'build',
'app',
'outputs',
'flutter-apk',
'app-release.apk',
));
if (!exists(releaseApk)) {
return TaskResult.failure('Failed to build release APK.');
}
checkApkContainsClasses(releaseApk, <String>[
// Used by `flutter_local_notifications`.
'com.google.gson.Gson',
// Used by `firebase_core` and `firebase_messaging`.
'com.google.firebase.FirebaseApp',
// Used by `firebase_core`.
'com.google.firebase.FirebaseOptions',
// Used by `firebase_messaging`.
'com.google.firebase.messaging.FirebaseMessaging',
]);
section('Build debug APK');
await inDirectory(projectDir, () async {
await flutter(
'build',
options: <String>[
'apk',
'--target-platform', 'android-arm',
'--debug',
'--verbose',
],
);
});
final File debugApk = File(path.join(
projectDir.path,
'build',
'app',
'outputs',
'flutter-apk',
'app-debug.apk',
));
if (!exists(debugApk)) {
return TaskResult.failure('Failed to build debug APK.');
}
checkApkContainsClasses(debugApk, <String>[
// Used by `flutter_local_notifications`.
'com.google.gson.Gson',
// Used by `firebase_core` and `firebase_messaging`.
'com.google.firebase.FirebaseApp',
// Used by `firebase_core`.
'com.google.firebase.FirebaseOptions',
// Used by `firebase_messaging`.
'com.google.firebase.messaging.FirebaseMessaging',
]);
return TaskResult.success(null);
} catch (e) {
return TaskResult.failure(e.toString());
} finally {
rmTree(tempDir);
}
});
}
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:io';
import 'package:flutter_devicelab/framework/apk_utils.dart';
import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/framework/task_result.dart';
import 'package:flutter_devicelab/framework/utils.dart';
import 'package:path/path.dart' as path;
final String gradlew = Platform.isWindows ? 'gradlew.bat' : 'gradlew';
final String gradlewExecutable = Platform.isWindows ? '.\\$gradlew' : './$gradlew';
/// Tests that plugins that don't define a `androidx.annotation:annotation:+` or
/// `com.android.support:support-annotations:+` dependency can be built as AAR.
/// aar_init_script.gradle adds these dependencies manually.
Future<void> main() async {
await task(() async {
section('Find Java');
final String javaHome = await findJavaHome();
if (javaHome == null) {
return TaskResult.failure('Could not find Java');
}
print('\nUsing JAVA_HOME=$javaHome');
section('Create Flutter app project');
final Directory tempDir = Directory.systemTemp.createTempSync('flutter_module_test.');
final Directory projectDir = Directory(path.join(tempDir.path, 'hello'));
try {
await inDirectory(tempDir, () async {
await flutter(
'create',
options: <String>[
'--org', 'io.flutter.devicelab',
'hello',
],
);
});
section('Add firebase_auth: 0.11.1+12 since it uses AndroidX annotations');
// firebase_auth: 0.11.1+12 uses `androidx.annotation.NonNull` without having a
// dependency on `androidx.annotation:annotation:+`
final File pubspec = File(path.join(projectDir.path, 'pubspec.yaml'));
String content = pubspec.readAsStringSync();
content = content.replaceFirst(
'\ndependencies:\n',
'\ndependencies:\n firebase_auth: 0.11.1+12\n',
);
pubspec.writeAsStringSync(content, flush: true);
await inDirectory(projectDir, () async {
await flutter(
'packages',
options: <String>['get'],
);
});
section('Update proguard rules');
// Don't obfuscate the input class files, since the test is checking if some classes are in the DEX.
final File proguardRules = File(path.join(projectDir.path, 'android', 'app', 'proguard-rules.pro'));
proguardRules.writeAsStringSync('-dontobfuscate', flush: true);
section('Build release APK');
await inDirectory(projectDir, () async {
await flutter(
'build',
options: <String>[
'apk',
'--target-platform', 'android-arm',
'--verbose',
],
);
});
final File releaseApk = File(path.join(
projectDir.path,
'build',
'app',
'outputs',
'flutter-apk',
'app-release.apk',
));
if (!exists(releaseApk)) {
return TaskResult.failure('Failed to build release APK.');
}
checkApkContainsClasses(releaseApk, <String>[
// The plugin class defined by `firebase_auth`.
'io.flutter.plugins.firebaseauth.FirebaseAuthPlugin',
// Used by `firebase_auth`.
'com.google.firebase.FirebaseApp',
]);
section('Build debug APK');
await inDirectory(projectDir, () async {
await flutter(
'build',
options: <String>[
'apk',
'--target-platform', 'android-arm',
'--debug', '--verbose',
],
);
});
final File debugApk = File(path.join(
projectDir.path,
'build',
'app',
'outputs',
'flutter-apk',
'app-debug.apk',
));
if (!exists(debugApk)) {
return TaskResult.failure('Failed to build debug APK.');
}
checkApkContainsClasses(debugApk, <String>[
// The plugin class defined by `firebase_auth`.
'io.flutter.plugins.firebaseauth.FirebaseAuthPlugin',
// Used by `firebase_auth`.
'com.google.firebase.FirebaseApp',
]);
return TaskResult.success(null);
} catch (e) {
return TaskResult.failure(e.toString());
} finally {
rmTree(tempDir);
}
});
}
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:io';
import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/framework/task_result.dart';
import 'package:flutter_devicelab/framework/utils.dart';
import 'package:path/path.dart' as path;
/// Tests that flutter build apk uses R8 by default by adding an
/// invalid ProGuard rule and evaluating the error message.
Future<void> main() async {
await task(() async {
section('Find Java');
final String javaHome = await findJavaHome();
if (javaHome == null)
return TaskResult.failure('Could not find Java');
print('\nUsing JAVA_HOME=$javaHome');
section('Create Flutter app project');
final Directory tempDir = Directory.systemTemp.createTempSync('flutter_module_test.');
final Directory projectDir = Directory(path.join(tempDir.path, 'hello'));
try {
await inDirectory(tempDir, () async {
await flutter(
'create',
options: <String>[
'--org', 'io.flutter.devicelab',
'hello',
],
);
});
section('Add incorrect proguard rules');
final File proguardRules = File(path.join(
projectDir.path,
'android',
'app',
'proguard-rules.pro',
));
proguardRules.writeAsStringSync('invalidRule', flush: true);
section('Build release APK');
final StringBuffer stderr = StringBuffer();
await inDirectory(projectDir, () async {
await evalFlutter(
'build',
options: <String>[
'apk',
'--target-platform', 'android-arm',
'--verbose',
],
canFail: true,
stderr: stderr,
);
});
if (!stderr.toString().contains('com.android.tools.r8.CompilationFailedException')) {
return TaskResult.failure('Expected com.android.tools.r8.CompilationFailedException in stderr.');
}
return TaskResult.success(null);
} catch (e) {
return TaskResult.failure(e.toString());
} finally {
rmTree(tempDir);
}
});
}
......@@ -66,12 +66,6 @@
"task_name": "linux_fuchsia_precache",
"flaky": false
},
{
"name": "Linux gradle_jetifier_test",
"repo": "flutter",
"task_name": "linux_gradle_jetifier_test",
"flaky": false
},
{
"name": "Linux gradle_non_android_plugin_test",
"repo": "flutter",
......@@ -90,12 +84,6 @@
"task_name": "linux_gradle_plugin_fat_apk_test",
"flaky": false
},
{
"name": "Linux gradle_r8_test",
"repo": "flutter",
"task_name": "linux_gradle_r8_test",
"flaky": false
},
{
"name": "Linux module_custom_host_app_name_test",
"repo": "flutter",
......@@ -114,12 +102,6 @@
"task_name": "linux_module_test",
"flaky": false
},
{
"name": "Linux plugin_dependencies_test",
"repo": "flutter",
"task_name": "linux_plugin_dependencies_test",
"flaky": false
},
{
"name": "Linux plugin_test",
"repo": "flutter",
......@@ -198,12 +180,6 @@
"task_name": "mac_framework_tests",
"flaky": false
},
{
"name": "Mac gradle_jetifier_test",
"repo": "flutter",
"task_name": "mac_gradle_jetifier_test",
"flaky": false
},
{
"name": "Mac gradle_non_android_plugin_test",
"repo": "flutter",
......@@ -228,12 +204,6 @@
"task_name": "mac_gradle_plugin_light_apk_test",
"flaky": false
},
{
"name": "Mac gradle_r8_test",
"repo": "flutter",
"task_name": "mac_gradle_r8_test",
"flaky": false
},
{
"name": "Mac module_custom_host_app_name_test",
"repo": "flutter",
......@@ -258,12 +228,6 @@
"task_name": "mac_module_test_ios",
"flaky": false
},
{
"name": "Mac plugin_dependencies_test",
"repo": "flutter",
"task_name": "mac_plugin_dependencies_test",
"flaky": false
},
{
"name": "Mac plugin_lint_mac",
"repo": "flutter",
......@@ -306,12 +270,6 @@
"task_name": "win_framework_tests",
"flaky": false
},
{
"name": "Windows gradle_jetifier_test",
"repo": "flutter",
"task_name": "win_gradle_jetifier_test",
"flaky": false
},
{
"name": "Windows gradle_plugin_light_apk_test",
"repo": "flutter",
......@@ -336,12 +294,6 @@
"task_name": "win_gradle_plugin_fat_apk_test",
"flaky": false
},
{
"name": "Windows gradle_r8_test",
"repo": "flutter",
"task_name": "win_gradle_r8_test",
"flaky": false
},
{
"name": "Windows module_custom_host_app_name_test",
"repo": "flutter",
......@@ -360,12 +312,6 @@
"task_name": "win_module_test",
"flaky": false
},
{
"name": "Windows plugin_dependencies_test",
"repo": "flutter",
"task_name": "win_plugin_dependencies_test",
"flaky": false
},
{
"name": "Windows plugin_test",
"repo": "flutter",
......
......@@ -69,13 +69,6 @@
"task_name":"linux_fuchsia_precache",
"enabled":true
},
{
"name":"Linux gradle_jetifier_test",
"repo":"flutter",
"task_name":"linux_gradle_jetifier_test",
"enabled":true,
"run_if": ["dev/**", "bin/**"]
},
{
"name":"Linux gradle_non_android_plugin_test",
"repo":"flutter",
......@@ -104,12 +97,6 @@
"enabled":true,
"run_if": ["dev/**", "bin/**"]
},
{
"name":"Linux gradle_r8_test",
"repo":"flutter",
"task_name":"linux_gradle_r8_test",
"enabled":true
},
{
"name":"Linux module_host_with_custom_build_test",
"repo":"flutter",
......@@ -131,13 +118,6 @@
"enabled":true,
"run_if": ["dev/**", "bin/**"]
},
{
"name":"Linux plugin_dependencies_test",
"repo":"flutter",
"task_name":"linux_plugin_dependencies_test",
"enabled":true,
"run_if": ["dev/**", "bin/**"]
},
{
"name":"Linux plugin_test",
"repo":"flutter",
......@@ -226,13 +206,6 @@
"enabled":true,
"run_if":["dev/**", "packages/flutter/**", "packages/flutter_goldens/**", "packages/flutter_goldens_client/**", "packages/flutter_test/**", "packages/flutter_tools/lib/src/test/**", "bin/**"]
},
{
"name":"Mac gradle_jetifier_test",
"repo":"flutter",
"task_name":"mac_gradle_jetifier_test",
"enabled":true,
"run_if":["dev/**", "bin/**"]
},
{
"name":"Mac gradle_non_android_plugin_test",
"repo":"flutter",
......@@ -261,13 +234,6 @@
"enabled":true,
"run_if":["dev/**", "bin/**"]
},
{
"name":"Mac gradle_r8_test",
"repo":"flutter",
"task_name":"mac_gradle_r8_test",
"enabled":true,
"run_if":["dev/**", "bin/**"]
},
{
"name":"Mac module_custom_host_app_name_test",
"repo":"flutter",
......@@ -296,13 +262,6 @@
"enabled":true,
"run_if":["dev/**", "bin/**"]
},
{
"name":"Mac plugin_dependencies_test",
"repo":"flutter",
"task_name":"mac_plugin_dependencies_test",
"enabled":true,
"run_if":["dev/**", "bin/**"]
},
{
"name":"Mac plugin_lint_mac",
"repo":"flutter",
......@@ -350,13 +309,6 @@
"enabled":true,
"run_if":["dev/", "packages/flutter/", "packages/flutter_test/", "packages/flutter_goldens/", "packages/flutter_tools/lib/src/test/", "bin/"]
},
{
"name": "Windows gradle_jetifier_test",
"repo": "flutter",
"task_name": "win_gradle_jetifier_test",
"enabled":true,
"run_if":["dev/**", "bin/**"]
},
{
"name": "Windows gradle_non_android_plugin_test",
"repo": "flutter",
......@@ -378,13 +330,6 @@
"enabled":true,
"run_if":["dev/**", "bin/**"]
},
{
"name": "Windows gradle_r8_test",
"repo": "flutter",
"task_name": "win_gradle_r8_test",
"enabled":true,
"run_if":["dev/**", "bin/**"]
},
{
"name": "Windows module_custom_host_app_name_test",
"repo": "flutter",
......@@ -406,13 +351,6 @@
"enabled":true,
"run_if":["dev/**", "bin/**"]
},
{
"name": "Windows plugin_dependencies_test",
"repo": "flutter",
"task_name": "win_plugin_dependencies_test",
"enabled":true,
"run_if":["dev/**", "bin/**"]
},
{
"name": "Windows plugin_test",
"repo": "flutter",
......
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