ann-flavor-flutter 0.1.14 → 0.2.0

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: 86afd16e35ee819fdc999f688a838a3aac99e1488df8b701926ee696c3a27d94
4
- data.tar.gz: 509143d39a25e2923f04f303895ff90e57d6f1967a988ac356e19efcf4453955
3
+ metadata.gz: cb2b8ab1ad12ea68a12a8a93b557f7c614bc7f219dc48137353d2057f3ecb9d8
4
+ data.tar.gz: 2b82e97deb90ac3b49f6f158553f23e6e701b1f66d59138e3f4a57ccb0e3745c
5
5
  SHA512:
6
- metadata.gz: 8480fc1f4ca939e98dcdda2e7a97115be71155fe858addcdcf1df62e85e1ba23fe372356361ad8e7ed47f62bde19ab65096dae78927fefde6952ca17a5f1e27b
7
- data.tar.gz: cb8f39ac36485def3ce474e44bbc86e35588f938ee302679aa461a1eb5b3648c201608f2f5f9ce0837a9899d358a7799287afc843d5381bb9032eb0d1d794932
6
+ metadata.gz: af65440fa998b255208fa86d8111ac53cedfb3fc137d99c91e8ce9939745c6a03cadfadd6b7dd5b1038bf05c80fc5e5b8e7f9119fa736fb4d7fb14f8a212e6f1
7
+ data.tar.gz: e3023ec10784fbeaa677aa1a141ae03f4779ca29c8ff307f0dc8199aac703f14c8a48df8852c363adb7a7c0b883e73e809952bf220eb1acf5e1cdb7741847a28
data/CHANGELOG.md ADDED
@@ -0,0 +1,90 @@
1
+ # Changelog
2
+
3
+ ## 0.2.0
4
+
5
+ **Hard error on removed fields** — `firebase_app_id` and `build_target` inside any
6
+ iOS `firebase` block in `annspec.yaml` are now hard errors. The plugin raises
7
+ `UI.user_error!` and halts immediately at lane start. Remove both fields from your spec:
8
+
9
+ - `GOOGLE_APP_ID` is now read automatically from the generated
10
+ `lib/generated/firebase/{flavor}_{build_type}_ios_firebase_options.dart` file
11
+ (produced by `dart run ann_flutter_flavor sync`).
12
+ - Xcode build target is derived automatically as `{BuildType}-{flavorKey}`
13
+ (e.g. `Release-ledger_in`).
14
+
15
+ **`ANN_GOOGLE_APP_ID` env var fallback** — when the generated firebase options dart
16
+ file is missing (e.g. a fresh CI environment before sync has been run), `GOOGLE_APP_ID`
17
+ falls back to the `ANN_GOOGLE_APP_ID` environment variable. A `UI.important` warning
18
+ is printed to guide you to run sync and remove the dependency.
19
+
20
+ ## 0.1.14
21
+
22
+ Internal publish-workflow improvements. No user-facing changes.
23
+
24
+ ## 0.1.13
25
+
26
+ **`enabled: false` support** — if `annspec.yaml` sets `enabled: false`, all lanes
27
+ skip execution silently. Previously the plugin would error on a disabled spec.
28
+
29
+ **Improved error messages** — field validation errors now include the exact YAML path
30
+ and a fix hint.
31
+
32
+ ## 0.1.12
33
+
34
+ **Breaking: `annai_app:` root key renamed to `app:`** — `annspec.yaml` files using
35
+ the old `annai_app:` root key must be updated.
36
+
37
+ ## 0.1.11
38
+
39
+ Internal version bump. No user-facing changes.
40
+
41
+ ## 0.1.10
42
+
43
+ Internal version bump. No user-facing changes.
44
+
45
+ ## 0.1.9
46
+
47
+ **Firebase `service_account` support** — `firebase_token_file` is replaced by
48
+ `service_account`. The resolved path is exported as `GOOGLE_APPLICATION_CREDENTIALS`
49
+ before invoking Firebase CLI commands.
50
+
51
+ **Schema restructure** — `android.sdk` moved under `android.default.sdk`;
52
+ credentials fields reorganised under `credentials.signing`. Existing specs must be
53
+ updated to the new structure.
54
+
55
+ ## 0.1.8
56
+
57
+ Documentation and sync-workflow updates. No user-facing behaviour changes.
58
+
59
+ ## 0.1.7
60
+
61
+ **Plugin internals renamed** — internal Ruby module renamed from `ann_flutter_flavor`
62
+ to `ann_flavor_flutter` to match the gem name convention. No API change.
63
+
64
+ ## 0.1.6
65
+
66
+ **Firebase config refactored** — `path`, `firebase_app_id`, and `build_target` are
67
+ replaced by `config_file` and `project_id`. The plugin now reads `config_file` to
68
+ locate the Google services JSON instead of using the old fields.
69
+
70
+ ## 0.1.5
71
+
72
+ **`admob.gms_ads_id` cascade fixed** — `get_gms_ads_id` now correctly reads from
73
+ `admob.gms_ads_id` at every cascade level (was silently returning nil for iOS default
74
+ cascade).
75
+
76
+ **Store fields added** — `samsung_galaxy` and `amazon` store IDs are now parsed and
77
+ accessible via `YamlSpecLoader`.
78
+
79
+ ## 0.1.4
80
+
81
+ **`integrations.fastlane` gate** — the plugin checks `integrations.fastlane: true`
82
+ before running. Specs without this flag skip all Fastlane execution.
83
+
84
+ ## 0.1.3
85
+
86
+ Internal publish pipeline improvements. No user-facing behaviour changes.
87
+
88
+ ## 0.1.2
89
+
90
+ Initial release.
@@ -1,3 +1,3 @@
1
1
  module AnnFlavorFlutter
2
- VERSION = "0.1.14"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -32,7 +32,7 @@ module FastlaneFlutterFlavor
32
32
  end
33
33
 
34
34
  loader = YamlSpecLoader.new(root, spec_file)
35
- self.new(loader, flavor, config_name)
35
+ self.new(loader, flavor, root, config_name)
36
36
  end
37
37
 
38
38
  # Injects YAML values into the Xcode Project Build Settings
@@ -87,9 +87,10 @@ module FastlaneFlutterFlavor
87
87
  puts "[Annai] Successfully injected flavor '#{log_flavor}' settings into Xcode configurations."
88
88
  end
89
89
 
90
- def initialize(loader, flavor, config_name = nil)
90
+ def initialize(loader, flavor, project_root, config_name = nil)
91
91
  @loader = loader
92
92
  @flavor = flavor
93
+ @project_root = project_root
93
94
  @platform = :ios
94
95
 
95
96
  # BUILD TYPE DETECTION: Prioritize Flutter CLI mode, fallback to config name regex
@@ -145,9 +146,32 @@ module FastlaneFlutterFlavor
145
146
  end
146
147
 
147
148
  def google_app_id
148
- # Manual lookup for nested Firebase IDs (using build_type for debug/release)
149
- config = @loader.get_merged_flavor_config(@platform, @flavor)
150
- config.dig('firebase', @build_type, 'firebase_app_id') || ''
149
+ # Primary: read appId from the generated firebase_options dart file.
150
+ # File is generated by `dart run ann_flutter_flavor sync` and committed to the repo.
151
+ dart_file = File.join(
152
+ @project_root,
153
+ "lib/generated/firebase/#{@flavor}_#{@build_type}_ios_firebase_options.dart"
154
+ )
155
+ if File.exist?(dart_file)
156
+ content = File.read(dart_file)
157
+ match = content.match(/appId:\s*'([^']+)'/) ||
158
+ content.match(/appId:\s*"([^"]+)"/)
159
+ return match[1] if match
160
+ end
161
+
162
+ # Fallback: ANN_GOOGLE_APP_ID env var — use when the dart file is missing
163
+ # (e.g. fresh CI environment before sync has been run).
164
+ env_value = ENV['ANN_GOOGLE_APP_ID']
165
+ if env_value && !env_value.empty?
166
+ Fastlane::UI.important(
167
+ "[Annai] GOOGLE_APP_ID read from ANN_GOOGLE_APP_ID env var for " \
168
+ "#{@flavor}/#{@build_type}. Run 'dart run ann_flutter_flavor sync' " \
169
+ "to generate the source file and remove this dependency."
170
+ )
171
+ return env_value
172
+ end
173
+
174
+ ''
151
175
  end
152
176
  end
153
177
  end
@@ -30,7 +30,12 @@ module FastlaneFlutterFlavor
30
30
  unless yaml_content.is_a?(Hash)
31
31
  raise "YAML content must be a top-level Hash."
32
32
  end
33
+
34
+ check_removed_firebase_fields(yaml_content)
35
+
33
36
  return yaml_content
37
+ rescue Fastlane::Shell::ShellError => e
38
+ raise e
34
39
  rescue => e
35
40
  # Use @file_path for reporting the error path
36
41
  Fastlane::UI.error("Failed to load or parse annai spec YAML file at #{@file_path}: #{e.message}")
@@ -38,6 +43,45 @@ module FastlaneFlutterFlavor
38
43
  end
39
44
  end
40
45
 
46
+ # Raises UI.user_error! if firebase_app_id or build_target are present in any iOS firebase block.
47
+ # Both fields were removed — they are derived automatically now.
48
+ def check_removed_firebase_fields(spec_data)
49
+ ios_app = spec_data.dig('app', 'ios')
50
+ return unless ios_app.is_a?(Hash)
51
+
52
+ sections = {}
53
+ sections['ios.default'] = ios_app.dig('default') || {}
54
+
55
+ flavors = ios_app.dig('flavor') || {}
56
+ flavors.each do |flavor_key, flavor_data|
57
+ sections["ios.flavor.#{flavor_key}"] = flavor_data || {}
58
+ end
59
+
60
+ sections.each do |section_path, section_data|
61
+ build_types = section_data.dig('build_types') || {}
62
+ build_types.each do |bt_key, bt_data|
63
+ next unless bt_data.is_a?(Hash)
64
+ firebase_block = bt_data.dig('firebase') || {}
65
+ next unless firebase_block.is_a?(Hash)
66
+
67
+ if firebase_block.key?('firebase_app_id')
68
+ Fastlane::UI.user_error!(
69
+ "[#{section_path}/#{bt_key}] `firebase_app_id` is no longer supported in annspec.yaml. " \
70
+ "Remove it — GOOGLE_APP_ID is now read from the generated firebase_options dart file."
71
+ )
72
+ end
73
+
74
+ if firebase_block.key?('build_target')
75
+ Fastlane::UI.user_error!(
76
+ "[#{section_path}/#{bt_key}] `build_target` is no longer supported in annspec.yaml. " \
77
+ "Remove it — the Xcode build target is derived automatically as " \
78
+ "'#{bt_key.to_s.capitalize}-#{section_path.split('.').last}'."
79
+ )
80
+ end
81
+ end
82
+ end
83
+ end
84
+
41
85
  # Recursively merges defaults into a flavor's data.
42
86
  # This function prioritizes 'current_data' (the flavor-specific value).
43
87
  # If a key is present in 'default_data' but missing in 'current_data',
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ann-flavor-flutter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.14
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ANN Solutions
@@ -74,6 +74,7 @@ extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
76
  - ".gitignore"
77
+ - CHANGELOG.md
77
78
  - Gemfile
78
79
  - README.md
79
80
  - Rakefile