Revert "Check Xcode build setting FULL_PRODUCT_NAME for the name of the built app during flutter run (#47266)" (#47568)
This reverts commit 648a5d8a1ebbe95a6f0fa1c41ed34195c11c4d64.
diff --git a/packages/flutter_tools/lib/src/application_package.dart b/packages/flutter_tools/lib/src/application_package.dart
index 7db7a2f..b0e1f47 100644
--- a/packages/flutter_tools/lib/src/application_package.dart
+++ b/packages/flutter_tools/lib/src/application_package.dart
@@ -358,21 +358,18 @@
}
class BuildableIOSApp extends IOSApp {
- BuildableIOSApp(this.project, String projectBundleId, this._hostAppBundleName)
+ BuildableIOSApp(this.project, String projectBundleId)
: super(projectBundleId: projectBundleId);
static Future<BuildableIOSApp> fromProject(IosProject project) async {
final String projectBundleId = await project.productBundleIdentifier;
- final String hostAppBundleName = await project.hostAppBundleName;
- return BuildableIOSApp(project, projectBundleId, hostAppBundleName);
+ return BuildableIOSApp(project, projectBundleId);
}
final IosProject project;
- final String _hostAppBundleName;
-
@override
- String get name => _hostAppBundleName;
+ String get name => project.hostAppBundleName;
@override
String get simulatorBundlePath => _buildAppPath('iphonesimulator');
@@ -381,7 +378,7 @@
String get deviceBundlePath => _buildAppPath('iphoneos');
String _buildAppPath(String type) {
- return fs.path.join(getIosBuildDirectory(), type, _hostAppBundleName);
+ return fs.path.join(getIosBuildDirectory(), type, name);
}
}
diff --git a/packages/flutter_tools/lib/src/ios/mac.dart b/packages/flutter_tools/lib/src/ios/mac.dart
index 5499e36..3ac2ecb 100644
--- a/packages/flutter_tools/lib/src/ios/mac.dart
+++ b/packages/flutter_tools/lib/src/ios/mac.dart
@@ -736,7 +736,7 @@
final Match match = oldAssets.firstMatch(line);
if (match != null) {
if (printedStatuses.add(match.group(1))) {
- printStatus('Removing obsolete reference to ${match.group(1)} from ${project.xcodeProject?.basename}');
+ printStatus('Removing obsolete reference to ${match.group(1)} from ${project.hostAppBundleName}');
}
} else {
buffer.writeln(line);
diff --git a/packages/flutter_tools/lib/src/ios/simulators.dart b/packages/flutter_tools/lib/src/ios/simulators.dart
index fe6b6ad..7f24d01 100644
--- a/packages/flutter_tools/lib/src/ios/simulators.dart
+++ b/packages/flutter_tools/lib/src/ios/simulators.dart
@@ -622,8 +622,9 @@
}
// Match the log prefix (in order to shorten it):
- // * Xcode 9: 2017-09-13 15:26:57.228948-0700 localhost My App[37195]: (Flutter) Observatory listening on http://127.0.0.1:57701/
- static final RegExp _mapRegex = RegExp(r'\S+ +\S+ +(?:\S+) (.+?(?=\[))\[\d+\]\)?: (\(.*?\))? *(.*)$');
+ // * Xcode 8: Sep 13 15:28:51 cbracken-macpro localhost Runner[37195]: (Flutter) Observatory listening on http://127.0.0.1:57701/
+ // * Xcode 9: 2017-09-13 15:26:57.228948-0700 localhost Runner[37195]: (Flutter) Observatory listening on http://127.0.0.1:57701/
+ static final RegExp _mapRegex = RegExp(r'\S+ +\S+ +\S+ +(\S+ +)?(\S+)\[\d+\]\)?: (\(.*?\))? *(.*)$');
// Jan 31 19:23:28 --- last message repeated 1 time ---
static final RegExp _lastMessageSingleRegex = RegExp(r'\S+ +\S+ +\S+ --- last message repeated 1 time ---$');
@@ -634,9 +635,9 @@
String _filterDeviceLine(String string) {
final Match match = _mapRegex.matchAsPrefix(string);
if (match != null) {
- final String category = match.group(1);
- final String tag = match.group(2);
- final String content = match.group(3);
+ final String category = match.group(2);
+ final String tag = match.group(3);
+ final String content = match.group(4);
// Filter out non-Flutter originated noise from the engine.
if (_appName != null && category != _appName) {
diff --git a/packages/flutter_tools/lib/src/project.dart b/packages/flutter_tools/lib/src/project.dart
index 5e264c6..798caa7 100644
--- a/packages/flutter_tools/lib/src/project.dart
+++ b/packages/flutter_tools/lib/src/project.dart
@@ -309,7 +309,7 @@
static final RegExp _productBundleIdPattern = RegExp(r'''^\s*PRODUCT_BUNDLE_IDENTIFIER\s*=\s*(["']?)(.*?)\1;\s*$''');
static const String _productBundleIdVariable = r'$(PRODUCT_BUNDLE_IDENTIFIER)';
- static const String _hostAppProjectName = 'Runner';
+ static const String _hostAppBundleName = 'Runner';
Directory get ephemeralDirectory => parent.directory.childDirectory('.ios');
Directory get _editableDirectory => parent.directory.childDirectory('ios');
@@ -330,6 +330,9 @@
/// a Flutter module with an editable host app.
Directory get _flutterLibRoot => isModule ? ephemeralDirectory : _editableDirectory;
+ /// The bundle name of the host app, `Runner.app`.
+ String get hostAppBundleName => '$_hostAppBundleName.app';
+
/// True, if the parent Flutter project is a module project.
bool get isModule => parent.isModule;
@@ -352,19 +355,19 @@
File get podManifestLock => hostAppRoot.childDirectory('Pods').childFile('Manifest.lock');
/// The 'Info.plist' file of the host app.
- File get hostInfoPlist => hostAppRoot.childDirectory(_hostAppProjectName).childFile('Info.plist');
+ File get hostInfoPlist => hostAppRoot.childDirectory(_hostAppBundleName).childFile('Info.plist');
@override
Directory get symlinks => _flutterLibRoot.childDirectory('.symlinks');
@override
- Directory get xcodeProject => hostAppRoot.childDirectory('$_hostAppProjectName.xcodeproj');
+ Directory get xcodeProject => hostAppRoot.childDirectory('$_hostAppBundleName.xcodeproj');
@override
File get xcodeProjectInfoFile => xcodeProject.childFile('project.pbxproj');
@override
- Directory get xcodeWorkspace => hostAppRoot.childDirectory('$_hostAppProjectName.xcworkspace');
+ Directory get xcodeWorkspace => hostAppRoot.childDirectory('$_hostAppBundleName.xcworkspace');
/// Xcode workspace shared data directory for the host app.
Directory get xcodeWorkspaceSharedData => xcodeWorkspace.childDirectory('xcshareddata');
@@ -405,26 +408,6 @@
return null;
}
- /// The bundle name of the host app, `My App.app`.
- Future<String> get hostAppBundleName async {
- // The product name and bundle name are derived from the display name, which the user
- // is instructed to change in Xcode as part of deploying to the App Store.
- // https://flutter.dev/docs/deployment/ios#review-xcode-project-settings
- // It may be expensive, but the only source of truth for the name is
- // Xcode's interpretation of the build settings.
- String productName;
- if (xcode.xcodeProjectInterpreter.isInstalled) {
- final Map<String, String> xcodeBuildSettings = await buildSettings;
- if (xcodeBuildSettings != null) {
- productName = xcodeBuildSettings['FULL_PRODUCT_NAME'];
- }
- }
- if (productName == null) {
- printTrace('FULL_PRODUCT_NAME not present, defaulting to $_hostAppProjectName');
- }
- return productName ?? '$_hostAppProjectName.app';
- }
-
/// The build settings for the host app of this project, as a detached map.
///
/// Returns null, if iOS tooling is unavailable.
@@ -432,16 +415,11 @@
if (!xcode.xcodeProjectInterpreter.isInstalled) {
return null;
}
- Map<String, String> buildSettings = _buildSettings;
- buildSettings ??= await xcode.xcodeProjectInterpreter.getBuildSettings(
+ _buildSettings ??= await xcode.xcodeProjectInterpreter.getBuildSettings(
xcodeProject.path,
- _hostAppProjectName,
+ _hostAppBundleName,
);
- if (buildSettings != null && buildSettings.isNotEmpty) {
- // No timeouts, flakes, or errors.
- _buildSettings = buildSettings;
- }
- return buildSettings;
+ return _buildSettings;
}
Map<String, String> _buildSettings;
@@ -520,7 +498,7 @@
Directory get pluginRegistrantHost {
return isModule
? _flutterLibRoot.childDirectory('Flutter').childDirectory('FlutterPluginRegistrant')
- : hostAppRoot.childDirectory(_hostAppProjectName);
+ : hostAppRoot.childDirectory(_hostAppBundleName);
}
void _overwriteFromTemplate(String path, Directory target) {
@@ -781,7 +759,7 @@
@override
final FlutterProject parent;
- static const String _hostAppProjectName = 'Runner';
+ static const String _hostAppBundleName = 'Runner';
@override
bool existsSync() => _macOSDirectory.existsSync();
@@ -825,13 +803,13 @@
File get podManifestLock => _macOSDirectory.childDirectory('Pods').childFile('Manifest.lock');
@override
- Directory get xcodeProject => _macOSDirectory.childDirectory('$_hostAppProjectName.xcodeproj');
+ Directory get xcodeProject => _macOSDirectory.childDirectory('$_hostAppBundleName.xcodeproj');
@override
File get xcodeProjectInfoFile => xcodeProject.childFile('project.pbxproj');
@override
- Directory get xcodeWorkspace => _macOSDirectory.childDirectory('$_hostAppProjectName.xcworkspace');
+ Directory get xcodeWorkspace => _macOSDirectory.childDirectory('$_hostAppBundleName.xcworkspace');
@override
Directory get symlinks => ephemeralDirectory.childDirectory('.symlinks');