From c11a64e944f55eb753b8286761a696ead82801c3 Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Wed, 14 Oct 2020 13:24:22 -0700 Subject: [PATCH] [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. --- .../bin/tasks/gradle_jetifier_test.dart | 145 ------------------ .../gradle_plugin_dependencies_test.dart | 144 ----------------- ...adle_plugins_without_annotations_test.dart | 142 ----------------- dev/devicelab/bin/tasks/gradle_r8_test.dart | 77 ---------- dev/prod_builders.json | 54 ------- dev/try_builders.json | 62 -------- 6 files changed, 624 deletions(-) delete mode 100644 dev/devicelab/bin/tasks/gradle_jetifier_test.dart delete mode 100644 dev/devicelab/bin/tasks/gradle_plugin_dependencies_test.dart delete mode 100644 dev/devicelab/bin/tasks/gradle_plugins_without_annotations_test.dart delete mode 100644 dev/devicelab/bin/tasks/gradle_r8_test.dart diff --git a/dev/devicelab/bin/tasks/gradle_jetifier_test.dart b/dev/devicelab/bin/tasks/gradle_jetifier_test.dart deleted file mode 100644 index 0425a3a504..0000000000 --- a/dev/devicelab/bin/tasks/gradle_jetifier_test.dart +++ /dev/null @@ -1,145 +0,0 @@ -// 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 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: [ - '--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: ['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: [ - '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, [ - // 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: [ - '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, [ - // 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); - } - }); -} diff --git a/dev/devicelab/bin/tasks/gradle_plugin_dependencies_test.dart b/dev/devicelab/bin/tasks/gradle_plugin_dependencies_test.dart deleted file mode 100644 index 4cb24d28b4..0000000000 --- a/dev/devicelab/bin/tasks/gradle_plugin_dependencies_test.dart +++ /dev/null @@ -1,144 +0,0 @@ -// 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 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: [ - '--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: ['get'], - ); - }); - - section('Build release APK'); - - await inDirectory(projectDir, () async { - await flutter( - 'build', - options: [ - '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, [ - // 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: [ - '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, [ - // 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); - } - }); -} diff --git a/dev/devicelab/bin/tasks/gradle_plugins_without_annotations_test.dart b/dev/devicelab/bin/tasks/gradle_plugins_without_annotations_test.dart deleted file mode 100644 index e382b1e859..0000000000 --- a/dev/devicelab/bin/tasks/gradle_plugins_without_annotations_test.dart +++ /dev/null @@ -1,142 +0,0 @@ -// 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 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: [ - '--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: ['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: [ - '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, [ - // 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: [ - '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, [ - // 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); - } - }); -} diff --git a/dev/devicelab/bin/tasks/gradle_r8_test.dart b/dev/devicelab/bin/tasks/gradle_r8_test.dart deleted file mode 100644 index 7fc9a0e5e5..0000000000 --- a/dev/devicelab/bin/tasks/gradle_r8_test.dart +++ /dev/null @@ -1,77 +0,0 @@ -// 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 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: [ - '--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: [ - '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); - } - }); -} diff --git a/dev/prod_builders.json b/dev/prod_builders.json index 090f310182..6dd553b0a7 100644 --- a/dev/prod_builders.json +++ b/dev/prod_builders.json @@ -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", diff --git a/dev/try_builders.json b/dev/try_builders.json index b734ce37e3..77dcc1f31a 100644 --- a/dev/try_builders.json +++ b/dev/try_builders.json @@ -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",