Commit cff7dc54 authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

Bump package:process version (#8073)

parent fe0b9093
......@@ -10,6 +10,7 @@ import '../base/context.dart';
import '../base/file_system.dart';
import '../base/os.dart';
import '../base/platform.dart';
import '../base/process_manager.dart';
import '../globals.dart';
AndroidSdk get androidSdk => context[AndroidSdk];
......@@ -120,7 +121,7 @@ class AndroidSdk {
/// Validate the Android SDK. This returns an empty list if there are no
/// issues; otherwise, it returns a list of issues found.
List<String> validateSdkWellFormed() {
if (!fs.isFileSync(adbPath))
if (!processManager.canRun(adbPath))
return <String>['Android SDK file not found: $adbPath.'];
if (sdkVersions.isEmpty || latestVersion == null)
......@@ -130,7 +131,7 @@ class AndroidSdk {
}
String getPlatformToolsPath(String binaryName) {
return path.join(directory, 'platform-tools', os.getExecutableName(binaryName));
return path.join(directory, 'platform-tools', binaryName);
}
void _init() {
......@@ -221,7 +222,7 @@ class AndroidSdkVersion implements Comparable<AndroidSdkVersion> {
String get aaptPath => getBuildToolsPath('aapt');
String get dxPath => getBuildToolsPath('dx', winExtension: 'bat');
String get dxPath => getBuildToolsPath('dx');
String get zipalignPath => getBuildToolsPath('zipalign');
......@@ -229,24 +230,24 @@ class AndroidSdkVersion implements Comparable<AndroidSdkVersion> {
if (_exists(androidJarPath) != null)
return <String>[_exists(androidJarPath)];
if (_exists(aaptPath) != null)
return <String>[_exists(aaptPath)];
if (_canRun(aaptPath) != null)
return <String>[_canRun(aaptPath)];
if (_exists(dxPath) != null)
return <String>[_exists(dxPath)];
if (_canRun(dxPath) != null)
return <String>[_canRun(dxPath)];
if (_exists(zipalignPath) != null)
return <String>[_exists(zipalignPath)];
if (_canRun(zipalignPath) != null)
return <String>[_canRun(zipalignPath)];
return <String>[];
}
String getPlatformsPath(String itemName) {
return path.join(sdk.directory, 'platforms', platformVersionName, os.getExecutableName(itemName));
return path.join(sdk.directory, 'platforms', platformVersionName, itemName);
}
String getBuildToolsPath(String binaryName, { String winExtension }) {
return path.join(sdk.directory, 'build-tools', buildToolsVersionName, os.getExecutableName(binaryName, winExtension: winExtension));
String getBuildToolsPath(String binaryName) {
return path.join(sdk.directory, 'build-tools', buildToolsVersionName, binaryName);
}
@override
......@@ -260,4 +261,10 @@ class AndroidSdkVersion implements Comparable<AndroidSdkVersion> {
return 'Android SDK file not found: $path.';
return null;
}
String _canRun(String path) {
if (!processManager.canRun(path))
return 'Android SDK file not found: $path.';
return null;
}
}
......@@ -46,13 +46,6 @@ abstract class OperatingSystemUtils {
File makePipe(String path);
void unzip(File file, Directory targetDirectory);
/// Returns the name of the [binaryName] executable.
///
/// No-op on most OS.
/// On Windows it returns [binaryName].[winExtension], if [winExtension] is
/// specified, or [binaryName].exe otherwise.
String getExecutableName(String binaryName, { String winExtension });
}
class _PosixUtils extends OperatingSystemUtils {
......@@ -85,9 +78,6 @@ class _PosixUtils extends OperatingSystemUtils {
runSync(<String>['mkfifo', path]);
return fs.file(path);
}
@override
String getExecutableName(String binaryName, { String winExtension }) => binaryName;
}
class _WindowsUtils extends OperatingSystemUtils {
......@@ -127,14 +117,6 @@ class _WindowsUtils extends OperatingSystemUtils {
File makePipe(String path) {
throw new UnsupportedError('makePipe is not implemented on Windows.');
}
@override
String getExecutableName(String binaryName, { String winExtension }) {
winExtension ??= 'exe';
if (path.extension(binaryName).isEmpty && winExtension.isNotEmpty)
return '$binaryName.$winExtension';
return binaryName;
}
}
Future<int> findAvailablePort() async {
......
......@@ -9,8 +9,8 @@ import 'package:path/path.dart' as path;
import '../base/common.dart';
import '../base/file_system.dart';
import '../base/logger.dart';
import '../base/os.dart';
import '../base/process.dart';
import '../base/process_manager.dart';
import '../base/utils.dart';
import '../build_info.dart';
import '../dart/package_map.dart';
......@@ -120,7 +120,7 @@ Future<String> _buildAotSnapshot(
String entryPointsDir, dartEntryPointsDir, snapshotterDir, genSnapshot;
String engineSrc = tools.engineSrcPath;
String genSnapshotExecutable = os.getExecutableName('gen_snapshot');
String genSnapshotExecutable = 'gen_snapshot';
if (engineSrc != null) {
entryPointsDir = path.join(engineSrc, 'flutter', 'runtime');
dartEntryPointsDir = path.join(engineSrc, 'dart', 'runtime', 'bin');
......@@ -168,7 +168,6 @@ Future<String> _buildAotSnapshot(
String vmServicePath = path.join(skyEnginePkg, 'sdk_ext', 'vmservice_io.dart');
List<String> filePaths = <String>[
genSnapshot,
vmEntryPoints,
ioEntryPoints,
uiPath,
......@@ -209,6 +208,10 @@ Future<String> _buildAotSnapshot(
printError('Missing files: $missingFiles');
return null;
}
if (!processManager.canRun(genSnapshot)) {
printError('Cannot locate the genSnapshot executable');
return null;
}
List<String> genSnapshotCmd = <String>[
genSnapshot,
......
......@@ -14,6 +14,7 @@ import '../base/file_system.dart';
import '../base/logger.dart';
import '../base/os.dart';
import '../base/process.dart';
import '../base/process_manager.dart';
import '../base/utils.dart';
import '../build_info.dart';
import '../flx.dart' as flx;
......@@ -82,11 +83,11 @@ class _ApkBuilder {
String checkDependencies() {
if (!_androidJar.existsSync())
return 'Cannot find android.jar at ${_androidJar.path}';
if (!_aapt.existsSync())
if (!processManager.canRun(_aapt.path))
return 'Cannot find aapt at ${_aapt.path}';
if (!_dx.existsSync())
if (!processManager.canRun(_dx.path))
return 'Cannot find dx at ${_dx.path}';
if (!_zipalign.existsSync())
if (!processManager.canRun(_zipalign.path))
return 'Cannot find zipalign at ${_zipalign.path}';
if (_jarsigner == null)
return 'Cannot find jarsigner in PATH.';
......
......@@ -7,7 +7,6 @@ import 'dart:async';
import 'package:path/path.dart' as path;
import '../base/common.dart';
import '../base/os.dart';
import '../base/process.dart';
import '../cache.dart';
import '../runner/flutter_command.dart';
......@@ -38,8 +37,7 @@ class FormatCommand extends FlutterCommand {
);
}
String executable = os.getExecutableName('dartfmt', winExtension: 'bat');
String dartfmt = path.join(Cache.flutterRoot, 'bin', 'cache', 'dart-sdk', 'bin', executable);
String dartfmt = path.join(Cache.flutterRoot, 'bin', 'cache', 'dart-sdk', 'bin', 'dartfmt');
List<String> cmd = <String>[dartfmt, '-w']..addAll(argResults.rest);
int result = await runCommandAndStreamOutput(cmd);
if (result != 0)
......
......@@ -58,10 +58,9 @@ class UpgradeCommand extends FlutterCommand {
// if necessary.
printStatus('');
printStatus('Upgrading engine...');
String flutter = os.getExecutableName('flutter', winExtension: 'bat');
code = await runCommandAndStreamOutput(
<String>[
path.join(Cache.flutterRoot, 'bin', flutter), '--no-color', 'precache'
path.join(Cache.flutterRoot, 'bin', 'flutter'), '--no-color', 'precache'
],
workingDirectory: Cache.flutterRoot,
allowReentrantFlutter: true
......
......@@ -23,7 +23,7 @@ dependencies:
package_config: '>=0.1.5 <2.0.0'
path: ^1.4.0
platform: 1.0.1
process: 1.0.1
process: 1.1.0
pub_semver: ^1.0.0
stack_trace: ^1.4.0
usage: ^3.0.0
......
......@@ -145,19 +145,7 @@ class MockSimControl extends Mock implements SimControl {
}
}
class MockOperatingSystemUtils extends Mock implements OperatingSystemUtils {
// TODO(goderbauer): Calls to the executable should be mocked out.
// That way it wouldn't really matter what the mock returns here.
@override
String getExecutableName(String binaryName, { String winExtension }) {
if (!platform.isWindows)
return binaryName;
winExtension ??= 'exe';
if (path.extension(binaryName).isEmpty && winExtension.isNotEmpty)
return '$binaryName.$winExtension';
return binaryName;
}
}
class MockOperatingSystemUtils extends Mock implements OperatingSystemUtils {}
class MockIOSSimulatorUtils extends Mock implements IOSSimulatorUtils {}
......
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