Unverified Commit 74a1b9b3 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

[flutter_tools] make verbose macOS builds actually verbose (#54320)

parent 4451ffca
...@@ -54,6 +54,7 @@ class BuildMacosCommand extends BuildSubCommand { ...@@ -54,6 +54,7 @@ class BuildMacosCommand extends BuildSubCommand {
flutterProject: flutterProject, flutterProject: flutterProject,
buildInfo: buildInfo, buildInfo: buildInfo,
targetOverride: targetFile, targetOverride: targetFile,
verboseLogging: globals.logger.isVerbose,
); );
return FlutterCommandResult.success(); return FlutterCommandResult.success();
} }
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:meta/meta.dart';
import '../base/common.dart'; import '../base/common.dart';
import '../base/file_system.dart'; import '../base/file_system.dart';
import '../base/logger.dart'; import '../base/logger.dart';
...@@ -18,6 +20,7 @@ Future<void> buildMacOS({ ...@@ -18,6 +20,7 @@ Future<void> buildMacOS({
FlutterProject flutterProject, FlutterProject flutterProject,
BuildInfo buildInfo, BuildInfo buildInfo,
String targetOverride, String targetOverride,
@required bool verboseLogging,
}) async { }) async {
if (!flutterProject.macos.xcodeWorkspace.existsSync()) { if (!flutterProject.macos.xcodeWorkspace.existsSync()) {
throwToolExit('No macOS desktop project configured. ' throwToolExit('No macOS desktop project configured. '
...@@ -83,6 +86,8 @@ Future<void> buildMacOS({ ...@@ -83,6 +86,8 @@ Future<void> buildMacOS({
'-derivedDataPath', flutterBuildDir.absolute.path, '-derivedDataPath', flutterBuildDir.absolute.path,
'OBJROOT=${globals.fs.path.join(flutterBuildDir.absolute.path, 'Build', 'Intermediates.noindex')}', 'OBJROOT=${globals.fs.path.join(flutterBuildDir.absolute.path, 'Build', 'Intermediates.noindex')}',
'SYMROOT=${globals.fs.path.join(flutterBuildDir.absolute.path, 'Build', 'Products')}', 'SYMROOT=${globals.fs.path.join(flutterBuildDir.absolute.path, 'Build', 'Products')}',
if (verboseLogging)
'VERBOSE_SCRIPT_LOGGING=YES',
'COMPILER_INDEX_STORE_ENABLE=NO', 'COMPILER_INDEX_STORE_ENABLE=NO',
...environmentVariablesAsXcodeBuildSettings(globals.platform) ...environmentVariablesAsXcodeBuildSettings(globals.platform)
], trace: true); ], trace: true);
......
...@@ -44,6 +44,7 @@ class MacOSDevice extends DesktopDevice { ...@@ -44,6 +44,7 @@ class MacOSDevice extends DesktopDevice {
flutterProject: FlutterProject.current(), flutterProject: FlutterProject.current(),
buildInfo: buildInfo, buildInfo: buildInfo,
targetOverride: mainPath, targetOverride: mainPath,
verboseLogging: globals.logger.isVerbose,
); );
} }
......
...@@ -69,7 +69,7 @@ void main() { ...@@ -69,7 +69,7 @@ void main() {
// Creates a FakeCommand for the xcodebuild call to build the app // Creates a FakeCommand for the xcodebuild call to build the app
// in the given configuration. // in the given configuration.
FakeCommand setUpMockXcodeBuildHandler(String configuration) { FakeCommand setUpMockXcodeBuildHandler(String configuration, { bool verbose = false }) {
final FlutterProject flutterProject = FlutterProject.fromDirectory(fileSystem.currentDirectory); final FlutterProject flutterProject = FlutterProject.fromDirectory(fileSystem.currentDirectory);
final Directory flutterBuildDir = fileSystem.directory(getMacOSBuildDirectory()); final Directory flutterBuildDir = fileSystem.directory(getMacOSBuildDirectory());
return FakeCommand( return FakeCommand(
...@@ -83,6 +83,8 @@ void main() { ...@@ -83,6 +83,8 @@ void main() {
'-derivedDataPath', flutterBuildDir.absolute.path, '-derivedDataPath', flutterBuildDir.absolute.path,
'OBJROOT=${fileSystem.path.join(flutterBuildDir.absolute.path, 'Build', 'Intermediates.noindex')}', 'OBJROOT=${fileSystem.path.join(flutterBuildDir.absolute.path, 'Build', 'Intermediates.noindex')}',
'SYMROOT=${fileSystem.path.join(flutterBuildDir.absolute.path, 'Build', 'Products')}', 'SYMROOT=${fileSystem.path.join(flutterBuildDir.absolute.path, 'Build', 'Products')}',
if (verbose)
'VERBOSE_SCRIPT_LOGGING=YES',
'COMPILER_INDEX_STORE_ENABLE=NO', 'COMPILER_INDEX_STORE_ENABLE=NO',
], ],
stdout: 'STDOUT STUFF', stdout: 'STDOUT STUFF',
...@@ -159,6 +161,23 @@ void main() { ...@@ -159,6 +161,23 @@ void main() {
FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: true), FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: true),
}); });
testUsingContext('macOS build invokes xcode build (debug) with verbosity', () async {
final BuildCommand command = BuildCommand();
createMinimalMockProjectFiles();
await createTestCommandRunner(command).run(
const <String>['build', 'macos', '--debug', '-v']
);
}, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
ProcessManager: () => FakeProcessManager.list(<FakeCommand>[
setUpMockXcodeBuildHandler('Debug', verbose: true)
]),
Platform: () => macosPlatform,
FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: true),
});
testUsingContext('macOS build invokes xcode build (profile)', () async { testUsingContext('macOS build invokes xcode build (profile)', () async {
final BuildCommand command = BuildCommand(); final BuildCommand command = BuildCommand();
createMinimalMockProjectFiles(); createMinimalMockProjectFiles();
......
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