From bf0a9cc8fc6032f3ddf0b8aee4087df045aa34ae Mon Sep 17 00:00:00 2001 From: "Dat H. Pham" Date: Fri, 22 May 2026 22:33:38 +0700 Subject: [PATCH] chore: add DART_DEFINES safety check to detect future Flutter bug regressions Emit a warning when SENTRY_RELEASE base64 lacks '=' padding (Flutter bug condition present) and hard-fail before invoking build_app if the joined DART_DEFINES still has no '=' for any reason. Also log the final value for CI debugging. --- ios/fastlane/Fastfile | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/ios/fastlane/Fastfile b/ios/fastlane/Fastfile index 05984129e..ff78d85c5 100644 --- a/ios/fastlane/Fastfile +++ b/ios/fastlane/Fastfile @@ -64,12 +64,30 @@ platform :ios do sentry_release = pubspec.match(/^version:\s+(\S+)/)[1].split("+").first sentry_define = Base64.strict_encode64("SENTRY_RELEASE=#{sentry_release}") padding_define = Base64.strict_encode64("_FB_PAD=") # always encodes to "X0ZCX1BBRD0=" + dart_defines_value = "#{sentry_define},#{padding_define}" + + # Detect Flutter DART_DEFINES bug condition. Warn when the bare sentry_define + # has no '=' padding (would crash assemble.dart:282 without our workaround), + # then hard-fail if the final joined value somehow still lacks '=' so we never + # ship a build that would die in xcode_backend.dart. + if !sentry_define.include?('=') + UI.important("[DART_DEFINES] sentry_define '#{sentry_define}' has no '=' padding " \ + "(SENTRY_RELEASE=#{sentry_release} length divisible by 3). " \ + "Padding workaround active.") + end + if !dart_defines_value.include?('=') + UI.user_error!("[DART_DEFINES] joined value '#{dart_defines_value}' has no '=' — " \ + "Flutter assemble would crash with 'Improperly formatted define flag'. " \ + "Check ios/fastlane/Fastfile padding logic.") + end + UI.message("[DART_DEFINES] final value: #{dart_defines_value}") + build_app( scheme: "Runner", configuration: "Release", workspace: "Runner.xcworkspace", export_method: "app-store", - xcargs: "DART_DEFINES=#{sentry_define},#{padding_define}", + xcargs: "DART_DEFINES=#{dart_defines_value}", ) upload_to_testflight( skip_waiting_for_build_processing: true,