Show Xcode compilation errors at end of build, suppress stdout and stderr from Xcode (#113302)
This commit is contained in:
@@ -135,13 +135,13 @@ void main() {
|
||||
testUsingContext('flutter assemble does not log stack traces during build failure', () async {
|
||||
final CommandRunner<void> commandRunner = createTestCommandRunner(AssembleCommand(
|
||||
buildSystem: TestBuildSystem.all(BuildResult(success: false, exceptions: <String, ExceptionMeasurement>{
|
||||
'hello': ExceptionMeasurement('hello', 'bar', stackTrace),
|
||||
'hello': ExceptionMeasurement('hello', 'bar', stackTrace, fatal: true),
|
||||
}))
|
||||
));
|
||||
|
||||
await expectLater(commandRunner.run(<String>['assemble', '-o Output', 'debug_macos_bundle_flutter_assets']),
|
||||
throwsToolExit());
|
||||
expect(testLogger.errorText, isNot(contains('bar')));
|
||||
expect(testLogger.errorText, contains('Target hello failed: bar'));
|
||||
expect(testLogger.errorText, isNot(contains(stackTrace.toString())));
|
||||
}, overrides: <Type, Generator>{
|
||||
Cache: () => Cache.test(processManager: FakeProcessManager.any()),
|
||||
|
||||
@@ -372,7 +372,7 @@ void main() {
|
||||
XcodeProjectInterpreter: () => FakeXcodeProjectInterpreterWithBuildSettings(),
|
||||
});
|
||||
|
||||
testUsingContext('Display xcresult issues on console if parsed.', () async {
|
||||
testUsingContext('Display xcresult issues on console if parsed, suppress Xcode output', () async {
|
||||
final BuildCommand command = BuildCommand();
|
||||
|
||||
createMinimalMockProjectFiles();
|
||||
@@ -384,13 +384,16 @@ void main() {
|
||||
|
||||
expect(testLogger.errorText, contains("Use of undeclared identifier 'asdas'"));
|
||||
expect(testLogger.errorText, contains('/Users/m/Projects/test_create/ios/Runner/AppDelegate.m:7:56'));
|
||||
expect(testLogger.statusText, isNot(contains("Xcode's output")));
|
||||
expect(testLogger.statusText, isNot(contains('Lots of spew from Xcode')));
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fileSystem,
|
||||
ProcessManager: () => FakeProcessManager.list(<FakeCommand>[
|
||||
xattrCommand,
|
||||
setUpFakeXcodeBuildHandler(exitCode: 1, onRun: () {
|
||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleFilePath).createSync();
|
||||
}),
|
||||
}, stdout: 'Lots of spew from Xcode',
|
||||
),
|
||||
setUpXCResultCommand(stdout: kSampleResultJsonWithIssues),
|
||||
setUpRsyncCommand(),
|
||||
]),
|
||||
@@ -621,7 +624,6 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig
|
||||
XcodeProjectInterpreter: () => FakeXcodeProjectInterpreterWithBuildSettings(developmentTeam: null),
|
||||
});
|
||||
|
||||
|
||||
testUsingContext('xcresult did not detect issue but detected by stdout.', () async {
|
||||
final BuildCommand command = BuildCommand();
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import 'package:flutter_tools/src/cache.dart';
|
||||
import 'package:flutter_tools/src/ios/code_signing.dart';
|
||||
import 'package:flutter_tools/src/ios/iproxy.dart';
|
||||
import 'package:flutter_tools/src/ios/mac.dart';
|
||||
import 'package:flutter_tools/src/ios/xcresult.dart';
|
||||
import 'package:flutter_tools/src/project.dart';
|
||||
import 'package:flutter_tools/src/reporting/reporting.dart';
|
||||
import 'package:test/fake.dart';
|
||||
@@ -265,49 +266,8 @@ Xcode's output:
|
||||
↳
|
||||
blah
|
||||
|
||||
=== CLEAN TARGET url_launcher OF PROJECT Pods WITH CONFIGURATION Release ===
|
||||
|
||||
Check dependencies
|
||||
|
||||
blah
|
||||
|
||||
=== CLEAN TARGET Pods-Runner OF PROJECT Pods WITH CONFIGURATION Release ===
|
||||
|
||||
Check dependencies
|
||||
|
||||
blah
|
||||
|
||||
=== CLEAN TARGET Runner OF PROJECT Runner WITH CONFIGURATION Release ===
|
||||
|
||||
Check dependencies
|
||||
[BCEROR]Signing for "Runner" requires a development team. Select a development team in the project editor.
|
||||
[BCEROR]Code signing is required for product type 'Application' in SDK 'iOS 10.3'
|
||||
[BCEROR]Code signing is required for product type 'Application' in SDK 'iOS 10.3'
|
||||
[BCEROR]Code signing is required for product type 'Application' in SDK 'iOS 10.3'
|
||||
|
||||
blah
|
||||
|
||||
** CLEAN SUCCEEDED **
|
||||
|
||||
=== BUILD TARGET url_launcher OF PROJECT Pods WITH CONFIGURATION Release ===
|
||||
|
||||
Check dependencies
|
||||
|
||||
blah
|
||||
|
||||
=== BUILD TARGET Pods-Runner OF PROJECT Pods WITH CONFIGURATION Release ===
|
||||
|
||||
Check dependencies
|
||||
|
||||
blah
|
||||
|
||||
=== BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Release ===
|
||||
|
||||
Check dependencies
|
||||
Signing for "Runner" requires a development team. Select a development team in the project editor.
|
||||
Code signing is required for product type 'Application' in SDK 'iOS 10.3'
|
||||
Code signing is required for product type 'Application' in SDK 'iOS 10.3'
|
||||
Code signing is required for product type 'Application' in SDK 'iOS 10.3'
|
||||
|
||||
Could not build the precompiled application for the device.''',
|
||||
xcodeBuildExecution: XcodeBuildExecution(
|
||||
@@ -324,6 +284,47 @@ Could not build the precompiled application for the device.''',
|
||||
contains('Building a deployable iOS app requires a selected Development Team with a \nProvisioning Profile.'),
|
||||
);
|
||||
});
|
||||
|
||||
testWithoutContext('does not show no development team message when other Xcode issues detected', () async {
|
||||
final XcodeBuildResult buildResult = XcodeBuildResult(
|
||||
success: false,
|
||||
stdout: '''
|
||||
Running "flutter pub get" in flutter_gallery... 0.6s
|
||||
Launching lib/main.dart on x in release mode...
|
||||
Running pod install... 1.2s
|
||||
Running Xcode build... 1.4s
|
||||
Failed to build iOS app
|
||||
Error output from Xcode build:
|
||||
↳
|
||||
** BUILD FAILED **
|
||||
|
||||
|
||||
The following build commands failed:
|
||||
Check dependencies
|
||||
(1 failure)
|
||||
Xcode's output:
|
||||
↳
|
||||
blah
|
||||
|
||||
Check dependencies
|
||||
[BCEROR]Signing for "Runner" requires a development team. Select a development team in the project editor.
|
||||
|
||||
Could not build the precompiled application for the device.''',
|
||||
xcodeBuildExecution: XcodeBuildExecution(
|
||||
buildCommands: <String>['xcrun', 'xcodebuild', 'blah'],
|
||||
appDirectory: '/blah/blah',
|
||||
environmentType: EnvironmentType.physical,
|
||||
buildSettings: buildSettings,
|
||||
),
|
||||
xcResult: XCResult.test(issues: <XCResultIssue>[
|
||||
XCResultIssue.test(message: 'Target aot_assembly_release failed', subType: 'Error'),
|
||||
])
|
||||
);
|
||||
|
||||
await diagnoseXcodeBuildFailure(buildResult, testUsage, logger);
|
||||
expect(logger.errorText, contains('Error (Xcode): Target aot_assembly_release failed'));
|
||||
expect(logger.errorText, isNot(contains('Building a deployable iOS app requires a selected Development Team')));
|
||||
});
|
||||
});
|
||||
|
||||
group('Upgrades project.pbxproj for old asset usage', () {
|
||||
|
||||
@@ -64,8 +64,7 @@ int x = 'String';
|
||||
], workingDirectory: projectRoot.path);
|
||||
|
||||
expect(
|
||||
// iOS shows this as stdout.
|
||||
targetPlatform == 'ios' ? result.stdout : result.stderr,
|
||||
result.stderr,
|
||||
contains("A value of type 'String' can't be assigned to a variable of type 'int'."),
|
||||
);
|
||||
expect(result.exitCode, 1);
|
||||
|
||||
Reference in New Issue
Block a user