Unverified Commit 48034289 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

Switch desktop build commands to use process utils (#42373)

parent 94515ba5
......@@ -5,12 +5,10 @@
import '../artifacts.dart';
import '../base/common.dart';
import '../base/file_system.dart';
import '../base/io.dart';
import '../base/logger.dart';
import '../base/process_manager.dart';
import '../base/process.dart';
import '../build_info.dart';
import '../cache.dart';
import '../convert.dart';
import '../globals.dart';
import '../project.dart';
import '../reporting/reporting.dart';
......@@ -54,21 +52,12 @@ export PROJECT_DIR=${linuxProject.project.directory.path}
);
int result;
try {
final Process process = await processManager.start(<String>[
result = await processUtils.stream(<String>[
'make',
'-C',
linuxProject.makeFile.parent.path,
'BUILD=$buildFlag',
]);
process.stderr
.transform(utf8.decoder)
.transform(const LineSplitter())
.listen(printError);
process.stdout
.transform(utf8.decoder)
.transform(const LineSplitter())
.listen(printTrace);
result = await process.exitCode;
} on ArgumentError {
throwToolExit('make not found. Run \'flutter doctor\' for more information.');
} finally {
......
......@@ -4,16 +4,13 @@
import '../base/common.dart';
import '../base/file_system.dart';
import '../base/io.dart';
import '../base/logger.dart';
import '../base/process_manager.dart';
import '../base/process.dart';
import '../build_info.dart';
import '../convert.dart';
import '../globals.dart';
import '../ios/xcodeproj.dart';
import '../project.dart';
import '../reporting/reporting.dart';
import 'cocoapod_utils.dart';
/// Builds the macOS project through xcodebuild.
......@@ -65,33 +62,24 @@ Future<void> buildMacOS({
// Run the Xcode build.
final Stopwatch sw = Stopwatch()..start();
final Process process = await processManager.start(<String>[
'/usr/bin/env',
'xcrun',
'xcodebuild',
'-workspace', flutterProject.macos.xcodeWorkspace.path,
'-configuration', '$configuration',
'-scheme', 'Runner',
'-derivedDataPath', flutterBuildDir.absolute.path,
'OBJROOT=${fs.path.join(flutterBuildDir.absolute.path, 'Build', 'Intermediates.noindex')}',
'SYMROOT=${fs.path.join(flutterBuildDir.absolute.path, 'Build', 'Products')}',
'COMPILER_INDEX_STORE_ENABLE=NO',
]);
final Status status = logger.startProgress(
'Building macOS application...',
timeout: null,
);
int result;
try {
process.stderr
.transform(utf8.decoder)
.transform(const LineSplitter())
.listen(printError);
process.stdout
.transform(utf8.decoder)
.transform(const LineSplitter())
.listen(printTrace);
result = await process.exitCode;
result = await processUtils.stream(<String>[
'/usr/bin/env',
'xcrun',
'xcodebuild',
'-workspace', flutterProject.macos.xcodeWorkspace.path,
'-configuration', '$configuration',
'-scheme', 'Runner',
'-derivedDataPath', flutterBuildDir.absolute.path,
'OBJROOT=${fs.path.join(flutterBuildDir.absolute.path, 'Build', 'Intermediates.noindex')}',
'SYMROOT=${fs.path.join(flutterBuildDir.absolute.path, 'Build', 'Products')}',
'COMPILER_INDEX_STORE_ENABLE=NO',
]);
} finally {
status.cancel();
}
......
......@@ -5,16 +5,13 @@
import '../artifacts.dart';
import '../base/common.dart';
import '../base/file_system.dart';
import '../base/io.dart';
import '../base/logger.dart';
import '../base/process_manager.dart';
import '../base/process.dart';
import '../build_info.dart';
import '../cache.dart';
import '../convert.dart';
import '../globals.dart';
import '../project.dart';
import '../reporting/reporting.dart';
import 'msbuild_utils.dart';
import 'visual_studio.dart';
......@@ -63,30 +60,21 @@ Future<void> buildWindows(WindowsProject windowsProject, BuildInfo buildInfo, {S
final String configuration = buildInfo.isDebug ? 'Debug' : 'Release';
final String solutionPath = windowsProject.solutionFile.path;
final Stopwatch sw = Stopwatch()..start();
// Run the script with a relative path to the project using the enclosing
// directory as the workingDirectory, to avoid hitting the limit on command
// lengths in batch scripts if the absolute path to the project is long.
final Process process = await processManager.start(<String>[
buildScript,
vcvarsScript,
fs.path.basename(solutionPath),
configuration,
], workingDirectory: fs.path.dirname(solutionPath));
final Status status = logger.startProgress(
'Building Windows application...',
timeout: null,
);
int result;
try {
process.stderr
.transform(utf8.decoder)
.transform(const LineSplitter())
.listen(printError);
process.stdout
.transform(utf8.decoder)
.transform(const LineSplitter())
.listen(printTrace);
result = await process.exitCode;
// Run the script with a relative path to the project using the enclosing
// directory as the workingDirectory, to avoid hitting the limit on command
// lengths in batch scripts if the absolute path to the project is long.
result = await processUtils.stream(<String>[
buildScript,
vcvarsScript,
fs.path.basename(solutionPath),
configuration,
], workingDirectory: fs.path.dirname(solutionPath));
} finally {
status.cancel();
}
......
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