ann-flavor-flutter 0.1.12 → 0.1.14
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 +4 -4
- data/lib/ann_flavor_flutter/version.rb +1 -1
- data/lib/fastlane/plugin/ann_flavor_flutter/actions/ann_upload_to_firebase_action.rb +0 -6
- data/lib/fastlane/plugin/ann_flavor_flutter/helper/lanes_annai.rb +11 -11
- data/lib/fastlane/plugin/ann_flavor_flutter/helper/utils_spec_loader.rb +20 -39
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 86afd16e35ee819fdc999f688a838a3aac99e1488df8b701926ee696c3a27d94
|
|
4
|
+
data.tar.gz: 509143d39a25e2923f04f303895ff90e57d6f1967a988ac356e19efcf4453955
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8480fc1f4ca939e98dcdda2e7a97115be71155fe858addcdcf1df62e85e1ba23fe372356361ad8e7ed47f62bde19ab65096dae78927fefde6952ca17a5f1e27b
|
|
7
|
+
data.tar.gz: cb8f39ac36485def3ce474e44bbc86e35588f938ee302679aa461a1eb5b3648c201608f2f5f9ce0837a9899d358a7799287afc843d5381bb9032eb0d1d794932
|
|
@@ -94,7 +94,6 @@ module Fastlane
|
|
|
94
94
|
skip_compile: params[:skip_compile],
|
|
95
95
|
skip_sound_null_safety: params[:skip_sound_null_safety],
|
|
96
96
|
firebase_project: params[:firebase_project],
|
|
97
|
-
firebase_token: params[:firebase_token] || ENV["FIREBASE_TOKEN"],
|
|
98
97
|
)
|
|
99
98
|
|
|
100
99
|
if success
|
|
@@ -151,11 +150,6 @@ module Fastlane
|
|
|
151
150
|
default_value: false),
|
|
152
151
|
|
|
153
152
|
# --- Web / Firebase Specific Parameters ---
|
|
154
|
-
FastlaneCore::ConfigItem.new(key: :firebase_token,
|
|
155
|
-
description: "Firebase CLI CI token for authentication (generated via 'firebase login:ci')",
|
|
156
|
-
optional: true,
|
|
157
|
-
env_name: "FIREBASE_TOKEN",
|
|
158
|
-
type: String),
|
|
159
153
|
FastlaneCore::ConfigItem.new(key: :firebase_project,
|
|
160
154
|
description: "The Firebase Project ID to deploy to. This value overrides the 'project_id' in the annai spec file",
|
|
161
155
|
optional: true,
|
|
@@ -162,7 +162,7 @@ module FastlaneFlutterFlavor
|
|
|
162
162
|
# New method to compile web build and deploy to Firebase Hosting
|
|
163
163
|
def upload_to_firebase(flavor: "", main_file: "lib/main.dart", build_config: "release",
|
|
164
164
|
skip_compile: false, skip_sound_null_safety: false,
|
|
165
|
-
firebase_project
|
|
165
|
+
firebase_project:)
|
|
166
166
|
|
|
167
167
|
begin
|
|
168
168
|
unless @isWeb
|
|
@@ -216,12 +216,14 @@ module FastlaneFlutterFlavor
|
|
|
216
216
|
# 5. Write the updated firebase.json back to disk
|
|
217
217
|
File.write(firebase_config_path, JSON.pretty_generate(config))
|
|
218
218
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
219
|
+
# Resolve service account for ADC auth — set GOOGLE_APPLICATION_CREDENTIALS if found
|
|
220
|
+
sa_path = @specLoader.get_service_account(@platform, flavor, build_config)
|
|
221
|
+
env_overrides = {}
|
|
222
|
+
if sa_path && File.exist?(sa_path)
|
|
223
|
+
env_overrides['GOOGLE_APPLICATION_CREDENTIALS'] = sa_path
|
|
224
|
+
Fastlane::UI.message("Using service account for Firebase auth: #{sa_path}")
|
|
225
|
+
elsif sa_path
|
|
226
|
+
Fastlane::UI.error("service_account file not found at: #{sa_path}")
|
|
225
227
|
end
|
|
226
228
|
|
|
227
229
|
# 6. Deploy to Firebase Hosting using the determined ID
|
|
@@ -230,17 +232,15 @@ module FastlaneFlutterFlavor
|
|
|
230
232
|
"--only", "hosting",
|
|
231
233
|
"--project", final_project_id,
|
|
232
234
|
]
|
|
233
|
-
# Only add the token flags if token is present
|
|
234
|
-
if !token.empty?
|
|
235
|
-
command_parts.push("--token", token)
|
|
236
|
-
end
|
|
237
235
|
|
|
238
236
|
firebase_root = @root_folder
|
|
239
237
|
|
|
240
238
|
Fastlane::UI.message("Executing Firebase deploy command: #{command_parts.join(' ')}")
|
|
241
239
|
|
|
242
240
|
Dir.chdir firebase_root do
|
|
241
|
+
env_overrides.each { |k, v| ENV[k] = v }
|
|
243
242
|
Fastlane::Actions::sh(*command_parts)
|
|
243
|
+
env_overrides.keys.each { |k| ENV.delete(k) }
|
|
244
244
|
end
|
|
245
245
|
|
|
246
246
|
@statusManager.logSuccess flavor, "upload_to_firebase", @platform
|
|
@@ -71,6 +71,11 @@ module FastlaneFlutterFlavor
|
|
|
71
71
|
return current_data
|
|
72
72
|
end
|
|
73
73
|
|
|
74
|
+
def enabled?
|
|
75
|
+
return false unless @spec_data
|
|
76
|
+
@spec_data.fetch('enabled', true) != false
|
|
77
|
+
end
|
|
78
|
+
|
|
74
79
|
# Retrieves the configuration for a specific flavor, merged with the platform defaults.
|
|
75
80
|
# This function uses the spec data loaded into the instance variable @spec_data.
|
|
76
81
|
#
|
|
@@ -78,7 +83,7 @@ module FastlaneFlutterFlavor
|
|
|
78
83
|
# @param flavor_name [String] The name of the flavor (e.g., 'dev', 'staging').
|
|
79
84
|
# @return [Hash, nil] The fully merged configuration for the flavor, or nil if missing.
|
|
80
85
|
def get_merged_flavor_config(platform, flavor_name)
|
|
81
|
-
return nil unless @spec_data
|
|
86
|
+
return nil unless @spec_data && enabled?
|
|
82
87
|
|
|
83
88
|
platform_key = platform.to_s
|
|
84
89
|
flavor_key = flavor_name.to_s
|
|
@@ -120,7 +125,7 @@ module FastlaneFlutterFlavor
|
|
|
120
125
|
# @param platform [Symbol] The target platform (:ios or :android).
|
|
121
126
|
# @return [Hash] A hash where keys are flavor names (String) and values are their raw configs (Hash).
|
|
122
127
|
def get_platform_flavors(platform)
|
|
123
|
-
return {} unless @spec_data
|
|
128
|
+
return {} unless @spec_data && enabled?
|
|
124
129
|
platform_key = platform.to_s
|
|
125
130
|
|
|
126
131
|
# Use dig to safely retrieve the flavors hash from @spec_data
|
|
@@ -274,49 +279,25 @@ module FastlaneFlutterFlavor
|
|
|
274
279
|
config.dig('build_types', build_config, 'firebase', 'project_id') if config
|
|
275
280
|
end
|
|
276
281
|
|
|
277
|
-
#
|
|
278
|
-
#
|
|
279
|
-
# @return [String, nil]
|
|
280
|
-
def
|
|
282
|
+
# Returns the resolved service_account path for the given platform/flavor/build_config,
|
|
283
|
+
# cascading from flavor build_type → default build_type.
|
|
284
|
+
# @return [String, nil]
|
|
285
|
+
def get_service_account(platform, flavor_name, build_config)
|
|
281
286
|
return nil unless @spec_data
|
|
282
287
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
rel_props_path = @spec_data.dig('app', 'general', 'firebase_token_file')
|
|
286
|
-
|
|
287
|
-
if rel_props_path.nil? || rel_props_path.empty?
|
|
288
|
-
Fastlane::UI.verbose("No 'firebase_token_file' defined in app -> general.")
|
|
289
|
-
return nil
|
|
290
|
-
end
|
|
288
|
+
platform_data = @spec_data.dig('app', platform)
|
|
289
|
+
return nil unless platform_data
|
|
291
290
|
|
|
292
|
-
|
|
293
|
-
|
|
291
|
+
flavor_data = platform_data.dig('flavor', flavor_name) || {}
|
|
292
|
+
default_data = platform_data['default'] || {}
|
|
294
293
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
return nil
|
|
298
|
-
end
|
|
294
|
+
flavor_bt_sa = flavor_data.dig('build_types', build_config, 'firebase', 'service_account')
|
|
295
|
+
default_bt_sa = default_data.dig('build_types', build_config, 'firebase', 'service_account')
|
|
299
296
|
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
File.foreach(full_props_path) do |line|
|
|
303
|
-
# Remove whitespace and skip comments/empty lines
|
|
304
|
-
line = line.strip
|
|
305
|
-
next if line.empty? || line.start_with?('#', '!')
|
|
306
|
-
|
|
307
|
-
# Match KEY=VALUE (handles both = and : as separators)
|
|
308
|
-
if line =~ /^\s*FIREBASE_TOKEN\s*[=:]\s*(.*)$/
|
|
309
|
-
token = $1.strip
|
|
310
|
-
# Remove optional surrounding quotes if present
|
|
311
|
-
return token.gsub(/^['"]|['"]$/, '')
|
|
312
|
-
end
|
|
313
|
-
end
|
|
314
|
-
rescue => e
|
|
315
|
-
Fastlane::UI.error("Error reading properties file at #{rel_props_path}: #{e.message}")
|
|
316
|
-
end
|
|
297
|
+
path = flavor_bt_sa || default_bt_sa
|
|
298
|
+
return nil if path.nil? || path.empty?
|
|
317
299
|
|
|
318
|
-
|
|
319
|
-
return nil
|
|
300
|
+
File.expand_path(path, @root_folder)
|
|
320
301
|
end
|
|
321
302
|
|
|
322
303
|
# For AdMob (annai_ads)
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ann-flavor-flutter
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.14
|
|
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-
|
|
11
|
+
date: 2026-07-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: fastlane
|