forked from firka/flutter
This reverts commit ddab72e79f.
This commit is contained in:
@@ -21,7 +21,6 @@ void main() {
|
||||
|
||||
await inDirectory(complexLayoutPath, () async {
|
||||
await flutter('drive', options: <String>[
|
||||
'--no-android-gradle-daemon',
|
||||
'-v',
|
||||
'--profile',
|
||||
'--trace-startup', // Enables "endless" timeline event buffering.
|
||||
|
||||
@@ -6,6 +6,7 @@ import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:path/path.dart' as path;
|
||||
import 'package:vm_service_client/vm_service_client.dart';
|
||||
|
||||
import 'package:flutter_devicelab/framework/utils.dart';
|
||||
@@ -87,6 +88,7 @@ Future<TaskResult> runTask(
|
||||
} finally {
|
||||
if (!runnerFinished)
|
||||
runner.kill(ProcessSignal.sigkill);
|
||||
await cleanupSystem();
|
||||
await stdoutSub.cancel();
|
||||
await stderrSub.cancel();
|
||||
}
|
||||
@@ -122,3 +124,42 @@ Future<VMIsolateRef> _connectToRunnerIsolate(Uri vmServiceUri) async {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> cleanupSystem() async {
|
||||
if (deviceOperatingSystem == null || deviceOperatingSystem == DeviceOperatingSystem.android) {
|
||||
print('\n\nCleaning up system after task...');
|
||||
final String javaHome = await findJavaHome();
|
||||
if (javaHome != null) {
|
||||
// To shut gradle down, we have to call "gradlew --stop".
|
||||
// To call gradlew, we need to have a gradle-wrapper.properties file along
|
||||
// with a shell script, a .jar file, etc. We get these from various places
|
||||
// as you see in the code below, and we save them all into a temporary dir
|
||||
// which we can then delete after.
|
||||
// All the steps below are somewhat tolerant of errors, because it doesn't
|
||||
// really matter if this succeeds every time or not.
|
||||
print('\nTelling Gradle to shut down (JAVA_HOME=$javaHome)');
|
||||
final String gradlewBinaryName = Platform.isWindows ? 'gradlew.bat' : 'gradlew';
|
||||
final Directory tempDir = Directory.systemTemp.createTempSync('flutter_devicelab_shutdown_gradle.');
|
||||
recursiveCopy(Directory(path.join(flutterDirectory.path, 'bin', 'cache', 'artifacts', 'gradle_wrapper')), tempDir);
|
||||
copy(File(path.join(path.join(flutterDirectory.path, 'packages', 'flutter_tools'), 'templates', 'app', 'android.tmpl', 'gradle', 'wrapper', 'gradle-wrapper.properties')), Directory(path.join(tempDir.path, 'gradle', 'wrapper')));
|
||||
if (!Platform.isWindows) {
|
||||
await exec(
|
||||
'chmod',
|
||||
<String>['a+x', path.join(tempDir.path, gradlewBinaryName)],
|
||||
canFail: true,
|
||||
);
|
||||
}
|
||||
await exec(
|
||||
path.join(tempDir.path, gradlewBinaryName),
|
||||
<String>['--stop'],
|
||||
environment: <String, String>{ 'JAVA_HOME': javaHome},
|
||||
workingDirectory: tempDir.path,
|
||||
canFail: true,
|
||||
);
|
||||
rmTree(tempDir);
|
||||
print('\n');
|
||||
} else {
|
||||
print('Could not determine JAVA_HOME; not shutting down Gradle.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ Future<TaskResult> runDartDefinesTask() async {
|
||||
await flutter('packages', options: <String>['get']);
|
||||
|
||||
await flutter('drive', options: <String>[
|
||||
'--no-android-gradle-daemon',
|
||||
'--verbose',
|
||||
'-d',
|
||||
deviceId,
|
||||
|
||||
@@ -70,7 +70,6 @@ class GalleryTransitionTest {
|
||||
await flutter(
|
||||
'build',
|
||||
options: <String>[
|
||||
'--no-android-gradle-daemon',
|
||||
'apk',
|
||||
'--profile',
|
||||
'-t',
|
||||
|
||||
@@ -26,7 +26,7 @@ TaskFunction createHotModeTest({String deviceIdOverride, Map<String, String> env
|
||||
final File benchmarkFile = file(path.join(_editedFlutterGalleryDir.path, 'hot_benchmark.json'));
|
||||
rm(benchmarkFile);
|
||||
final List<String> options = <String>[
|
||||
'--hot', '-d', deviceIdOverride, '--benchmark', '--verbose', '--resident', '--no-android-gradle-daemon',
|
||||
'--hot', '-d', deviceIdOverride, '--benchmark', '--verbose', '--resident',
|
||||
];
|
||||
int hotReloadCount = 0;
|
||||
Map<String, dynamic> twoReloadsData;
|
||||
|
||||
@@ -130,7 +130,6 @@ class DriverTest {
|
||||
await flutter('packages', options: <String>['get']);
|
||||
|
||||
final List<String> options = <String>[
|
||||
'--no-android-gradle-daemon',
|
||||
'-v',
|
||||
'-t',
|
||||
testTarget,
|
||||
|
||||
@@ -347,7 +347,6 @@ TaskFunction createsScrollSmoothnessPerfTest() {
|
||||
await flutter('packages', options: <String>['get']);
|
||||
|
||||
await flutter('drive', options: <String>[
|
||||
'--no-android-gradle-daemon',
|
||||
'-v',
|
||||
'--verbose-system-logs',
|
||||
'--profile',
|
||||
@@ -396,7 +395,6 @@ TaskFunction createFramePolicyIntegrationTest() {
|
||||
await flutter('packages', options: <String>['get']);
|
||||
|
||||
await flutter('drive', options: <String>[
|
||||
'--no-android-gradle-daemon',
|
||||
'-v',
|
||||
'--verbose-system-logs',
|
||||
'--profile',
|
||||
@@ -461,7 +459,6 @@ class StartupTest {
|
||||
final List<Map<String, dynamic>> results = <Map<String, dynamic>>[];
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
await flutter('run', options: <String>[
|
||||
'--no-android-gradle-daemon',
|
||||
'--verbose',
|
||||
'--profile',
|
||||
'--trace-startup',
|
||||
@@ -578,7 +575,6 @@ class PerfTest {
|
||||
await flutter('packages', options: <String>['get']);
|
||||
|
||||
await flutter('drive', options: <String>[
|
||||
'--no-android-gradle-daemon',
|
||||
'-v',
|
||||
'--verbose-system-logs',
|
||||
'--profile',
|
||||
|
||||
@@ -43,7 +43,6 @@ class TrackWidgetCreationEnabledTask {
|
||||
final Process runProcess = await startProcess(
|
||||
path.join(flutterDirectory.path, 'bin', 'flutter'),
|
||||
flutterCommandArgs('run', <String>[
|
||||
'--no-android-gradle-daemon',
|
||||
...?additionalArgs,
|
||||
'--vmservice-out-file=info',
|
||||
'--track-widget-creation',
|
||||
@@ -79,7 +78,6 @@ class TrackWidgetCreationEnabledTask {
|
||||
final Process runProcess = await startProcess(
|
||||
path.join(flutterDirectory.path, 'bin', 'flutter'),
|
||||
flutterCommandArgs('run', <String>[
|
||||
'--no-android-gradle-daemon',
|
||||
...?additionalArgs,
|
||||
'--vmservice-out-file=info',
|
||||
'--no-track-widget-creation',
|
||||
|
||||
Reference in New Issue
Block a user