From 6d2b5ea30eb24c2f6ba08f53eef3755171e818d6 Mon Sep 17 00:00:00 2001 From: Arne Molland Date: Thu, 15 Jun 2023 01:43:17 +0200 Subject: [PATCH] Fix inconsistently suffixed macOS flavored bundle directory (#127997) The current implementation of macOS flavor support (#119564) assumes a bundle directory that differs from both the iOS implementation and the official documentation. The [documentation](https://docs.flutter.dev/deployment/flavors) instructs developers to suffix their Xcode build configurations with `-`, but the implementation assumes a space: https://github.com/flutter/flutter/blob/5fd9ef4240d3fc239f042f49b8eb1ad24260091f/packages/flutter_tools/lib/src/macos/application_package.dart#L174-L178 Whereas the iOS implementation, which is the reference for the docs, assumes a `-` suffix: https://github.com/flutter/flutter/blob/a257efc2841ed7042322fbd043f0983e705d7da2/packages/flutter_tools/lib/src/ios/xcodeproj.dart#L482-L488 This change replaces the empty space with the `-` character which is in line with the documentation and iOS implementation, as well as removing the sentence-casing applied to the flavor name; every bundle built with a flavor keeps the original flavor name in its filename. *List which issues are fixed by this PR. You must list at least one issue.* #122684. *If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].* --- packages/flutter_tools/lib/src/macos/application_package.dart | 2 +- .../test/general.shard/macos/application_package_test.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/flutter_tools/lib/src/macos/application_package.dart b/packages/flutter_tools/lib/src/macos/application_package.dart index b2b993476f4..036de96de65 100644 --- a/packages/flutter_tools/lib/src/macos/application_package.dart +++ b/packages/flutter_tools/lib/src/macos/application_package.dart @@ -173,7 +173,7 @@ class BuildableMacOSApp extends MacOSApp { String bundleDirectory(BuildInfo buildInfo) { return sentenceCase(buildInfo.mode.cliName) + (buildInfo.flavor != null - ? ' ${sentenceCase(buildInfo.flavor!)}' + ? '-${buildInfo.flavor!}' : ''); } diff --git a/packages/flutter_tools/test/general.shard/macos/application_package_test.dart b/packages/flutter_tools/test/general.shard/macos/application_package_test.dart index 40652afe0f7..1edfa137af2 100644 --- a/packages/flutter_tools/test/general.shard/macos/application_package_test.dart +++ b/packages/flutter_tools/test/general.shard/macos/application_package_test.dart @@ -167,7 +167,7 @@ group('PrebuiltMacOSApp', () { const BuildInfo flavoredApp = BuildInfo(BuildMode.release, 'flavor', treeShakeIcons: false); applicationBundle = macosApp.bundleDirectory(flavoredApp); - expect(applicationBundle, 'Release Flavor'); + expect(applicationBundle, 'Release-flavor'); }, overrides: overrides); });