Skip to content

Commit f82fb90

Browse files
committed
Scope macOS flavor settings to Runner target
1 parent 2803cc6 commit f82fb90

3 files changed

Lines changed: 22 additions & 6 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,6 @@ app.*.map.json
6262
/fastlane/macos/Preview.html
6363
/fastlane/macos/report.xml
6464
/fastlane/macos/test_output
65+
66+
# Generated by fastlane when selecting macOS release flavors.
67+
/macos/Runner/Configs/FlavorOverrides.xcconfig

fastlane/macos/Fastfile

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,18 @@ def ensure_bundle_id_exists!(metadata, api_key_path)
237237
)
238238
end
239239

240-
def macos_flutter_build_environment(metadata)
241-
{
242-
"FLUTTER_XCODE_PRODUCT_NAME" => metadata[:app_name],
243-
"FLUTTER_XCODE_PRODUCT_BUNDLE_IDENTIFIER" => metadata[:bundle_id]
244-
}.map { |key, value| "#{key}=#{shell_escape(value)}" }.join(" ")
240+
def macos_flavor_overrides_xcconfig_path
241+
File.join(workspace_root, "macos", "Runner", "Configs", "FlavorOverrides.xcconfig")
242+
end
243+
244+
def write_macos_flavor_overrides!(metadata)
245+
path = macos_flavor_overrides_xcconfig_path
246+
FileUtils.mkdir_p(File.dirname(path))
247+
File.write(path, <<~XCCONFIG)
248+
// Generated by fastlane; do not commit.
249+
PRODUCT_NAME = #{metadata[:app_name]}
250+
PRODUCT_BUNDLE_IDENTIFIER = #{metadata[:bundle_id]}
251+
XCCONFIG
245252
end
246253

247254
def plist_value(path, key)
@@ -376,11 +383,12 @@ platform :mac do
376383
metadata = release_metadata(flavor: single_macos_release_flavor(options))
377384

378385
FileUtils.mkdir_p(metadata[:dist_dir])
386+
write_macos_flavor_overrides!(metadata)
379387

380388
sh("cd #{shell_escape(workspace_root)} && fvm flutter pub get")
381389
Bundler.with_unbundled_env do
382390
dart_define = shell_escape("ZCASH_DEFAULT_NETWORK=#{metadata[:zcash_default_network]}")
383-
sh("cd #{shell_escape(workspace_root)} && #{macos_flutter_build_environment(metadata)} fvm flutter build macos --release --no-pub --dart-define=#{dart_define}")
391+
sh("cd #{shell_escape(workspace_root)} && fvm flutter build macos --release --no-pub --dart-define=#{dart_define}")
384392
end
385393

386394
UI.user_error!("Expected app bundle at #{metadata[:app_path]}") unless File.directory?(metadata[:app_path])

macos/Runner/Configs/AppInfo.xcconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,10 @@ PRODUCT_NAME = Vizor
1010
// The application's bundle identifier
1111
PRODUCT_BUNDLE_IDENTIFIER = com.keplr.vizor
1212

13+
// Fastlane writes this ignored file for macOS release flavors. It is included
14+
// here, instead of passed as global xcodebuild settings, so Pods targets keep
15+
// their own PRODUCT_NAME and bundle paths.
16+
#include? "FlavorOverrides.xcconfig"
17+
1318
// The copyright displayed in application information
1419
PRODUCT_COPYRIGHT = Copyright © 2026 com.zcash. All rights reserved.

0 commit comments

Comments
 (0)