Unverified Commit cf661358 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

only build macOS kernel in debug mode (#37365)

parent 2b03e208
...@@ -80,7 +80,7 @@ RunCommand "${FLUTTER_ROOT}/bin/flutter" --suppress-analytics \ ...@@ -80,7 +80,7 @@ RunCommand "${FLUTTER_ROOT}/bin/flutter" --suppress-analytics \
precache \ precache \
--no-android \ --no-android \
--no-ios \ --no-ios \
--macos \ --macos
# TODO(jonahwilliams): support flavors https://github.com/flutter/flutter/issues/32923 # TODO(jonahwilliams): support flavors https://github.com/flutter/flutter/issues/32923
RunCommand "${FLUTTER_ROOT}/bin/flutter" --suppress-analytics \ RunCommand "${FLUTTER_ROOT}/bin/flutter" --suppress-analytics \
...@@ -90,7 +90,7 @@ RunCommand "${FLUTTER_ROOT}/bin/flutter" --suppress-analytics \ ...@@ -90,7 +90,7 @@ RunCommand "${FLUTTER_ROOT}/bin/flutter" --suppress-analytics \
assemble \ assemble \
-dTargetFile="${target_path}" \ -dTargetFile="${target_path}" \
-dTargetPlatform=darwin-x64 \ -dTargetPlatform=darwin-x64 \
-dBuildMode="${build_mode}" \ -dBuildMode=debug \
--build-inputs="${build_inputs_path}" \ --build-inputs="${build_inputs_path}" \
--build-outputs="${build_outputs_path}" \ --build-outputs="${build_outputs_path}" \
"${build_target}" "${build_target}"
...@@ -27,7 +27,7 @@ class BuildCommand extends FlutterCommand { ...@@ -27,7 +27,7 @@ class BuildCommand extends FlutterCommand {
addSubcommand(BuildIOSCommand()); addSubcommand(BuildIOSCommand());
addSubcommand(BuildBundleCommand(verboseHelp: verboseHelp)); addSubcommand(BuildBundleCommand(verboseHelp: verboseHelp));
addSubcommand(BuildWebCommand()); addSubcommand(BuildWebCommand());
addSubcommand(BuildMacosCommand()); addSubcommand(BuildMacosCommand(verboseHelp: verboseHelp));
addSubcommand(BuildLinuxCommand()); addSubcommand(BuildLinuxCommand());
addSubcommand(BuildWindowsCommand()); addSubcommand(BuildWindowsCommand());
addSubcommand(BuildFuchsiaCommand(verboseHelp: verboseHelp)); addSubcommand(BuildFuchsiaCommand(verboseHelp: verboseHelp));
......
...@@ -16,20 +16,9 @@ import 'build.dart'; ...@@ -16,20 +16,9 @@ import 'build.dart';
/// A command to build a macOS desktop target through a build shell script. /// A command to build a macOS desktop target through a build shell script.
class BuildMacosCommand extends BuildSubCommand { class BuildMacosCommand extends BuildSubCommand {
BuildMacosCommand() { BuildMacosCommand({bool verboseHelp}) {
usesTargetOption(); usesTargetOption();
argParser.addFlag('debug', addBuildModeFlags(verboseHelp: verboseHelp);
negatable: false,
help: 'Build a debug version of your app.',
);
argParser.addFlag('profile',
negatable: false,
help: 'Build a version of your app specialized for performance profiling.'
);
argParser.addFlag('release',
negatable: false,
help: 'Build a version of your app specialized for performance profiling.',
);
} }
@override @override
......
...@@ -30,9 +30,10 @@ Future<PrebuiltMacOSApp> buildMacOS({ ...@@ -30,9 +30,10 @@ Future<PrebuiltMacOSApp> buildMacOS({
projectDir: flutterProject.directory, projectDir: flutterProject.directory,
buildDir: flutterProject.dartTool.childDirectory('flutter_build'), buildDir: flutterProject.dartTool.childDirectory('flutter_build'),
defines: <String, String>{ defines: <String, String>{
kBuildMode: buildInfo.isDebug == true ? 'debug' : 'release', // TODO(jonahwilliams): support other build types.
kBuildMode: 'debug',
kTargetPlatform: 'darwin-x64', kTargetPlatform: 'darwin-x64',
kTargetFile: fs.file(targetOverride).absolute.path kTargetFile: targetOverride,
}, },
); );
......
...@@ -69,6 +69,8 @@ class MacOSDevice extends Device { ...@@ -69,6 +69,8 @@ class MacOSDevice extends Device {
@override @override
Future<String> get sdkNameAndVersion async => os.name; Future<String> get sdkNameAndVersion async => os.name;
String _cachedExecutable;
@override @override
Future<LaunchResult> startApp( Future<LaunchResult> startApp(
covariant MacOSApp package, { covariant MacOSApp package, {
...@@ -92,6 +94,7 @@ class MacOSDevice extends Device { ...@@ -92,6 +94,7 @@ class MacOSDevice extends Device {
targetOverride: mainPath, targetOverride: mainPath,
); );
} }
_cachedExecutable = prebuiltMacOSApp.executable;
// Ensure that the executable is locatable. // Ensure that the executable is locatable.
if (prebuiltMacOSApp == null) { if (prebuiltMacOSApp == null) {
...@@ -127,8 +130,8 @@ class MacOSDevice extends Device { ...@@ -127,8 +130,8 @@ class MacOSDevice extends Device {
// TODO(jonahwilliams): implement using process manager. // TODO(jonahwilliams): implement using process manager.
// currently we rely on killing the isolate taking down the application. // currently we rely on killing the isolate taking down the application.
@override @override
Future<bool> stopApp(covariant PrebuiltMacOSApp app) async { Future<bool> stopApp(covariant MacOSApp app) async {
return killProcess(app.executable); return killProcess(_cachedExecutable);
} }
@override @override
......
...@@ -79,7 +79,7 @@ void main() { ...@@ -79,7 +79,7 @@ void main() {
FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: true), FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: true),
}); });
testUsingContext('macOS build invokes build script', () async { testUsingContext('macOS build invokes xcode build', () async {
final BuildCommand command = BuildCommand(); final BuildCommand command = BuildCommand();
applyMocksToCommand(command); applyMocksToCommand(command);
fs.directory('macos').createSync(); fs.directory('macos').createSync();
...@@ -91,8 +91,8 @@ void main() { ...@@ -91,8 +91,8 @@ void main() {
projectDir: flutterProject.directory, projectDir: flutterProject.directory,
buildDir: flutterProject.dartTool.childDirectory('flutter_build'), buildDir: flutterProject.dartTool.childDirectory('flutter_build'),
defines: <String, String>{ defines: <String, String>{
kBuildMode: 'release', kBuildMode: 'debug',
kTargetFile: fs.path.absolute(fs.path.join('lib', 'main.dart')), kTargetFile: 'lib/main.dart',
kTargetPlatform: 'darwin-x64', kTargetPlatform: 'darwin-x64',
} }
); );
......
...@@ -48,24 +48,6 @@ void main() { ...@@ -48,24 +48,6 @@ void main() {
ProcessManager: () => mockProcessManager, ProcessManager: () => mockProcessManager,
}); });
testUsingContext('stopApp', () async {
const String psOut = r'''
tester 17193 0.0 0.2 4791128 37820 ?? S 2:27PM 0:00.09 /Applications/foo
''';
final MockMacOSApp mockMacOSApp = MockMacOSApp();
when(mockMacOSApp.executable).thenReturn('tester');
when(mockProcessManager.run(<String>['ps', 'aux'])).thenAnswer((Invocation invocation) async {
return ProcessResult(1, 0, psOut, '');
});
when(mockProcessManager.run(<String>['kill', '17193'])).thenAnswer((Invocation invocation) async {
return ProcessResult(2, 0, '', '');
});
expect(await device.stopApp(mockMacOSApp), true);
verify(mockProcessManager.run(<String>['kill', '17193']));
}, overrides: <Type, Generator>{
ProcessManager: () => mockProcessManager,
});
group('startApp', () { group('startApp', () {
MockMacOSApp macOSApp; MockMacOSApp macOSApp;
MockFileSystem mockFileSystem; MockFileSystem mockFileSystem;
......
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