Revert "Add flutter build aar (#35217)" (#36731)

This reverts commit 11460b8378.
This commit is contained in:
Emmanuel Garcia
2019-07-22 22:07:59 -07:00
committed by GitHub
parent 11460b8378
commit c9b466f9e2
30 changed files with 147 additions and 2162 deletions

View File

@@ -961,14 +961,9 @@ Future<void> _androidGradleTests(String subShard) async {
if (subShard == 'gradle1') {
await _runDevicelabTest('gradle_plugin_light_apk_test', env: env);
await _runDevicelabTest('gradle_plugin_fat_apk_test', env: env);
await _runDevicelabTest('gradle_jetifier_test', env: env);
await _runDevicelabTest('gradle_plugin_dependencies_test', env: env);
await _runDevicelabTest('gradle_migrate_settings_test', env: env);
}
if (subShard == 'gradle2') {
await _runDevicelabTest('gradle_plugin_bundle_test', env: env);
await _runDevicelabTest('module_test', env: env);
await _runDevicelabTest('build_aar_plugin_test', env: env);
await _runDevicelabTest('build_aar_module_test', env: env);
}
}

View File

@@ -1,219 +0,0 @@
// Copyright (c) 2019 The Chromium 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:async';
import 'dart:io';
import 'package:flutter_devicelab/framework/framework.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 AARs can be built on module projects.
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 module 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', '--template', 'module', 'hello'],
);
});
section('Add plugins');
final File pubspec = File(path.join(projectDir.path, 'pubspec.yaml'));
String content = pubspec.readAsStringSync();
content = content.replaceFirst(
'\ndependencies:\n',
'\ndependencies:\n device_info:\n package_info:\n',
);
pubspec.writeAsStringSync(content, flush: true);
await inDirectory(projectDir, () async {
await flutter(
'packages',
options: <String>['get'],
);
});
section('Build release AAR');
await inDirectory(projectDir, () async {
await flutter(
'build',
options: <String>['aar', '--verbose'],
);
});
final String repoPath = path.join(
projectDir.path,
'build',
'host',
'outputs',
'repo',
);
checkFileExists(path.join(
repoPath,
'io',
'flutter',
'devicelab',
'hello',
'flutter_release',
'1.0',
'flutter_release-1.0.aar',
));
checkFileExists(path.join(
repoPath,
'io',
'flutter',
'devicelab',
'hello',
'flutter_release',
'1.0',
'flutter_release-1.0.pom',
));
checkFileExists(path.join(
repoPath,
'io',
'flutter',
'plugins',
'deviceinfo',
'device_info_release',
'1.0',
'device_info_release-1.0.aar',
));
checkFileExists(path.join(
repoPath,
'io',
'flutter',
'plugins',
'deviceinfo',
'device_info_release',
'1.0',
'device_info_release-1.0.pom',
));
checkFileExists(path.join(
repoPath,
'io',
'flutter',
'plugins',
'packageinfo',
'package_info_release',
'1.0',
'package_info_release-1.0.aar',
));
checkFileExists(path.join(
repoPath,
'io',
'flutter',
'plugins',
'packageinfo',
'package_info_release',
'1.0',
'package_info_release-1.0.pom',
));
section('Build debug AAR');
await inDirectory(projectDir, () async {
await flutter(
'build',
options: <String>['aar', '--verbose', '--debug'],
);
});
checkFileExists(path.join(
repoPath,
'io',
'flutter',
'devicelab',
'hello',
'flutter_release',
'1.0',
'flutter_release-1.0.aar',
));
checkFileExists(path.join(
repoPath,
'io',
'flutter',
'devicelab',
'hello',
'flutter_debug',
'1.0',
'flutter_debug-1.0.pom',
));
checkFileExists(path.join(
repoPath,
'io',
'flutter',
'plugins',
'deviceinfo',
'device_info_debug',
'1.0',
'device_info_debug-1.0.aar',
));
checkFileExists(path.join(
repoPath,
'io',
'flutter',
'plugins',
'deviceinfo',
'device_info_debug',
'1.0',
'device_info_debug-1.0.pom',
));
checkFileExists(path.join(
repoPath,
'io',
'flutter',
'plugins',
'packageinfo',
'package_info_debug',
'1.0',
'package_info_debug-1.0.aar',
));
checkFileExists(path.join(
repoPath,
'io',
'flutter',
'plugins',
'packageinfo',
'package_info_debug',
'1.0',
'package_info_debug-1.0.pom',
));
return TaskResult.success(null);
} catch (e) {
return TaskResult.failure(e.toString());
} finally {
rmTree(tempDir);
}
});
}

View File

@@ -1,138 +0,0 @@
// Copyright (c) 2019 The Chromium 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:async';
import 'dart:io';
import 'package:flutter_devicelab/framework/framework.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 AARs can be built on plugin projects.
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 plugin 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',
'--template', 'plugin',
'hello',
],
);
});
section('Build release AAR');
await inDirectory(projectDir, () async {
await flutter(
'build',
options: <String>['aar', '--verbose'],
);
});
final String repoPath = path.join(
projectDir.path,
'build',
'outputs',
'repo',
);
final File releaseAar = File(path.join(
repoPath,
'io',
'flutter',
'devicelab',
'hello',
'hello_release',
'1.0',
'hello_release-1.0.aar',
));
if (!exists(releaseAar)) {
return TaskResult.failure('Failed to build the release AAR file.');
}
final File releasePom = File(path.join(
repoPath,
'io',
'flutter',
'devicelab',
'hello',
'hello_release',
'1.0',
'hello_release-1.0.pom',
));
if (!exists(releasePom)) {
return TaskResult.failure('Failed to build the release POM file.');
}
section('Build debug AAR');
await inDirectory(projectDir, () async {
await flutter(
'build',
options: <String>[
'aar',
'--verbose',
'--debug',
],
);
});
final File debugAar = File(path.join(
repoPath,
'io',
'flutter',
'devicelab',
'hello',
'hello_debug',
'1.0',
'hello_debug-1.0.aar',
));
if (!exists(debugAar)) {
return TaskResult.failure('Failed to build the debug AAR file.');
}
final File debugPom = File(path.join(
repoPath,
'io',
'flutter',
'devicelab',
'hello',
'hello_debug',
'1.0',
'hello_debug-1.0.pom',
));
if (!exists(debugPom)) {
return TaskResult.failure('Failed to build the debug POM file.');
}
return TaskResult.success(null);
} catch (e) {
return TaskResult.failure(e.toString());
} finally {
rmTree(tempDir);
}
});
}

View File

@@ -1,138 +0,0 @@
// Copyright (c) 2019 The Chromium 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:async';
import 'dart:io';
import 'package:flutter_devicelab/framework/apk_utils.dart';
import 'package:flutter_devicelab/framework/framework.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 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',
'--androidx',
'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(
'\ndependencies:\n',
'\ndependencies:\n firebase_auth: 0.7.0\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',
'apk',
'release',
'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', '--verbose',
],
);
});
final File debugApk = File(path.join(
projectDir.path,
'build',
'app',
'outputs',
'apk',
'debug',
'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);
}
});
}

View File

@@ -1,180 +0,0 @@
// Copyright (c) 2019 The Chromium 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:async';
import 'dart:io';
import 'package:flutter_devicelab/framework/framework.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 [settings_aar.gradle] is created when possible.
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 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>['hello'],
);
});
section('Override settings.gradle V1');
final String relativeNewSettingsGradle = path.join('android', 'settings_aar.gradle');
section('Build APK');
String stdout;
await inDirectory(projectDir, () async {
stdout = await evalFlutter(
'build',
options: <String>[
'apk',
'--flavor', 'does-not-exist',
],
canFail: true, // The flavor doesn't exist.
);
});
const String newFileContent = 'include \':app\'';
final File settingsGradle = File(path.join(projectDir.path, 'android', 'settings.gradle'));
final File newSettingsGradle = File(path.join(projectDir.path, 'android', 'settings_aar.gradle'));
if (!newSettingsGradle.existsSync()) {
return TaskResult.failure('Expected file: `${newSettingsGradle.path}`.');
}
if (newSettingsGradle.readAsStringSync().trim() != newFileContent) {
return TaskResult.failure('Expected to create `${newSettingsGradle.path}` V1.');
}
if (!stdout.contains('Creating `$relativeNewSettingsGradle`') ||
!stdout.contains('`$relativeNewSettingsGradle` created successfully')) {
return TaskResult.failure('Expected update message in stdout.');
}
section('Override settings.gradle V2');
const String deprecatedFileContentV2 = '''
include ':app'
def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
def plugins = new Properties()
def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
if (pluginsFile.exists()) {
pluginsFile.withInputStream { stream -> plugins.load(stream) }
}
plugins.each { name, path ->
def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
include ":\$name"
project(":\$name").projectDir = pluginDirectory
}
''';
settingsGradle.writeAsStringSync(deprecatedFileContentV2, flush: true);
newSettingsGradle.deleteSync();
section('Build APK');
await inDirectory(projectDir, () async {
stdout = await evalFlutter(
'build',
options: <String>[
'apk',
'--flavor', 'does-not-exist',
],
canFail: true, // The flavor doesn't exist.
);
});
if (newSettingsGradle.readAsStringSync().trim() != newFileContent) {
return TaskResult.failure('Expected to create `${newSettingsGradle.path}` V2.');
}
if (!stdout.contains('Creating `$relativeNewSettingsGradle`') ||
!stdout.contains('`$relativeNewSettingsGradle` created successfully')) {
return TaskResult.failure('Expected update message in stdout.');
}
section('Override settings.gradle with custom logic');
const String customDeprecatedFileContent = '''
include ':app'
def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
def plugins = new Properties()
def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
if (pluginsFile.exists()) {
pluginsFile.withInputStream { stream -> plugins.load(stream) }
}
plugins.each { name, path ->
def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
include ":\$name"
project(":\$name").projectDir = pluginDirectory
}
// some custom logic
''';
settingsGradle.writeAsStringSync(customDeprecatedFileContent, flush: true);
newSettingsGradle.deleteSync();
section('Build APK');
final StringBuffer stderr = StringBuffer();
await inDirectory(projectDir, () async {
stdout = await evalFlutter(
'build',
options: <String>[
'apk',
'--flavor', 'does-not-exist',
],
canFail: true, // The flavor doesn't exist.
stderr: stderr,
);
});
if (newSettingsGradle.existsSync()) {
return TaskResult.failure('Unexpected file: `${newSettingsGradle.path}`.');
}
if (!stdout.contains('Creating `$relativeNewSettingsGradle`')) {
return TaskResult.failure('Expected update message in stdout.');
}
if (stdout.contains('`$relativeNewSettingsGradle` created successfully')) {
return TaskResult.failure('Unexpected message in stdout.');
}
if (!stderr.toString().contains('Flutter tried to create the file '
'`$relativeNewSettingsGradle`, but failed.')) {
return TaskResult.failure('Expected failure message in stdout.');
}
return TaskResult.success(null);
} catch (e) {
return TaskResult.failure(e.toString());
} finally {
rmTree(tempDir);
}
});
}

View File

@@ -1,147 +0,0 @@
// Copyright (c) 2019 The Chromium 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:async';
import 'dart:io';
import 'package:flutter_devicelab/framework/apk_utils.dart';
import 'package:flutter_devicelab/framework/framework.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 transtive 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',
'--androidx',
'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',
'apk',
'release',
'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',
'apk',
'debug',
'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);
}
});
}

View File

@@ -42,7 +42,7 @@ Future<void> main() async {
String content = await pubspec.readAsString();
content = content.replaceFirst(
'\ndependencies:\n',
'\ndependencies:\n device_info:\n package_info:\n',
'\ndependencies:\n battery:\n package_info:\n',
);
await pubspec.writeAsString(content, flush: true);
await inDirectory(projectDir, () async {

View File

@@ -143,7 +143,7 @@ Future<void> main() async {
String content = await pubspec.readAsString();
content = content.replaceFirst(
'\ndependencies:\n',
'\ndependencies:\n device_info:\n package_info:\n',
'\ndependencies:\n battery:\n package_info:\n',
);
await pubspec.writeAsString(content, flush: true);
await inDirectory(projectDir, () async {

View File

@@ -83,93 +83,6 @@ bool hasMultipleOccurrences(String text, Pattern pattern) {
return text.indexOf(pattern) != text.lastIndexOf(pattern);
}
/// Utility class to analyze the content inside an APK using dexdump,
/// which is provided by the Android SDK.
/// https://android.googlesource.com/platform/art/+/master/dexdump/dexdump.cc
class ApkExtractor {
ApkExtractor(this.apkFile);
/// The APK.
final File apkFile;
bool _extracted = false;
Directory _outputDir;
Future<void> _extractApk() async {
if (_extracted) {
return;
}
_outputDir = apkFile.parent.createTempSync('apk');
if (Platform.isWindows) {
await eval('7za', <String>['x', apkFile.path], workingDirectory: _outputDir.path);
} else {
await eval('unzip', <String>[apkFile.path], workingDirectory: _outputDir.path);
}
_extracted = true;
}
/// Returns the full path to the [dexdump] tool.
Future<String> _findDexDump() async {
final String androidHome = Platform.environment['ANDROID_HOME'] ??
Platform.environment['ANDROID_SDK_ROOT'];
if (androidHome == null || androidHome.isEmpty) {
throw Exception('Unset env flag: `ANDROID_HOME` or `ANDROID_SDK_ROOT`.');
}
String dexdumps;
if (Platform.isWindows) {
dexdumps = await eval('dir', <String>['/s/b', 'dexdump.exe'],
workingDirectory: androidHome);
} else {
dexdumps = await eval('find', <String>[androidHome, '-name', 'dexdump']);
}
if (dexdumps.isEmpty) {
throw Exception('Couldn\'t find a dexdump executable.');
}
return dexdumps.split('\n').first;
}
// Removes any temporary directory.
void dispose() {
if (!_extracted) {
return;
}
rmTree(_outputDir);
_extracted = true;
}
/// Returns true if the APK contains a given class.
Future<bool> containsClass(String className) async {
await _extractApk();
final String dexDump = await _findDexDump();
final String classesDex = path.join(_outputDir.path, 'classes.dex');
if (!File(classesDex).existsSync()) {
throw Exception('Couldn\'t find classes.dex in the APK.');
}
final String classDescriptors = await eval(dexDump,
<String>[classesDex], printStdout: false);
if (classDescriptors.isEmpty) {
throw Exception('No descriptors found in classes.dex.');
}
return classDescriptors.contains(className.replaceAll('.', '/'));
}
}
/// Checks that the classes are contained in the APK, throws otherwise.
Future<void> checkApkContainsClasses(File apk, List<String> classes) async {
final ApkExtractor extractor = ApkExtractor(apk);
for (String className in classes) {
if (!(await extractor.containsClass(className))) {
throw Exception('APK doesn\'t contain class `$className`.');
}
}
extractor.dispose();
}
class FlutterProject {
FlutterProject(this.parent, this.name);

View File

@@ -303,7 +303,7 @@ Future<int> exec(
/// Executes a command and returns its standard output as a String.
///
/// For logging purposes, the command's output is also printed out by default.
/// For logging purposes, the command's output is also printed out.
Future<String> eval(
String executable,
List<String> arguments, {
@@ -311,8 +311,6 @@ Future<String> eval(
bool canFail = false, // as in, whether failures are ok. False means that they are fatal.
String workingDirectory,
StringBuffer stderr, // if not null, the stderr will be written here
bool printStdout = true,
bool printStderr = true,
}) async {
final Process process = await startProcess(executable, arguments, environment: environment, workingDirectory: workingDirectory);
@@ -323,18 +321,14 @@ Future<String> eval(
.transform<String>(utf8.decoder)
.transform<String>(const LineSplitter())
.listen((String line) {
if (printStdout) {
print('stdout: $line');
}
print('stdout: $line');
output.writeln(line);
}, onDone: () { stdoutDone.complete(); });
process.stderr
.transform<String>(utf8.decoder)
.transform<String>(const LineSplitter())
.listen((String line) {
if (printStderr) {
print('stderr: $line');
}
print('stderr: $line');
stderr?.writeln(line);
}, onDone: () { stderrDone.complete(); });
@@ -625,10 +619,3 @@ void setLocalEngineOptionIfNecessary(List<String> options, [String flavor]) {
options.add('--local-engine=${osNames[deviceOperatingSystem]}_$flavor');
}
}
/// Checks that the file exists, otherwise throws a [FileSystemException].
void checkFileExists(String file) {
if (!exists(File(file))) {
throw FileSystemException('Expected file to exit.', file);
}
}