ann-flutter-flavor 0.1.6

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.
Files changed (30) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +1 -0
  3. data/Gemfile +3 -0
  4. data/Gemfile.lock +271 -0
  5. data/README.md +283 -0
  6. data/Rakefile +6 -0
  7. data/ann-flutter-flavor.gemspec +25 -0
  8. data/lib/ann-flutter-flavor.rb +10 -0
  9. data/lib/ann_flutter_flavor/version.rb +3 -0
  10. data/lib/fastlane/plugin/ann_flutter_flavor/actions/ann_compile_build_action.rb +219 -0
  11. data/lib/fastlane/plugin/ann_flutter_flavor/actions/ann_download_from_app_store_action.rb +183 -0
  12. data/lib/fastlane/plugin/ann_flutter_flavor/actions/ann_download_from_play_store_action.rb +168 -0
  13. data/lib/fastlane/plugin/ann_flutter_flavor/actions/ann_emulators_action.rb +180 -0
  14. data/lib/fastlane/plugin/ann_flutter_flavor/actions/ann_run_tests_action.rb +128 -0
  15. data/lib/fastlane/plugin/ann_flutter_flavor/actions/ann_setup_action.rb +137 -0
  16. data/lib/fastlane/plugin/ann_flutter_flavor/actions/ann_upload_to_app_store_action.rb +280 -0
  17. data/lib/fastlane/plugin/ann_flutter_flavor/actions/ann_upload_to_firebase_action.rb +199 -0
  18. data/lib/fastlane/plugin/ann_flutter_flavor/actions/ann_upload_to_play_store_action.rb +248 -0
  19. data/lib/fastlane/plugin/ann_flutter_flavor/helper/lanes_android.rb +120 -0
  20. data/lib/fastlane/plugin/ann_flutter_flavor/helper/lanes_annai.rb +502 -0
  21. data/lib/fastlane/plugin/ann_flutter_flavor/helper/lanes_ios.rb +157 -0
  22. data/lib/fastlane/plugin/ann_flutter_flavor/helper/lanes_setup.rb +161 -0
  23. data/lib/fastlane/plugin/ann_flutter_flavor/helper/podspec_bridge.rb +153 -0
  24. data/lib/fastlane/plugin/ann_flutter_flavor/helper/test_integration.rb +346 -0
  25. data/lib/fastlane/plugin/ann_flutter_flavor/helper/utils_project_config.rb +102 -0
  26. data/lib/fastlane/plugin/ann_flutter_flavor/helper/utils_spec_loader.rb +363 -0
  27. data/lib/fastlane/plugin/ann_flutter_flavor/helper/utils_status.rb +115 -0
  28. data/lib/fastlane/plugin/ann_flutter_flavor.rb +23 -0
  29. data/plugin_manager.sh +140 -0
  30. metadata +113 -0
@@ -0,0 +1,180 @@
1
+ require 'fastlane/action'
2
+ # Assuming these helpers are available in the Fastlane plugin structure
3
+ require 'fastlane/plugin/ann_flutter_flavor/helper/test_integration'
4
+ require 'fastlane/plugin/ann_flutter_flavor/helper/utils_status'
5
+ require 'fastlane/plugin/ann_flutter_flavor/helper/utils_project_config'
6
+
7
+
8
+ module Fastlane
9
+ module Actions
10
+ # ----------------------------------------------------
11
+ # AnnaiOpenEmulatorsAction
12
+ # ----------------------------------------------------
13
+ class AnnaiOpenEmulatorsAction < Action
14
+
15
+ def self.run(params)
16
+ platform = params[:platform]
17
+ UI.header("Starting Annai Open Emulators for #{platform}")
18
+
19
+ # 1. Determine the necessary paths and managers
20
+ root_folder = FastlaneFlutterFlavor::ProjectUtil.find_flutter_root
21
+
22
+ # Resolve the test spec file path
23
+ test_spec_file_input = params[:test_spec_file]
24
+ resolved_test_spec_path = FastlaneFlutterFlavor::ProjectUtil.find_annai_test_spec_path(test_spec_file_input)
25
+
26
+ # Status Manager is required by IntegrationTest's constructor, though not strictly needed for open/close
27
+ status_manager = FastlaneFlutterFlavor::StatusManager.new(lane: self)
28
+
29
+ # 2. Instantiate IntegrationTest helper
30
+ integration_test = FastlaneFlutterFlavor::IntegrationTest.new(
31
+ lane: self,
32
+ isAndroid: platform == :android,
33
+ isIos: platform == :ios,
34
+ test_spec_file: resolved_test_spec_path,
35
+ statusManager: status_manager,
36
+ root_folder: root_folder
37
+ )
38
+
39
+ # 3. Call the openEmulators method
40
+ integration_test.openEmulators(
41
+ options: {
42
+ emulator: params[:emulator],
43
+ wipe_data: params[:wipe_data],
44
+ dns_server: params[:dns_server]
45
+ }
46
+ )
47
+
48
+ UI.success("✅ Emulator(s) started successfully for #{platform}.")
49
+ end
50
+
51
+ # ----------------------------------------------------
52
+ # Define Parameters
53
+ # ----------------------------------------------------
54
+ def self.available_options
55
+ [
56
+ FastlaneCore::ConfigItem.new(key: :platform,
57
+ description: "The platform (:ios or :android)",
58
+ is_string: false,
59
+ verify_block: proc do |value|
60
+ UI.user_error!("Platform must be :ios or :android") unless [:ios, :android].include?(value)
61
+ end),
62
+ FastlaneCore::ConfigItem.new(key: :test_spec_file,
63
+ description: "Path to the annai test spec configuration file (relative to flutter root). Defaults to standard discovery",
64
+ optional: true,
65
+ default_value: nil),
66
+
67
+ FastlaneCore::ConfigItem.new(key: :emulator,
68
+ description: "The specific emulator/device name (as defined in the test spec) to open. If nil, all defined emulators for the platform will be opened.",
69
+ optional: true,
70
+ type: String,
71
+ default_value: nil),
72
+ FastlaneCore::ConfigItem.new(key: :wipe_data,
73
+ description: "If true, wipes the emulator data before opening.",
74
+ type: Boolean,
75
+ default_value: true),
76
+ FastlaneCore::ConfigItem.new(key: :dns_server,
77
+ description: "Optional DNS server address for Android emulators (e.g., 8.8.8.8). Ignored for iOS.",
78
+ optional: true,
79
+ type: String,
80
+ default_value: "")
81
+ ].compact
82
+ end
83
+
84
+ def self.description
85
+ "Opens the specified emulators or all emulators defined in the Annai test spec file."
86
+ end
87
+
88
+ def self.is_supported?(platform)
89
+ [:ios, :android].include?(platform)
90
+ end
91
+
92
+ def self.example_code
93
+ 'annai_open_emulators(
94
+ platform: :android,
95
+ emulator: "Pixel_5_API_30",
96
+ wipe_data: true,
97
+ dns_server: "8.8.8.8"
98
+ )'
99
+ end
100
+ end
101
+
102
+ # ----------------------------------------------------
103
+ # AnnaiCloseEmulatorsAction
104
+ # ----------------------------------------------------
105
+ class AnnaiCloseEmulatorsAction < Action
106
+
107
+ def self.run(params)
108
+ platform = params[:platform]
109
+ UI.header("Starting Annai Close Emulators for #{platform}")
110
+
111
+ # 1. Determine the necessary paths and managers
112
+ root_folder = FastlaneFlutterFlavor::ProjectUtil.find_flutter_root
113
+
114
+ # Resolve the test spec file path
115
+ test_spec_file_input = params[:test_spec_file]
116
+ resolved_test_spec_path = FastlaneFlutterFlavor::ProjectUtil.find_annai_test_spec_path(test_spec_file_input)
117
+
118
+ # Status Manager is required by IntegrationTest's constructor
119
+ status_manager = FastlaneFlutterFlavor::StatusManager.new(lane: self)
120
+
121
+ # 2. Instantiate IntegrationTest helper
122
+ integration_test = FastlaneFlutterFlavor::IntegrationTest.new(
123
+ lane: self,
124
+ isAndroid: platform == :android,
125
+ isIos: platform == :ios,
126
+ test_spec_file: resolved_test_spec_path,
127
+ statusManager: status_manager,
128
+ root_folder: root_folder
129
+ )
130
+
131
+ # 3. Call the closeEmulators method
132
+ integration_test.closeEmulators(
133
+ options: {
134
+ emulator: params[:emulator]
135
+ }
136
+ )
137
+
138
+ UI.success("✅ Emulator(s) shut down successfully for #{platform}.")
139
+ end
140
+
141
+ # ----------------------------------------------------
142
+ # Define Parameters
143
+ # ----------------------------------------------------
144
+ def self.available_options
145
+ [
146
+ FastlaneCore::ConfigItem.new(key: :platform,
147
+ description: "The platform (:ios or :android)",
148
+ is_string: false,
149
+ verify_block: proc do |value|
150
+ UI.user_error!("Platform must be :ios or :android") unless [:ios, :android].include?(value)
151
+ end),
152
+ FastlaneCore::ConfigItem.new(key: :test_spec_file,
153
+ description: "Path to the annai test spec configuration file (relative to flutter root). Defaults to standard discovery",
154
+ optional: true,
155
+ default_value: nil),
156
+ FastlaneCore::ConfigItem.new(key: :emulator,
157
+ description: "The specific emulator/device name (as defined in the test spec) to close. If nil, all defined emulators for the platform will be closed.",
158
+ optional: true,
159
+ type: String,
160
+ default_value: nil)
161
+ ].compact
162
+ end
163
+
164
+ def self.description
165
+ "Closes the specified emulators or all emulators defined in the Annai test spec file."
166
+ end
167
+
168
+ def self.is_supported?(platform)
169
+ [:ios, :android].include?(platform)
170
+ end
171
+
172
+ def self.example_code
173
+ 'annai_close_emulators(
174
+ platform: :android,
175
+ emulator: "Pixel_5_API_30"
176
+ )'
177
+ end
178
+ end
179
+ end
180
+ end
@@ -0,0 +1,128 @@
1
+ require 'fastlane/action'
2
+
3
+ require 'fastlane/plugin/ann_flutter_flavor/helper/test_integration'
4
+ require 'fastlane/plugin/ann_flutter_flavor/helper/utils_status'
5
+ require 'fastlane/plugin/ann_flutter_flavor/helper/utils_project_config'
6
+
7
+
8
+ module Fastlane
9
+ module Actions
10
+ class AnnaiRunTestsAction < Action
11
+
12
+ def self.run(params)
13
+ platform = params[:platform]
14
+
15
+ # 1. Determine the necessary paths and managers
16
+ root_folder = FastlaneFlutterFlavor::ProjectUtil.find_flutter_root
17
+
18
+ # Resolve the test spec file path, respecting user input precedence:
19
+ # User Parameter > Environment Variable > Default Path
20
+ test_spec_file_input = params[:test_spec_file]
21
+ resolved_test_spec_path = FastlaneFlutterFlavor::ProjectUtil.find_annai_test_spec_path(test_spec_file_input)
22
+
23
+ # Status Manager is required by IntegrationTest's constructor, though not strictly needed for open/close
24
+ status_manager = FastlaneFlutterFlavor::StatusManager.new(lane: self)
25
+
26
+ # 2. Instantiate IntegrationTest directly
27
+ integration_test = FastlaneFlutterFlavor::IntegrationTest.new(
28
+ lane: self,
29
+ isAndroid: platform == :android,
30
+ isIos: platform == :ios,
31
+ test_spec_file: resolved_test_spec_path,
32
+ statusManager: status_manager,
33
+ root_folder: root_folder
34
+ )
35
+
36
+ UI.header("Running tests using IntegrationTest directly for #{platform}")
37
+
38
+ # 3. Call the runTests method
39
+ integration_test.runTests(
40
+ flavor: params[:flavor],
41
+ emulator: params[:emulator],
42
+ open_emulator: params[:open_emulator],
43
+ close_emulator: params[:close_emulator],
44
+ wipe_data: params[:wipe_data],
45
+ skip_screenshots: params[:skip_screenshots],
46
+ skip_sound_null_safety: params[:skip_sound_null_safety]
47
+ )
48
+
49
+ UI.success("✅ Test execution completed for #{platform}. Check logs for results.")
50
+
51
+ # 4. Finalize status reporting
52
+ status_manager.displayStatus
53
+ end
54
+
55
+ # ----------------------------------------------------
56
+ # Define Parameters
57
+ # ----------------------------------------------------
58
+ def self.available_options
59
+ [
60
+ FastlaneCore::ConfigItem.new(key: :platform,
61
+ description: "The platform (:ios or :android)",
62
+ is_string: false,
63
+ verify_block: proc do |value|
64
+ UI.user_error!("Platform must be :ios or :android") unless [:ios, :android].include?(value)
65
+ end),
66
+ FastlaneCore::ConfigItem.new(key: :test_spec_file,
67
+ description: "Path to the annai test spec configuration file (relative to flutter root). Defaults to standard discovery",
68
+ optional: true,
69
+ default_value: nil),
70
+
71
+ # --- Filtering Options (Matches IntegrationTest logic) ---
72
+ FastlaneCore::ConfigItem.new(key: :flavor,
73
+ description: "The flavor(s) to run tests against (comma-separated list, e.g., 'free,pro'). If nil, all flavors are tested",
74
+ optional: true,
75
+ type: String,
76
+ default_value: nil),
77
+ FastlaneCore::ConfigItem.new(key: :emulator,
78
+ description: "The specific emulator/device name (as defined in the test spec) to run tests on. If nil, tests run on all defined emulators for the given flavor(s)",
79
+ optional: true,
80
+ type: String,
81
+ default_value: nil),
82
+
83
+ # --- Emulator Control ---
84
+ FastlaneCore::ConfigItem.new(key: :open_emulator,
85
+ description: "If true, opens the target emulator before running tests",
86
+ type: Boolean,
87
+ default_value: true),
88
+ FastlaneCore::ConfigItem.new(key: :close_emulator,
89
+ description: "If true, closes the target emulator after running tests",
90
+ type: Boolean,
91
+ default_value: true),
92
+ FastlaneCore::ConfigItem.new(key: :wipe_data,
93
+ description: "If true, wipes the emulator data before opening",
94
+ type: Boolean,
95
+ default_value: true),
96
+
97
+ # --- Test Execution Control ---
98
+ FastlaneCore::ConfigItem.new(key: :skip_screenshots,
99
+ description: "If true, uses 'flutter test' instead of 'flutter drive' (skips screenshots). Overrides the spec file setting",
100
+ type: Boolean,
101
+ default_value: false),
102
+ FastlaneCore::ConfigItem.new(key: :skip_sound_null_safety,
103
+ description: "If true, adds --no-sound-null-safety flag to the flutter command",
104
+ type: Boolean,
105
+ default_value: false)
106
+ ].compact
107
+ end
108
+
109
+ def self.description
110
+ "Runs specified integration tests on target devices using configurations defined within the Annai test spec file"
111
+ end
112
+
113
+ def self.is_supported?(platform)
114
+ [:ios, :android].include?(platform)
115
+ end
116
+
117
+ def self.example_code
118
+ 'ann_run_tests(
119
+ platform: :android,
120
+ test_spec_file: "../config/my_custom_specs.yaml" # Custom path
121
+ emulator: "Pixel_5_API_30",
122
+ flavor: "development",
123
+ skip_screenshots: false
124
+ )'
125
+ end
126
+ end
127
+ end
128
+ end
@@ -0,0 +1,137 @@
1
+ require 'fastlane/action'
2
+
3
+ require 'fastlane/plugin/ann_flutter_flavor/helper/utils_status'
4
+ require 'fastlane/plugin/ann_flutter_flavor/helper/utils_project_config'
5
+ require 'fastlane/plugin/ann_flutter_flavor/helper/lanes_setup'
6
+
7
+
8
+ module Fastlane
9
+ module Actions
10
+ # =========================================================================
11
+ # AnnaiUpgradeSetupAction: Runs comprehensive setup and maintenance
12
+ # =========================================================================
13
+
14
+ class AnnaiUpgradeSetupAction < Action
15
+ def self.run(params)
16
+
17
+ # 1. Determine the necessary paths and managers
18
+ root_folder = FastlaneFlutterFlavor::ProjectUtil.find_flutter_root
19
+ status_manager = FastlaneFlutterFlavor::StatusManager.new(lane: self)
20
+
21
+ # 2. Instantiate SetupLanes directly
22
+ setup_lanes = FastlaneFlutterFlavor::SetupLanes.new(
23
+ root_folder: root_folder,
24
+ status_manager: status_manager,
25
+ )
26
+
27
+ Fastlane::UI.message("Starting comprehensive setup and maintenance (Force: #{params[:force]})...")
28
+
29
+ # 3. Execute the maintenance routine
30
+ setup_lanes.upgrade_setup(force: params[:force])
31
+
32
+ Fastlane::UI.success("✅ Upgrade setup completed successfully.")
33
+
34
+ # 4. Finalize status reporting
35
+ status_manager.displayStatus
36
+ rescue => e
37
+ # Log the error using the StatusManager instance
38
+ if status_manager
39
+ # Pass 'self' (the class) as the lane context for consistency
40
+ status_manager.logError(self, 'annai_upgrade_setup', nil, e)
41
+ status_manager.displayStatus
42
+ end
43
+
44
+ raise "AnnaiUpgradeSetupAction failed: #{e.message}"
45
+ end
46
+
47
+ def self.available_options
48
+ [
49
+ FastlaneCore::ConfigItem.new(key: :force,
50
+ description: "Force the execution even if conditions might advise skipping",
51
+ optional: true,
52
+ is_string: false,
53
+ default_value: false,
54
+ type: Boolean)
55
+ ]
56
+ end
57
+
58
+ def self.description
59
+ "Runs comprehensive Flutter and Fastlane maintenance (upgrade, doctor, bundle update, gem install)."
60
+ end
61
+
62
+ def self.is_supported?(platform)
63
+ true
64
+ end
65
+
66
+ def self.example_code
67
+ [
68
+ 'annai_upgrade_setup',
69
+ 'annai_upgrade_setup(force: true)'
70
+ ]
71
+ end
72
+ end
73
+
74
+ # =========================================================================
75
+ # AnnaiCleanupAction: Cleans up all local build artifacts
76
+ # =========================================================================
77
+
78
+ class AnnaiCleanupAction < Action
79
+ def self.run(params)
80
+
81
+ # 1. Determine the necessary paths and managers
82
+ root_folder = FastlaneFlutterFlavor::ProjectUtil.find_flutter_root
83
+ status_manager = FastlaneFlutterFlavor::StatusManager.new(lane: self)
84
+
85
+ # 2. Instantiate SetupLanes directly
86
+ setup_lanes = FastlaneFlutterFlavor::SetupLanes.new(
87
+ root_folder: root_folder,
88
+ status_manager: status_manager,
89
+ )
90
+
91
+ Fastlane::UI.message("Starting full build artifact cleanup (Force: #{params[:force]})...")
92
+
93
+ # 3. Execute the cleanup routine
94
+ setup_lanes.cleanup(force: params[:force])
95
+
96
+ Fastlane::UI.success("✅ Build artifact cleanup completed successfully.")
97
+
98
+ # 4. Finalize status reporting
99
+ status_manager.displayStatus
100
+ rescue => e
101
+ # Log the error using the StatusManager instance
102
+ if status_manager
103
+ # Pass 'self' (the class) as the lane context for consistency
104
+ status_manager.logError(self, 'annai_cleanup', nil, e)
105
+ status_manager.displayStatus
106
+ end
107
+ raise "AnnaiCleanupAction failed: #{e.message}"
108
+ end
109
+
110
+ def self.available_options
111
+ [
112
+ FastlaneCore::ConfigItem.new(key: :force,
113
+ description: "Force the execution even if conditions might advise skipping",
114
+ optional: true,
115
+ is_string: false,
116
+ default_value: false,
117
+ type: Boolean)
118
+ ]
119
+ end
120
+
121
+ def self.description
122
+ "Performs full build artifact cleanup (runs 'flutter clean' and deletes platform build folders)."
123
+ end
124
+
125
+ def self.is_supported?(platform)
126
+ true
127
+ end
128
+
129
+ def self.example_code
130
+ [
131
+ 'annai_cleanup',
132
+ 'annai_cleanup(force: true)',
133
+ ]
134
+ end
135
+ end
136
+ end
137
+ end