-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Description
When a macOS build fails, we don't parse the build output for common causes like we do with iOS. We should do something similar for macOS, or better yet - unify the two to use the same build method and do error parsing within it.
macOS:
flutter/packages/flutter_tools/lib/src/macos/build_macos.dart
Lines 136 to 163 in 8a11703
| result = await globals.processUtils.stream(<String>[ | |
| '/usr/bin/env', | |
| 'xcrun', | |
| 'xcodebuild', | |
| '-workspace', xcodeWorkspace.path, | |
| '-configuration', configuration, | |
| '-scheme', scheme, | |
| '-derivedDataPath', flutterBuildDir.absolute.path, | |
| '-destination', 'platform=macOS', | |
| 'OBJROOT=${globals.fs.path.join(flutterBuildDir.absolute.path, 'Build', 'Intermediates.noindex')}', | |
| 'SYMROOT=${globals.fs.path.join(flutterBuildDir.absolute.path, 'Build', 'Products')}', | |
| if (verboseLogging) | |
| 'VERBOSE_SCRIPT_LOGGING=YES' | |
| else | |
| '-quiet', | |
| 'COMPILER_INDEX_STORE_ENABLE=NO', | |
| ...environmentVariablesAsXcodeBuildSettings(globals.platform), | |
| ], | |
| trace: true, | |
| stdoutErrorMatcher: verboseLogging ? null : _filteredOutput, | |
| mapFunction: verboseLogging ? null : (String line) => _filteredOutput.hasMatch(line) ? line : null, | |
| ); | |
| } finally { | |
| status.cancel(); | |
| } | |
| if (result != 0) { | |
| throwToolExit('Build process failed'); | |
| } |
flutter/packages/flutter_tools/lib/src/macos/macos_device.dart
Lines 69 to 80 in 8a11703
| @override | |
| Future<void> buildForDevice({ | |
| required BuildInfo buildInfo, | |
| String? mainPath, | |
| }) async { | |
| await buildMacOS( | |
| flutterProject: FlutterProject.current(), | |
| buildInfo: buildInfo, | |
| targetOverride: mainPath, | |
| verboseLogging: _logger.isVerbose, | |
| ); | |
| } |
flutter/packages/flutter_tools/lib/src/commands/build_macos.dart
Lines 62 to 76 in 8a11703
| await buildMacOS( | |
| flutterProject: flutterProject, | |
| buildInfo: buildInfo, | |
| targetOverride: targetFile, | |
| verboseLogging: globals.logger.isVerbose, | |
| configOnly: configOnly, | |
| sizeAnalyzer: SizeAnalyzer( | |
| fileSystem: globals.fs, | |
| logger: globals.logger, | |
| appFilenamePattern: 'App', | |
| flutterUsage: globals.flutterUsage, | |
| analytics: analytics, | |
| ), | |
| ); | |
| return FlutterCommandResult.success(); |
iOS:
flutter/packages/flutter_tools/lib/src/ios/devices.dart
Lines 489 to 503 in 8a11703
| // Step 1: Build the precompiled/DBC application if necessary. | |
| final XcodeBuildResult buildResult = await buildXcodeProject( | |
| app: package as BuildableIOSApp, | |
| buildInfo: debuggingOptions.buildInfo, | |
| targetOverride: mainPath, | |
| activeArch: cpuArchitecture, | |
| deviceID: id, | |
| disablePortPublication: debuggingOptions.usingCISystem && debuggingOptions.disablePortPublication, | |
| ); | |
| if (!buildResult.success) { | |
| _logger.printError('Could not build the precompiled application for the device.'); | |
| await diagnoseXcodeBuildFailure(buildResult, globals.flutterUsage, _logger, globals.analytics); | |
| _logger.printError(''); | |
| return LaunchResult.failed(); | |
| } |
flutter/packages/flutter_tools/lib/src/commands/build_ios.dart
Lines 662 to 681 in 8a11703
| final XcodeBuildResult result = await buildXcodeProject( | |
| app: app, | |
| buildInfo: buildInfo, | |
| targetOverride: targetFile, | |
| environmentType: environmentType, | |
| codesign: shouldCodesign, | |
| configOnly: configOnly, | |
| buildAction: xcodeBuildAction, | |
| deviceID: globals.deviceManager?.specifiedDeviceId, | |
| disablePortPublication: usingCISystem && | |
| xcodeBuildAction == XcodeBuildAction.build && | |
| await disablePortPublication, | |
| ); | |
| xcodeBuildResult = result; | |
| if (!result.success) { | |
| await diagnoseXcodeBuildFailure(result, globals.flutterUsage, globals.logger, globals.analytics); | |
| final String presentParticiple = xcodeBuildAction == XcodeBuildAction.build ? 'building' : 'archiving'; | |
| throwToolExit('Encountered error while $presentParticiple for $logTarget.'); | |
| } |
flutter/packages/flutter_tools/lib/src/ios/simulators.dart
Lines 565 to 575 in 8a11703
| final XcodeBuildResult buildResult = await buildXcodeProject( | |
| app: app, | |
| buildInfo: buildInfo, | |
| targetOverride: mainPath, | |
| environmentType: EnvironmentType.simulator, | |
| deviceID: id, | |
| ); | |
| if (!buildResult.success) { | |
| await diagnoseXcodeBuildFailure(buildResult, globals.flutterUsage, globals.logger, globals.analytics); | |
| throwToolExit('Could not build the application for the simulator.'); | |
| } |