Unverified Commit bffa11e2 authored by 嘟囔's avatar 嘟囔 Committed by GitHub

fix: fix BuildableMacOSApp pass no projectBundleId to super error (#87264)

parent bd04a22b
......@@ -24,7 +24,8 @@ abstract class MacOSApp extends ApplicationPackage {
/// Creates a new [MacOSApp] from a macOS project directory.
factory MacOSApp.fromMacOSProject(MacOSProject project) {
return BuildableMacOSApp(project);
// projectBundleId is unused for macOS apps. Use a placeholder bundle ID.
return BuildableMacOSApp(project, 'com.example.placeholder');
}
/// Creates a new [MacOSApp] from an existing app bundle.
......@@ -139,7 +140,7 @@ class PrebuiltMacOSApp extends MacOSApp {
}
class BuildableMacOSApp extends MacOSApp {
BuildableMacOSApp(this.project);
BuildableMacOSApp(this.project, String projectBundleId): super(projectBundleId: projectBundleId);
final MacOSProject project;
......
......@@ -12,8 +12,10 @@ import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/base/logger.dart';
import 'package:flutter_tools/src/base/os.dart';
import 'package:flutter_tools/src/base/utils.dart';
import 'package:flutter_tools/src/globals_null_migrated.dart' as globals;
import 'package:flutter_tools/src/ios/plist_parser.dart';
import 'package:flutter_tools/src/macos/application_package.dart';
import 'package:flutter_tools/src/project.dart';
import 'package:test/fake.dart';
import '../../src/common.dart';
......@@ -154,6 +156,14 @@ group('PrebuiltMacOSApp', () {
expect(macosApp.id, 'fooBundleId');
expect(macosApp.bundleName, endsWith('bundle.app'));
}, overrides: overrides);
testUsingContext('Success with project', () {
final MacOSApp macosApp = MacOSApp.fromMacOSProject(FlutterProject.fromDirectory(globals.fs.currentDirectory).macos);
expect(logger.errorText, isEmpty);
expect(macosApp.id, 'com.example.placeholder');
expect(macosApp.name, 'macOS');
}, overrides: overrides);
});
}
......
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