Move gradle_non_android_plugin_test from its own test builders into tools integration.shard (#80161)
This commit is contained in:
@@ -2,112 +2,13 @@
|
||||
// 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 a flutter app that depends on a non-Android plugin
|
||||
/// (an iOS only plugin in this case) can still build for Android.
|
||||
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 plugin project');
|
||||
|
||||
final Directory tempDir = Directory.systemTemp.createTempSync('flutter_plugin_test.');
|
||||
final Directory projectDir = Directory(path.join(tempDir.path, 'ios_only'));
|
||||
try {
|
||||
await inDirectory(tempDir, () async {
|
||||
await flutter(
|
||||
'create',
|
||||
options: <String>[
|
||||
'--org', 'io.flutter.devicelab',
|
||||
'-t', 'plugin',
|
||||
'--platforms=ios,android',
|
||||
'ios_only',
|
||||
],
|
||||
);
|
||||
});
|
||||
|
||||
section("Delete plugin's Android folder");
|
||||
|
||||
final File androidFolder = File(path.join(
|
||||
projectDir.path,
|
||||
'android',
|
||||
));
|
||||
androidFolder.deleteSync(recursive: true);
|
||||
|
||||
section('Update pubspec.yaml to iOS only plugin');
|
||||
final File pubspecFile = File(path.join(projectDir.path, 'pubspec.yaml'));
|
||||
final String pubspecString = pubspecFile.readAsStringSync();
|
||||
|
||||
final StringBuffer iosOnlyPubspec = StringBuffer();
|
||||
bool inAndroidSection = false;
|
||||
const String pluginPlatformIndentation = ' ';
|
||||
for (final String line in pubspecString.split('\n')) {
|
||||
// Skip everything in the Android section of the plugin platforms list.
|
||||
if (line.startsWith('${pluginPlatformIndentation}android:')) {
|
||||
inAndroidSection = true;
|
||||
continue;
|
||||
}
|
||||
if (inAndroidSection) {
|
||||
if (line.startsWith('$pluginPlatformIndentation ')) {
|
||||
continue;
|
||||
} else {
|
||||
inAndroidSection = false;
|
||||
}
|
||||
}
|
||||
iosOnlyPubspec.write('$line\n');
|
||||
}
|
||||
|
||||
pubspecFile.writeAsStringSync(iosOnlyPubspec.toString());
|
||||
|
||||
section('Build example APK');
|
||||
|
||||
final StringBuffer stderr = StringBuffer();
|
||||
|
||||
final Directory exampleDir = Directory(path.join(projectDir.path, 'example'));
|
||||
await inDirectory(exampleDir, () async {
|
||||
await evalFlutter(
|
||||
'build',
|
||||
options: <String>[
|
||||
'apk',
|
||||
'--target-platform', 'android-arm',
|
||||
'--verbose',
|
||||
],
|
||||
canFail: true,
|
||||
stderr: stderr,
|
||||
);
|
||||
});
|
||||
|
||||
section('Check that the example APK was built');
|
||||
|
||||
final String exampleAppApk = path.join(
|
||||
exampleDir.path,
|
||||
'build',
|
||||
'app',
|
||||
'outputs',
|
||||
'apk',
|
||||
'release',
|
||||
'app-release.apk',
|
||||
);
|
||||
if (!exists(File(exampleAppApk))) {
|
||||
return TaskResult.failure('Failed to build example app');
|
||||
}
|
||||
return TaskResult.success(null);
|
||||
} catch (e) {
|
||||
return TaskResult.failure(e.toString());
|
||||
} finally {
|
||||
rmTree(tempDir);
|
||||
}
|
||||
// TODO(jmagman): Remove once gradle_non_android_plugin_test builder can be deleted
|
||||
// when https://github.com/flutter/flutter/pull/80161 rolls to stable.
|
||||
return TaskResult.success(null);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -294,12 +294,6 @@
|
||||
"task_name": "linux_gradle_desugar_classes_test",
|
||||
"flaky": false
|
||||
},
|
||||
{
|
||||
"name": "Linux gradle_non_android_plugin_test",
|
||||
"repo": "flutter",
|
||||
"task_name": "linux_gradle_non_android_plugin_test",
|
||||
"flaky": false
|
||||
},
|
||||
{
|
||||
"name": "Linux gradle_plugin_bundle_test",
|
||||
"repo": "flutter",
|
||||
@@ -858,12 +852,6 @@
|
||||
"task_name": "mac_framework_tests_widgets",
|
||||
"flaky": false
|
||||
},
|
||||
{
|
||||
"name": "Mac gradle_non_android_plugin_test",
|
||||
"repo": "flutter",
|
||||
"task_name": "mac_gradle_non_android_plugin_test",
|
||||
"flaky": false
|
||||
},
|
||||
{
|
||||
"name": "Mac gradle_plugin_bundle_test",
|
||||
"repo": "flutter",
|
||||
@@ -1242,12 +1230,6 @@
|
||||
"task_name": "win_gradle_plugin_light_apk_test",
|
||||
"flaky": true
|
||||
},
|
||||
{
|
||||
"name": "Windows gradle_non_android_plugin_test",
|
||||
"repo": "flutter",
|
||||
"task_name": "win_gradle_non_android_plugin_test",
|
||||
"flaky": false
|
||||
},
|
||||
{
|
||||
"name": "Windows gradle_plugin_bundle_test",
|
||||
"repo": "flutter",
|
||||
|
||||
@@ -130,13 +130,6 @@
|
||||
"enabled": true,
|
||||
"run_if": ["dev/**", "bin/**"]
|
||||
},
|
||||
{
|
||||
"name": "Linux gradle_non_android_plugin_test",
|
||||
"repo": "flutter",
|
||||
"task_name": "linux_gradle_non_android_plugin_test",
|
||||
"enabled": true,
|
||||
"run_if": ["dev/**", "packages/flutter_tools/**", "bin/**"]
|
||||
},
|
||||
{
|
||||
"name": "Linux gradle_plugin_bundle_test",
|
||||
"repo": "flutter",
|
||||
@@ -468,13 +461,6 @@
|
||||
"bin/**"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Mac gradle_non_android_plugin_test",
|
||||
"repo": "flutter",
|
||||
"task_name": "mac_gradle_non_android_plugin_test",
|
||||
"enabled": true,
|
||||
"run_if": ["dev/**", "packages/flutter_tools/**", "bin/**"]
|
||||
},
|
||||
{
|
||||
"name": "Mac gradle_plugin_bundle_test",
|
||||
"repo": "flutter",
|
||||
@@ -672,13 +658,6 @@
|
||||
"bin/"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Windows gradle_non_android_plugin_test",
|
||||
"repo": "flutter",
|
||||
"task_name": "win_gradle_non_android_plugin_test",
|
||||
"enabled": true,
|
||||
"run_if": ["dev/**", "packages/flutter_tools/**", "bin/**"]
|
||||
},
|
||||
{
|
||||
"name": "Windows gradle_plugin_bundle_test",
|
||||
"repo": "flutter",
|
||||
|
||||
Reference in New Issue
Block a user