only build macOS kernel in debug mode (#37365)
This commit is contained in:
@@ -80,7 +80,7 @@ RunCommand "${FLUTTER_ROOT}/bin/flutter" --suppress-analytics \
|
||||
precache \
|
||||
--no-android \
|
||||
--no-ios \
|
||||
--macos \
|
||||
--macos
|
||||
|
||||
# TODO(jonahwilliams): support flavors https://github.com/flutter/flutter/issues/32923
|
||||
RunCommand "${FLUTTER_ROOT}/bin/flutter" --suppress-analytics \
|
||||
@@ -90,7 +90,7 @@ RunCommand "${FLUTTER_ROOT}/bin/flutter" --suppress-analytics \
|
||||
assemble \
|
||||
-dTargetFile="${target_path}" \
|
||||
-dTargetPlatform=darwin-x64 \
|
||||
-dBuildMode="${build_mode}" \
|
||||
-dBuildMode=debug \
|
||||
--build-inputs="${build_inputs_path}" \
|
||||
--build-outputs="${build_outputs_path}" \
|
||||
"${build_target}"
|
||||
|
||||
@@ -27,7 +27,7 @@ class BuildCommand extends FlutterCommand {
|
||||
addSubcommand(BuildIOSCommand());
|
||||
addSubcommand(BuildBundleCommand(verboseHelp: verboseHelp));
|
||||
addSubcommand(BuildWebCommand());
|
||||
addSubcommand(BuildMacosCommand());
|
||||
addSubcommand(BuildMacosCommand(verboseHelp: verboseHelp));
|
||||
addSubcommand(BuildLinuxCommand());
|
||||
addSubcommand(BuildWindowsCommand());
|
||||
addSubcommand(BuildFuchsiaCommand(verboseHelp: verboseHelp));
|
||||
|
||||
@@ -16,20 +16,9 @@ import 'build.dart';
|
||||
|
||||
/// A command to build a macOS desktop target through a build shell script.
|
||||
class BuildMacosCommand extends BuildSubCommand {
|
||||
BuildMacosCommand() {
|
||||
BuildMacosCommand({bool verboseHelp}) {
|
||||
usesTargetOption();
|
||||
argParser.addFlag('debug',
|
||||
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.',
|
||||
);
|
||||
addBuildModeFlags(verboseHelp: verboseHelp);
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -30,9 +30,10 @@ Future<PrebuiltMacOSApp> buildMacOS({
|
||||
projectDir: flutterProject.directory,
|
||||
buildDir: flutterProject.dartTool.childDirectory('flutter_build'),
|
||||
defines: <String, String>{
|
||||
kBuildMode: buildInfo.isDebug == true ? 'debug' : 'release',
|
||||
// TODO(jonahwilliams): support other build types.
|
||||
kBuildMode: 'debug',
|
||||
kTargetPlatform: 'darwin-x64',
|
||||
kTargetFile: fs.file(targetOverride).absolute.path
|
||||
kTargetFile: targetOverride,
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@@ -69,6 +69,8 @@ class MacOSDevice extends Device {
|
||||
@override
|
||||
Future<String> get sdkNameAndVersion async => os.name;
|
||||
|
||||
String _cachedExecutable;
|
||||
|
||||
@override
|
||||
Future<LaunchResult> startApp(
|
||||
covariant MacOSApp package, {
|
||||
@@ -92,6 +94,7 @@ class MacOSDevice extends Device {
|
||||
targetOverride: mainPath,
|
||||
);
|
||||
}
|
||||
_cachedExecutable = prebuiltMacOSApp.executable;
|
||||
|
||||
// Ensure that the executable is locatable.
|
||||
if (prebuiltMacOSApp == null) {
|
||||
@@ -127,8 +130,8 @@ class MacOSDevice extends Device {
|
||||
// TODO(jonahwilliams): implement using process manager.
|
||||
// currently we rely on killing the isolate taking down the application.
|
||||
@override
|
||||
Future<bool> stopApp(covariant PrebuiltMacOSApp app) async {
|
||||
return killProcess(app.executable);
|
||||
Future<bool> stopApp(covariant MacOSApp app) async {
|
||||
return killProcess(_cachedExecutable);
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -79,7 +79,7 @@ void main() {
|
||||
FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: true),
|
||||
});
|
||||
|
||||
testUsingContext('macOS build invokes build script', () async {
|
||||
testUsingContext('macOS build invokes xcode build', () async {
|
||||
final BuildCommand command = BuildCommand();
|
||||
applyMocksToCommand(command);
|
||||
fs.directory('macos').createSync();
|
||||
@@ -91,8 +91,8 @@ void main() {
|
||||
projectDir: flutterProject.directory,
|
||||
buildDir: flutterProject.dartTool.childDirectory('flutter_build'),
|
||||
defines: <String, String>{
|
||||
kBuildMode: 'release',
|
||||
kTargetFile: fs.path.absolute(fs.path.join('lib', 'main.dart')),
|
||||
kBuildMode: 'debug',
|
||||
kTargetFile: 'lib/main.dart',
|
||||
kTargetPlatform: 'darwin-x64',
|
||||
}
|
||||
);
|
||||
|
||||
@@ -48,24 +48,6 @@ void main() {
|
||||
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', () {
|
||||
MockMacOSApp macOSApp;
|
||||
MockFileSystem mockFileSystem;
|
||||
|
||||
Reference in New Issue
Block a user