diff --git a/dev/integration_tests/flutter_gallery/macos/Runner.xcodeproj/project.pbxproj b/dev/integration_tests/flutter_gallery/macos/Runner.xcodeproj/project.pbxproj index f265da7157f..5586e2450ee 100644 --- a/dev/integration_tests/flutter_gallery/macos/Runner.xcodeproj/project.pbxproj +++ b/dev/integration_tests/flutter_gallery/macos/Runner.xcodeproj/project.pbxproj @@ -301,7 +301,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh\ntouch Flutter/ephemeral/tripwire\n"; + shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; }; 36C290D58D35783923B6B124 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; diff --git a/packages/flutter_tools/lib/src/macos/build_macos.dart b/packages/flutter_tools/lib/src/macos/build_macos.dart index b885195f6d0..6e064a66de8 100644 --- a/packages/flutter_tools/lib/src/macos/build_macos.dart +++ b/packages/flutter_tools/lib/src/macos/build_macos.dart @@ -14,6 +14,10 @@ import '../ios/xcodeproj.dart'; import '../project.dart'; import 'cocoapod_utils.dart'; +/// When run in -quiet mode, Xcode only prints from the underlying tasks to stdout. +/// Passing this regexp to trace moves the stdout output to stderr. +final RegExp _anyOutput = RegExp('.*'); + /// Builds the macOS project through xcodebuild. // TODO(jonahwilliams): refactor to share code with the existing iOS code. Future buildMacOS({ @@ -87,10 +91,15 @@ Future buildMacOS({ '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', + 'VERBOSE_SCRIPT_LOGGING=YES' + else + '-quiet', 'COMPILER_INDEX_STORE_ENABLE=NO', ...environmentVariablesAsXcodeBuildSettings(globals.platform) - ], trace: true); + ], + trace: true, + stdoutErrorMatcher: verboseLogging ? null : _anyOutput, + ); } finally { status.cancel(); } diff --git a/packages/flutter_tools/templates/app/macos.tmpl/Runner.xcodeproj/project.pbxproj.tmpl b/packages/flutter_tools/templates/app/macos.tmpl/Runner.xcodeproj/project.pbxproj.tmpl index 8c2bebf652e..51c82d137fe 100644 --- a/packages/flutter_tools/templates/app/macos.tmpl/Runner.xcodeproj/project.pbxproj.tmpl +++ b/packages/flutter_tools/templates/app/macos.tmpl/Runner.xcodeproj/project.pbxproj.tmpl @@ -280,7 +280,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh\ntouch Flutter/ephemeral/tripwire\n"; + shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; }; /* End PBXShellScriptBuildPhase section */ diff --git a/packages/flutter_tools/test/commands.shard/hermetic/build_macos_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/build_macos_test.dart index e7017d0c293..178c457103c 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/build_macos_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/build_macos_test.dart @@ -86,7 +86,9 @@ void main() { 'OBJROOT=${fileSystem.path.join(flutterBuildDir.absolute.path, 'Build', 'Intermediates.noindex')}', 'SYMROOT=${fileSystem.path.join(flutterBuildDir.absolute.path, 'Build', 'Products')}', if (verbose) - 'VERBOSE_SCRIPT_LOGGING=YES', + 'VERBOSE_SCRIPT_LOGGING=YES' + else + '-quiet', 'COMPILER_INDEX_STORE_ENABLE=NO', ], stdout: 'STDOUT STUFF', @@ -129,7 +131,7 @@ void main() { FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: true), }); - testUsingContext('macOS build does not spew stdout to status logger', () async { + testUsingContext('macOS build forwards error stdout to status logger error', () async { final BuildCommand command = BuildCommand(); createMinimalMockProjectFiles(); @@ -137,7 +139,8 @@ void main() { const ['build', 'macos', '--debug'] ); expect(testLogger.statusText, isNot(contains('STDOUT STUFF'))); - expect(testLogger.traceText, contains('STDOUT STUFF')); + expect(testLogger.traceText, isNot(contains('STDOUT STUFF'))); + expect(testLogger.errorText, contains('STDOUT STUFF')); }, overrides: { FileSystem: () => fileSystem, ProcessManager: () => FakeProcessManager.list([