mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Catch argument error from Make when it isn't installed (#42252)
This commit is contained in:
parent
fde267516b
commit
14c1c211d5
@ -48,18 +48,18 @@ export PROJECT_DIR=${linuxProject.project.directory.path}
|
|||||||
// Invoke make.
|
// Invoke make.
|
||||||
final String buildFlag = getNameForBuildMode(buildInfo.mode ?? BuildMode.release);
|
final String buildFlag = getNameForBuildMode(buildInfo.mode ?? BuildMode.release);
|
||||||
final Stopwatch sw = Stopwatch()..start();
|
final Stopwatch sw = Stopwatch()..start();
|
||||||
final Process process = await processManager.start(<String>[
|
|
||||||
'make',
|
|
||||||
'-C',
|
|
||||||
linuxProject.makeFile.parent.path,
|
|
||||||
'BUILD=$buildFlag',
|
|
||||||
]);
|
|
||||||
final Status status = logger.startProgress(
|
final Status status = logger.startProgress(
|
||||||
'Building Linux application...',
|
'Building Linux application...',
|
||||||
timeout: null,
|
timeout: null,
|
||||||
);
|
);
|
||||||
int result;
|
int result;
|
||||||
try {
|
try {
|
||||||
|
final Process process = await processManager.start(<String>[
|
||||||
|
'make',
|
||||||
|
'-C',
|
||||||
|
linuxProject.makeFile.parent.path,
|
||||||
|
'BUILD=$buildFlag',
|
||||||
|
]);
|
||||||
process.stderr
|
process.stderr
|
||||||
.transform(utf8.decoder)
|
.transform(utf8.decoder)
|
||||||
.transform(const LineSplitter())
|
.transform(const LineSplitter())
|
||||||
@ -69,6 +69,8 @@ export PROJECT_DIR=${linuxProject.project.directory.path}
|
|||||||
.transform(const LineSplitter())
|
.transform(const LineSplitter())
|
||||||
.listen(printTrace);
|
.listen(printTrace);
|
||||||
result = await process.exitCode;
|
result = await process.exitCode;
|
||||||
|
} on ArgumentError {
|
||||||
|
throwToolExit('make not found. Run \'flutter doctor\' for more information.');
|
||||||
} finally {
|
} finally {
|
||||||
status.cancel();
|
status.cancel();
|
||||||
}
|
}
|
||||||
|
@ -117,6 +117,27 @@ void main() {
|
|||||||
FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: true),
|
FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: true),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
testUsingContext('Handles argument error from missing make', () async {
|
||||||
|
final BuildCommand command = BuildCommand();
|
||||||
|
applyMocksToCommand(command);
|
||||||
|
setUpMockProjectFilesForBuild();
|
||||||
|
when(mockProcessManager.start(<String>[
|
||||||
|
'make',
|
||||||
|
'-C',
|
||||||
|
'/linux',
|
||||||
|
'BUILD=release',
|
||||||
|
])).thenThrow(ArgumentError());
|
||||||
|
|
||||||
|
expect(createTestCommandRunner(command).run(
|
||||||
|
const <String>['build', 'linux']
|
||||||
|
), throwsToolExit(message: 'make not found. Run \'flutter doctor\' for more information.'));
|
||||||
|
}, overrides: <Type, Generator>{
|
||||||
|
FileSystem: () => MemoryFileSystem(),
|
||||||
|
ProcessManager: () => mockProcessManager,
|
||||||
|
Platform: () => linuxPlatform,
|
||||||
|
FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: true),
|
||||||
|
});
|
||||||
|
|
||||||
testUsingContext('Linux build --debug passes debug mode to make', () async {
|
testUsingContext('Linux build --debug passes debug mode to make', () async {
|
||||||
final BuildCommand command = BuildCommand();
|
final BuildCommand command = BuildCommand();
|
||||||
applyMocksToCommand(command);
|
applyMocksToCommand(command);
|
||||||
|
Loading…
Reference in New Issue
Block a user