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