Unverified Commit 450a7248 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

set trace to true for desktop builds (#43577)

parent 36d50a48
...@@ -57,7 +57,7 @@ export PROJECT_DIR=${linuxProject.project.directory.path} ...@@ -57,7 +57,7 @@ export PROJECT_DIR=${linuxProject.project.directory.path}
'-C', '-C',
linuxProject.makeFile.parent.path, linuxProject.makeFile.parent.path,
'BUILD=$buildFlag', 'BUILD=$buildFlag',
]); ], trace: true);
} on ArgumentError { } on ArgumentError {
throwToolExit('make not found. Run \'flutter doctor\' for more information.'); throwToolExit('make not found. Run \'flutter doctor\' for more information.');
} finally { } finally {
......
...@@ -79,7 +79,7 @@ Future<void> buildMacOS({ ...@@ -79,7 +79,7 @@ Future<void> buildMacOS({
'OBJROOT=${fs.path.join(flutterBuildDir.absolute.path, 'Build', 'Intermediates.noindex')}', 'OBJROOT=${fs.path.join(flutterBuildDir.absolute.path, 'Build', 'Intermediates.noindex')}',
'SYMROOT=${fs.path.join(flutterBuildDir.absolute.path, 'Build', 'Products')}', 'SYMROOT=${fs.path.join(flutterBuildDir.absolute.path, 'Build', 'Products')}',
'COMPILER_INDEX_STORE_ENABLE=NO', 'COMPILER_INDEX_STORE_ENABLE=NO',
]); ], trace: true);
} finally { } finally {
status.cancel(); status.cancel();
} }
......
...@@ -74,7 +74,7 @@ Future<void> buildWindows(WindowsProject windowsProject, BuildInfo buildInfo, {S ...@@ -74,7 +74,7 @@ Future<void> buildWindows(WindowsProject windowsProject, BuildInfo buildInfo, {S
vcvarsScript, vcvarsScript,
fs.path.basename(solutionPath), fs.path.basename(solutionPath),
configuration, configuration,
], workingDirectory: fs.path.dirname(solutionPath)); ], workingDirectory: fs.path.dirname(solutionPath), trace: true);
} finally { } finally {
status.cancel(); status.cancel();
} }
......
...@@ -12,6 +12,7 @@ import 'package:flutter_tools/src/base/platform.dart'; ...@@ -12,6 +12,7 @@ import 'package:flutter_tools/src/base/platform.dart';
import 'package:flutter_tools/src/cache.dart'; import 'package:flutter_tools/src/cache.dart';
import 'package:flutter_tools/src/commands/build.dart'; import 'package:flutter_tools/src/commands/build.dart';
import 'package:flutter_tools/src/commands/build_linux.dart'; import 'package:flutter_tools/src/commands/build_linux.dart';
import 'package:flutter_tools/src/convert.dart';
import 'package:flutter_tools/src/features.dart'; import 'package:flutter_tools/src/features.dart';
import 'package:flutter_tools/src/globals.dart'; import 'package:flutter_tools/src/globals.dart';
import 'package:flutter_tools/src/linux/makefile.dart'; import 'package:flutter_tools/src/linux/makefile.dart';
...@@ -46,7 +47,7 @@ void main() { ...@@ -46,7 +47,7 @@ void main() {
return const Stream<List<int>>.empty(); return const Stream<List<int>>.empty();
}); });
when(mockProcess.stdout).thenAnswer((Invocation invocation) { when(mockProcess.stdout).thenAnswer((Invocation invocation) {
return const Stream<List<int>>.empty(); return Stream<List<int>>.fromIterable(<List<int>>[utf8.encode('STDOUT STUFF')]);
}); });
when(linuxPlatform.isLinux).thenReturn(true); when(linuxPlatform.isLinux).thenReturn(true);
when(linuxPlatform.isWindows).thenReturn(false); when(linuxPlatform.isWindows).thenReturn(false);
...@@ -140,6 +141,25 @@ void main() { ...@@ -140,6 +141,25 @@ void main() {
FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: true), FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: true),
}); });
testUsingContext('Linux build does not spew stdout to status logger', () async {
final BufferLogger bufferLogger = logger;
final BuildCommand command = BuildCommand();
applyMocksToCommand(command);
setUpMockProjectFilesForBuild();
expectMakeInvocationWithMode('debug');
await createTestCommandRunner(command).run(
const <String>['build', 'linux', '--debug']
);
expect(bufferLogger.statusText, isNot(contains('STDOUT STUFF')));
expect(bufferLogger.traceText, contains('STDOUT STUFF'));
}, 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);
......
...@@ -7,12 +7,15 @@ import 'package:file/memory.dart'; ...@@ -7,12 +7,15 @@ import 'package:file/memory.dart';
import 'package:flutter_tools/src/base/common.dart'; import 'package:flutter_tools/src/base/common.dart';
import 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/base/io.dart'; import 'package:flutter_tools/src/base/io.dart';
import 'package:flutter_tools/src/base/logger.dart';
import 'package:flutter_tools/src/base/platform.dart'; import 'package:flutter_tools/src/base/platform.dart';
import 'package:flutter_tools/src/build_info.dart'; import 'package:flutter_tools/src/build_info.dart';
import 'package:flutter_tools/src/cache.dart'; import 'package:flutter_tools/src/cache.dart';
import 'package:flutter_tools/src/commands/build.dart'; import 'package:flutter_tools/src/commands/build.dart';
import 'package:flutter_tools/src/commands/build_macos.dart'; import 'package:flutter_tools/src/commands/build_macos.dart';
import 'package:flutter_tools/src/convert.dart';
import 'package:flutter_tools/src/features.dart'; import 'package:flutter_tools/src/features.dart';
import 'package:flutter_tools/src/globals.dart';
import 'package:flutter_tools/src/ios/xcodeproj.dart'; import 'package:flutter_tools/src/ios/xcodeproj.dart';
import 'package:flutter_tools/src/project.dart'; import 'package:flutter_tools/src/project.dart';
import 'package:mockito/mockito.dart'; import 'package:mockito/mockito.dart';
...@@ -56,7 +59,7 @@ void main() { ...@@ -56,7 +59,7 @@ void main() {
return const Stream<List<int>>.empty(); return const Stream<List<int>>.empty();
}); });
when(mockProcess.stdout).thenAnswer((Invocation invocation) { when(mockProcess.stdout).thenAnswer((Invocation invocation) {
return const Stream<List<int>>.empty(); return Stream<List<int>>.fromIterable(<List<int>>[utf8.encode('STDOUT STUFF')]);
}); });
when(macosPlatform.isMacOS).thenReturn(true); when(macosPlatform.isMacOS).thenReturn(true);
when(macosPlatform.isWindows).thenReturn(false); when(macosPlatform.isWindows).thenReturn(false);
...@@ -124,6 +127,25 @@ void main() { ...@@ -124,6 +127,25 @@ void main() {
FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: true), FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: true),
}); });
testUsingContext('macOS build does not spew stdout to status logger', () async {
final BufferLogger bufferLogger = logger;
final BuildCommand command = BuildCommand();
applyMocksToCommand(command);
createMinimalMockProjectFiles();
setUpMockXcodeBuildHandler('Debug');
await createTestCommandRunner(command).run(
const <String>['build', 'macos', '--debug']
);
expect(bufferLogger.statusText, isNot(contains('STDOUT STUFF')));
expect(bufferLogger.traceText, contains('STDOUT STUFF'));
}, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(),
ProcessManager: () => mockProcessManager,
Platform: () => macosPlatform,
FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: true),
});
testUsingContext('macOS build invokes xcode build (debug)', () async { testUsingContext('macOS build invokes xcode build (debug)', () async {
final BuildCommand command = BuildCommand(); final BuildCommand command = BuildCommand();
applyMocksToCommand(command); applyMocksToCommand(command);
......
...@@ -11,6 +11,7 @@ import 'package:flutter_tools/src/base/platform.dart'; ...@@ -11,6 +11,7 @@ import 'package:flutter_tools/src/base/platform.dart';
import 'package:flutter_tools/src/cache.dart'; import 'package:flutter_tools/src/cache.dart';
import 'package:flutter_tools/src/commands/build.dart'; import 'package:flutter_tools/src/commands/build.dart';
import 'package:flutter_tools/src/commands/build_windows.dart'; import 'package:flutter_tools/src/commands/build_windows.dart';
import 'package:flutter_tools/src/convert.dart';
import 'package:flutter_tools/src/features.dart'; import 'package:flutter_tools/src/features.dart';
import 'package:flutter_tools/src/globals.dart'; import 'package:flutter_tools/src/globals.dart';
import 'package:flutter_tools/src/windows/visual_studio.dart'; import 'package:flutter_tools/src/windows/visual_studio.dart';
...@@ -51,7 +52,7 @@ void main() { ...@@ -51,7 +52,7 @@ void main() {
return const Stream<List<int>>.empty(); return const Stream<List<int>>.empty();
}); });
when(mockProcess.stdout).thenAnswer((Invocation invocation) { when(mockProcess.stdout).thenAnswer((Invocation invocation) {
return const Stream<List<int>>.empty(); return Stream<List<int>>.fromIterable(<List<int>>[utf8.encode('STDOUT STUFF')]);
}); });
when(windowsPlatform.isWindows).thenReturn(true); when(windowsPlatform.isWindows).thenReturn(true);
when(notWindowsPlatform.isWindows).thenReturn(false); when(notWindowsPlatform.isWindows).thenReturn(false);
...@@ -107,6 +108,38 @@ void main() { ...@@ -107,6 +108,38 @@ void main() {
FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: true), FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: true),
}); });
testUsingContext('Windows build does not spew stdout to status logger', () async {
final BufferLogger bufferLogger = logger;
final BuildCommand command = BuildCommand();
applyMocksToCommand(command);
fs.file(solutionPath).createSync(recursive: true);
when(mockVisualStudio.vcvarsPath).thenReturn(vcvarsPath);
fs.file('pubspec.yaml').createSync();
fs.file('.packages').createSync();
fs.file(fs.path.join('lib', 'main.dart')).createSync(recursive: true);
when(mockProcessManager.start(<String>[
r'C:\packages\flutter_tools\bin\vs_build.bat',
vcvarsPath,
fs.path.basename(solutionPath),
'Release',
], workingDirectory: fs.path.dirname(solutionPath))).thenAnswer((Invocation invocation) async {
return mockProcess;
});
await createTestCommandRunner(command).run(
const <String>['build', 'windows']
);
expect(bufferLogger.statusText, isNot(contains('STDOUT STUFF')));
expect(bufferLogger.traceText, contains('STDOUT STUFF'));
}, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(style: FileSystemStyle.windows),
ProcessManager: () => mockProcessManager,
Platform: () => windowsPlatform,
VisualStudio: () => mockVisualStudio,
FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: true),
});
testUsingContext('Windows build invokes msbuild and writes generated files', () async { testUsingContext('Windows build invokes msbuild and writes generated files', () async {
final BuildCommand command = BuildCommand(); final BuildCommand command = BuildCommand();
applyMocksToCommand(command); applyMocksToCommand(command);
......
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