ann-flavor-cocoapods 0.4.8 → 0.4.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aff1352b1941f286bf48211651f7d74e20dbd6d94b742f227e976dac89acd99c
4
- data.tar.gz: 831a50cad9203e1e6de772f003811cc80706966a703828d3a7eb7d368ad7074e
3
+ metadata.gz: 9a745777f60f26aa551412f60cf82816b4d19c2cf80923e2883dbbc52b95de19
4
+ data.tar.gz: f74b7e32f1198f0c7cfdafa508135eda10085f788b9e757eca1c396dd92635d9
5
5
  SHA512:
6
- metadata.gz: '03298333bdecae955091e319384152064a6879310e685de17ad84f1f855014f1b87acdaa05c0ec2673dfbd655b6da5286f177884d26f51e17471949f810186c1'
7
- data.tar.gz: ec773a56164d425e9edf554b2a3ded9b7ae364a53a6a91c15e6527a1f3da3c5309e9aa9d40f0173770715c807f4b6565c7bbaa5e7ebe0ed0c8d7b6961d19df98
6
+ metadata.gz: 61011d635ca4f7fec6019e9b0f561ec932a4878a13e48be274242218e96472bc460e3f549fd75b1b186e59495a781e3beda1cb3f6cb5a2b4446ed4047e232f7e
7
+ data.tar.gz: 31b7beebb0fb42800b112d96e91a58ee4175fcfd0b8d595888642cfce94c154332577f7e9dc80af34233a20dbe55a776f25cbf4dfa0f0f06cbf42357ebe58481
@@ -1,5 +1,43 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.10
4
+
5
+ ### Added
6
+ - **`PodfileHelper.warn_legacy_inline_firebase_settings` (DEF-083, #83),
7
+ called from `configure_build_settings` for every `<Bt>-<flavor>`
8
+ configuration.** A Runner project that predates the tooling can carry
9
+ hand-written inline `GOOGLE_APP_ID` / `REVERSED_CLIENT_ID`.
10
+ `configure_build_configuration` copies the stock config's settings into each
11
+ new per-flavor configuration, and an inline setting always beats the same
12
+ key from the config's base xcconfig, so the generated `REVERSED_CLIENT_ID`
13
+ was silently ignored and a stale `GOOGLE_APP_ID` (read by Crashlytics'
14
+ upload-symbols phase) survived a Firebase project change. The check prints
15
+ a warning when (a) an inline literal `REVERSED_CLIENT_ID` exists (flagged
16
+ stale when it also differs from the flavor's `GoogleService-Info` plist),
17
+ or (b) an inline literal `GOOGLE_APP_ID` differs from the plist's.
18
+ Warn-only by design: the project's values are never edited, and
19
+ `GOOGLE_APP_ID` is not written by this plugin. Values containing `$(` are
20
+ build-setting references and skipped; an unreadable or missing plist skips
21
+ only the comparison. The plist path comes from
22
+ `IosResolution.firebase_config_path` (same source `configure_firebase`
23
+ uses).
24
+
25
+ ## 0.4.9
26
+
27
+ ### Fixed
28
+ - **`AnnFlavorCore::Parser.parse` (shared `ann-flavor-core-ruby`) used
29
+ Psych's default `ScalarScanner`, whose `parse_int` calls
30
+ `Kernel#Integer()` — inferring octal from a bare leading zero, so
31
+ `version_code: 000010` silently became `8`, not `10`.** New
32
+ `AnnFlavorCore::Yaml12SafeLoad` replicates `Psych.safe_load`'s own
33
+ internal `parse` → scanner → visitor pipeline with a custom scanner
34
+ whose `parse_int` uses `String#to_i` for the implicit-octal case, while
35
+ still honoring explicit `0x`/`0b` prefixes via `Integer()` exactly as
36
+ before. `SpecLoader.load` (this plugin's own raw-YAML reader, used by no
37
+ current caller but kept correct for future ones) updated to the same
38
+ loader. See `ann-flavor-gradle` 2.3.20's changelog for the full
39
+ root-cause writeup, including the parallel fix in the Kotlin core.
40
+
3
41
  ## 0.4.8
4
42
 
5
43
  ### Changed
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.10
4
+
5
+ **Added:** `pod install` now warns when an older Xcode project still has hand-written `GOOGLE_APP_ID` or `REVERSED_CLIENT_ID` settings on the Runner target. Those override the values this tool generates, so they go stale when the app's Firebase project changes. The warning names the configuration and says what to delete; your project file is never changed.
6
+
7
+ ## 0.4.9
8
+
9
+ **Fixed:** A `version_code` (or any other integer field) written with a leading zero, like `000010`, was silently misread as an octal number — `000010` became `8` instead of `10`. Integers now always parse the way they're written; a leading zero no longer changes the value.
10
+
3
11
  ## 0.4.8
4
12
 
5
13
  **Changed:** Version-only release, published alongside the other plugins for parity. No functional changes.
@@ -147,6 +147,7 @@ module AnnFlavorCocoapods
147
147
 
148
148
  print_build_info = spec.debug_config.nil? || spec.debug_config.print_build_and_flavor_info != false
149
149
  swift_version = ios.default.sdk&.swift_version
150
+ generated_dir = detect_project_layout(project_root)[:generated_dir]
150
151
 
151
152
  touched_projects = []
152
153
 
@@ -196,6 +197,11 @@ module AnnFlavorCocoapods
196
197
  target, user_project, xcode_config, xcconfig_path,
197
198
  icon_name, entitlements_path, info_plist_path
198
199
  )
200
+
201
+ warn_legacy_inline_firebase_settings(
202
+ target, xcode_config, xcconfig_path,
203
+ firebase_plist_file(project_root, ios, flavor_key, bt, generated_dir)
204
+ )
199
205
  end
200
206
 
201
207
  configure_scheme(target, user_project, flavor_key)
@@ -600,6 +606,69 @@ module AnnFlavorCocoapods
600
606
  CODE_SIGN_ENTITLEMENTS
601
607
  ].freeze
602
608
 
609
+ # Absolute path of the generated GoogleService-Info plist for one flavor x
610
+ # build type, or nil when that flavor has no Firebase config.
611
+ def self.firebase_plist_file(project_root, ios, flavor_key, build_type, generated_dir)
612
+ rel = AnnFlavorCore::IosResolution.firebase_config_path(
613
+ ios, flavor_key, build_type, generated_dir: generated_dir
614
+ )
615
+ rel && File.join(project_root, rel)
616
+ end
617
+
618
+ # Warn-only (DEF-083, #83). A Runner project that predates this tooling can
619
+ # carry hand-written inline GOOGLE_APP_ID / REVERSED_CLIENT_ID settings.
620
+ # configure_build_configuration copies them into every new <Bt>-<flavor>
621
+ # configuration, and an inline setting always beats the same key coming from
622
+ # the configuration's base xcconfig -- so the generated REVERSED_CLIENT_ID
623
+ # is silently ignored and a stale GOOGLE_APP_ID (read by Crashlytics'
624
+ # upload-symbols phase) survives a Firebase project change. Nothing here
625
+ # edits the user's project: the values are theirs, so we only report.
626
+ # Values that are build-setting references (e.g. "$(inherited)") are not
627
+ # literals and are skipped.
628
+ def self.warn_legacy_inline_firebase_settings(target, xcode_config, xcconfig_path, plist_file)
629
+ config = target.build_configuration_list[xcode_config]
630
+ return if config.nil?
631
+
632
+ plist = {}
633
+ if plist_file && File.exist?(plist_file)
634
+ begin
635
+ plist = read_plist(plist_file)
636
+ rescue StandardError
637
+ plist = {}
638
+ end
639
+ end
640
+
641
+ reversed = config.build_settings['REVERSED_CLIENT_ID']
642
+ if inline_literal?(reversed)
643
+ expected = plist['REVERSED_CLIENT_ID']
644
+ detail = if expected && expected != reversed
645
+ " It also differs from the Firebase file (#{expected}), so it is stale."
646
+ else
647
+ ''
648
+ end
649
+ puts "ann-flavor-cocoapods WARNING: [#{xcode_config}] the Runner target sets " \
650
+ "REVERSED_CLIENT_ID inline (#{reversed}). An inline build setting overrides " \
651
+ "the value from #{xcconfig_path}, so the generated REVERSED_CLIENT_ID is ignored." \
652
+ "#{detail} Delete the inline REVERSED_CLIENT_ID from the Runner target's " \
653
+ "'#{xcode_config}' configuration (Build Settings, or ios/Runner.xcodeproj/project.pbxproj)."
654
+ end
655
+
656
+ app_id = config.build_settings['GOOGLE_APP_ID']
657
+ expected_app_id = plist['GOOGLE_APP_ID']
658
+ if inline_literal?(app_id) && expected_app_id && app_id != expected_app_id
659
+ puts "ann-flavor-cocoapods WARNING: [#{xcode_config}] the Runner target sets " \
660
+ "GOOGLE_APP_ID inline (#{app_id}), but the Firebase file for this flavor has " \
661
+ "#{expected_app_id}. Crashlytics' upload-symbols phase reads GOOGLE_APP_ID, so " \
662
+ "symbols would go to the wrong Firebase project. Delete the inline GOOGLE_APP_ID " \
663
+ "from the Runner target's '#{xcode_config}' configuration, or set it to the " \
664
+ "value in the Firebase file."
665
+ end
666
+ end
667
+
668
+ def self.inline_literal?(value)
669
+ value.is_a?(String) && !value.empty? && !value.include?('$(')
670
+ end
671
+
603
672
  def self.configure_build_configuration(target, user_project, xcode_config, xcconfig_path, icon_name, entitlements_path = nil, info_plist_path = nil)
604
673
  config_list = target.build_configuration_list
605
674
  config = config_list[xcode_config]
@@ -1,4 +1,5 @@
1
1
  require 'yaml'
2
+ require 'ann_flavor_core/yaml12_scanner'
2
3
 
3
4
  module AnnFlavorCocoapods
4
5
  class SpecLoader
@@ -8,10 +9,15 @@ module AnnFlavorCocoapods
8
9
  # loads the raw YAML for callers that still want Hash-shaped access (e.g. an
9
10
  # end user's Podfile), and PodfileHelper additionally parses through the core
10
11
  # for cascade resolution.
12
+ #
13
+ # Uses AnnFlavorCore::Yaml12SafeLoad, not YAML.safe_load directly: Psych's
14
+ # default int scanner infers octal from a bare leading zero (YAML 1.1),
15
+ # so a raw-Hash reader here could return the same wrong value for e.g.
16
+ # version_code that ann-flavor-core-ruby's own parser already fixed.
11
17
  def self.load(project_root = nil)
12
18
  path = find_spec_file(project_root || Dir.pwd)
13
19
  raise "annspec.yaml not found (searched upward from #{project_root || Dir.pwd})" unless path
14
- YAML.safe_load(File.read(path), permitted_classes: [Symbol])
20
+ AnnFlavorCore::Yaml12SafeLoad.load(File.read(path), permitted_classes: [Symbol])
15
21
  end
16
22
 
17
23
  def self.find_spec_file(start_dir)
@@ -1,3 +1,3 @@
1
1
  module AnnFlavorCocoapods
2
- VERSION = "0.4.8"
2
+ VERSION = "0.4.10"
3
3
  end
@@ -86,7 +86,7 @@ module AnnFlavorCore
86
86
 
87
87
  IosDefault = Struct.new(
88
88
  :id, :name, :version_name, :version_code, :main_file,
89
- :admob, :icon, :credentials, :firebase, :build_types, :custom, :dart_defines, :env, :info_plist, :entitlements, :sdk,
89
+ :admob, :icon, :credentials, :firebase, :build_types, :custom, :dart_defines, :env, :info_plist, :entitlements, :export_options, :sdk,
90
90
  keyword_init: true
91
91
  ) do
92
92
  def self.defaults = new(build_types: {}, custom: {}, dart_defines: DartDefines.defaults, env: {})
@@ -94,7 +94,7 @@ module AnnFlavorCore
94
94
 
95
95
  IosFlavor = Struct.new(
96
96
  :id, :id_suffix, :name, :name_suffix, :version_name, :version_code,
97
- :main_file, :admob, :icon, :firebase, :stores, :credentials, :build_types, :custom, :dart_defines, :env, :info_plist, :entitlements,
97
+ :main_file, :admob, :icon, :firebase, :stores, :credentials, :build_types, :custom, :dart_defines, :env, :info_plist, :entitlements, :export_options,
98
98
  keyword_init: true
99
99
  ) do
100
100
  def self.defaults = new(id_suffix: '', name_suffix: '', build_types: {}, custom: {}, dart_defines: DartDefines.defaults, env: {})
@@ -102,11 +102,7 @@ module AnnFlavorCore
102
102
 
103
103
  IosCredentials = Struct.new(:signing, :app_store, keyword_init: true)
104
104
  IosSigning = Struct.new(:team_id, keyword_init: true)
105
- AppStoreCredentials = Struct.new(
106
- :api_key, :export_options_plist, :export_options_team_id,
107
- :export_options_signing_certificate,
108
- keyword_init: true
109
- )
105
+ AppStoreCredentials = Struct.new(:api_key, keyword_init: true)
110
106
 
111
107
  # ── Web ─────────────────────────────────────────────────────────────────────
112
108
 
@@ -160,7 +156,7 @@ module AnnFlavorCore
160
156
  :id_suffix, :name_suffix,
161
157
  :firebase, :auth, :admob,
162
158
  :minify_enabled, :shrink_resources, :lint_check_release_builds,
163
- :ndk_version, :ndk_debug_symbol_level, :ndk_abi_filters, :custom, :dart_defines, :env, :info_plist, :entitlements,
159
+ :ndk_version, :ndk_debug_symbol_level, :ndk_abi_filters, :custom, :dart_defines, :env, :info_plist, :entitlements, :export_options,
164
160
  keyword_init: true
165
161
  ) do
166
162
  def self.defaults = new(id_suffix: '', name_suffix: '', ndk_abi_filters: [], custom: {}, dart_defines: DartDefines.defaults, env: {})
@@ -214,6 +210,7 @@ module AnnFlavorCore
214
210
  :effective_dart_defines,
215
211
  :effective_info_plist,
216
212
  :effective_entitlements,
213
+ :effective_export_options,
217
214
  keyword_init: true
218
215
  )
219
216
  end
@@ -1,5 +1,6 @@
1
1
  require 'yaml'
2
2
  require_relative 'model'
3
+ require_relative 'yaml12_scanner'
3
4
 
4
5
  module AnnFlavorCore
5
6
  #
@@ -16,7 +17,7 @@ module AnnFlavorCore
16
17
  #
17
18
  module Parser
18
19
  def self.parse(yaml_string)
19
- raw = YAML.safe_load(yaml_string, aliases: true) || {}
20
+ raw = AnnFlavorCore::Yaml12SafeLoad.load(yaml_string, aliases: true) || {}
20
21
  from_hash(raw)
21
22
  end
22
23
 
@@ -171,9 +172,10 @@ module AnnFlavorCore
171
172
  custom: parse_custom_config(h(m, 'custom')),
172
173
  dart_defines: parse_dart_defines(h(m, 'dart_defines')),
173
174
  env: parse_env(h(m, 'env')),
174
- info_plist: m['info_plist'],
175
- entitlements: m['entitlements'],
176
- sdk: (parse_ios_sdk(h(m, 'sdk')) unless h(m, 'sdk').empty?),
175
+ info_plist: m['info_plist'],
176
+ entitlements: m['entitlements'],
177
+ export_options: m['export_options'],
178
+ sdk: (parse_ios_sdk(h(m, 'sdk')) unless h(m, 'sdk').empty?),
177
179
  )
178
180
  end
179
181
 
@@ -199,20 +201,18 @@ module AnnFlavorCore
199
201
  custom: parse_custom_config(h(m, 'custom')),
200
202
  dart_defines: parse_dart_defines(h(m, 'dart_defines')),
201
203
  env: parse_env(h(m, 'env')),
202
- info_plist: m['info_plist'],
203
- entitlements: m['entitlements'],
204
+ info_plist: m['info_plist'],
205
+ entitlements: m['entitlements'],
206
+ export_options: m['export_options'],
204
207
  )
205
208
  end
206
209
 
207
210
  def self.parse_ios_credentials(m)
208
211
  IosCredentials.new(
209
- signing: (IosSigning.new(team_id: h(m, 'signing')['team_id']) unless h(m, 'signing').empty?),
212
+ signing: (IosSigning.new(team_id: h(m, 'signing')['team_id']) unless h(m, 'signing').empty?),
210
213
  app_store: (AppStoreCredentials.new(
211
- api_key: h(m, 'app_store')['api_key'],
212
- export_options_plist: h(m, 'app_store')['export_options_plist'],
213
- export_options_team_id: h(m, 'app_store')['export_options_team_id'],
214
- export_options_signing_certificate: h(m, 'app_store')['export_options_signing_certificate'],
215
- ) unless h(m, 'app_store').empty?),
214
+ api_key: h(m, 'app_store')['api_key'],
215
+ ) unless h(m, 'app_store').empty?),
216
216
  )
217
217
  end
218
218
 
@@ -335,6 +335,7 @@ module AnnFlavorCore
335
335
  env: parse_env(h(v, 'env')),
336
336
  info_plist: v['info_plist'],
337
337
  entitlements: v['entitlements'],
338
+ export_options: v['export_options'],
338
339
  )
339
340
  end
340
341
  end
@@ -122,6 +122,9 @@ module AnnFlavorCore
122
122
  # Same whole-value most-specific-wins rule as effective_info_plist above.
123
123
  effective_entitlements: flavor.build_types[build_type]&.entitlements || flavor.entitlements ||
124
124
  defaults.build_types[build_type]&.entitlements || defaults.entitlements,
125
+ # Same whole-value most-specific-wins rule as effective_info_plist above.
126
+ effective_export_options: flavor.build_types[build_type]&.export_options || flavor.export_options ||
127
+ defaults.build_types[build_type]&.export_options || defaults.export_options,
125
128
  )
126
129
  end
127
130
 
@@ -30,7 +30,13 @@ module AnnFlavorCore
30
30
  #
31
31
  # env is a flat string Hash of arbitrary, user-declared native
32
32
  # build-setting keys (e.g. REVERSED_CLIENT_ID) -- same free-form treatment.
33
- FREE_FORM_FIELDS = %i[custom dart_defines env info_plist entitlements].freeze
33
+ #
34
+ # export_options is a flat opaque Hash of arbitrary exportOptions.plist
35
+ # keys (e.g. compileBitcode, signingStyle) -- same free-form treatment as
36
+ # info_plist/entitlements; missing here caused a real ledger build
37
+ # failure (Kotlin core had the same gap -- see StrictModeChecker.kt,
38
+ # 2026-09-09).
39
+ FREE_FORM_FIELDS = %i[custom dart_defines env info_plist entitlements export_options].freeze
34
40
 
35
41
  # (containing_struct, field_name) => target_struct — only the "does this field
36
42
  # recurse, and into what" relationship; the valid-keys-within-that-struct question
@@ -0,0 +1,55 @@
1
+ require 'psych'
2
+
3
+ module AnnFlavorCore
4
+ # Psych's ScalarScanner#parse_int calls Ruby's own Kernel#Integer(), which
5
+ # infers octal from a bare leading zero (no 0x/0b prefix) -- "000010"
6
+ # silently becomes 8, not 10. YAML 1.2 dropped this rule entirely (a
7
+ # leading zero is just a leading zero in a base-10 number); Dart's
8
+ # package:yaml already follows 1.2 and never exhibited this. A real
9
+ # annspec.yaml (ledger, 2026-09-09) hit this directly: version_code:
10
+ # 000010 built and uploaded as version code 8.
11
+ #
12
+ # Psych::safe_load builds its ScalarScanner internally with no injection
13
+ # point for a custom one, so this replicates the same
14
+ # parse -> scanner -> visitor pipeline safe_load itself uses (all public,
15
+ # documented Psych classes), swapping in a scanner whose #parse_int uses
16
+ # String#to_i (which never infers octal -- it always reads base 10, unlike
17
+ # Kernel#Integer()) instead of the default Integer(string).
18
+ class Yaml12ScalarScanner < Psych::ScalarScanner
19
+ # Kernel#Integer() (the default implementation) infers a radix from the
20
+ # string's own leading characters: "0x"/"0b" prefixes are honored (as
21
+ # they should be — YAML 1.2 keeps those), but a bare leading "0" with no
22
+ # prefix is ALSO inferred as octal, which is the one behaviour YAML 1.2
23
+ # dropped. Only that implicit case is overridden here — 0x/0b forms
24
+ # still go through Integer() exactly as before, unaffected.
25
+ def parse_int(string)
26
+ cleaned = string.delete(',_')
27
+ sign, unsigned = cleaned.start_with?('-', '+') ? [cleaned[0], cleaned[1..]] : ['', cleaned]
28
+ if unsigned.start_with?('0x', '0X', '0b', '0B')
29
+ Integer(cleaned)
30
+ else
31
+ "#{sign}#{unsigned}".to_i
32
+ end
33
+ end
34
+ end
35
+
36
+ module Yaml12SafeLoad
37
+ def self.load(yaml_string, permitted_classes: [], permitted_symbols: [], aliases: false)
38
+ result = Psych.parse(yaml_string)
39
+ return nil unless result
40
+
41
+ class_loader = Psych::ClassLoader::Restricted.new(
42
+ permitted_classes.map(&:to_s),
43
+ permitted_symbols.map(&:to_s),
44
+ )
45
+ scanner = Yaml12ScalarScanner.new(class_loader)
46
+ visitor =
47
+ if aliases
48
+ Psych::Visitors::ToRuby.new(scanner, class_loader)
49
+ else
50
+ Psych::Visitors::NoAliasRuby.new(scanner, class_loader)
51
+ end
52
+ visitor.accept(result)
53
+ end
54
+ end
55
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ann-flavor-cocoapods
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.8
4
+ version: 0.4.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - ANN Solutions
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-09-03 00:00:00.000000000 Z
11
+ date: 2026-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cocoapods
@@ -81,6 +81,7 @@ files:
81
81
  - lib/vendor/ann_flavor_core/lib/ann_flavor_core/resolver.rb
82
82
  - lib/vendor/ann_flavor_core/lib/ann_flavor_core/strict_mode_checker.rb
83
83
  - lib/vendor/ann_flavor_core/lib/ann_flavor_core/version.rb
84
+ - lib/vendor/ann_flavor_core/lib/ann_flavor_core/yaml12_scanner.rb
84
85
  homepage: https://anntech.dev/docs/ann-flutter-flavor-suite/cocoapods-overview
85
86
  licenses:
86
87
  - MIT