fastlane-plugin-android_reporter 0.1.26 → 0.1.32

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c059ee4f3626268d8617182545651e1e7e5270133ded4cf6b3a8b5dd6af723ee
4
- data.tar.gz: 13bc41c24a457d4054606ae6395b26ae6cb21463db174d26b2f5b15de8730fab
3
+ metadata.gz: aa4c112132e19fc087698f039596300a3e7b97685bd21d6e65d40379b3836038
4
+ data.tar.gz: c894f5b0b1a8529f02d6ee72ca8d86924e322cd558b0806e00dca22dde6c79a4
5
5
  SHA512:
6
- metadata.gz: 62794d67b80f271062b6b3a70b27faceaf9a3ffbb94d1186716547b463d0d93f13f9e96587e5d88f027ea146398f18e2ecdb48149e594ccfb57b1de849b17e19
7
- data.tar.gz: 660359ef5a840729be5c2d82b31a08ae4d646b4501f5fa34ffc230c6526a4afcd3412c2134ba346c3b22c4d5b896ecc30c91b0dec92a2c036e58cd15d783b39f
6
+ metadata.gz: 9439f2b5d02ea710ab2b316630b3db64371c243a78ca0ed21e6ed3dd051c571e2bdbf14a3ea5e15ee2d4f285b2a8edc1a6ba9fc9ad760ca8e2da6f19ce0512f9
7
+ data.tar.gz: dcac33262aebd91396cbf7fca6e2c15f61a1bcb89f0bf520d4102a767e20b6edf61fca14b8bb1df15aefb59c63b3cde0fdfb1e13f3995452f5059d66644bd441
@@ -24,35 +24,9 @@ module Fastlane
24
24
  isLogcatFileUploaded = false
25
25
  isGradleDebugFileUploaded = false
26
26
  isGradleErrorFileUploaded = false
27
+ buildName = "Current Build"
27
28
 
28
- # 1. Delete Previus Generated Files
29
- if params[:is_delete_prev_files_enabled]
30
- begin
31
- File.open('logcat.txt', 'r') do |f|
32
- File.delete(f)
33
- end
34
- rescue Errno::ENOENT
35
- UI.message("Something Wrong When Delete Previus File [logcat.txt]")
36
- end
37
-
38
- begin
39
- File.open('android-logs.txt', 'r') do |f|
40
- File.delete(f)
41
- end
42
- rescue Errno::ENOENT
43
- UI.message("Something Wrong When Delete Previus File [android-logs.txt]")
44
- end
45
-
46
- begin
47
- File.open('android-error-logs.txt', 'r') do |f|
48
- File.delete(f)
49
- end
50
- rescue Errno::ENOENT
51
- UI.message("Something Wrong When Delete Previus File [android-error-logs.txt]")
52
- end
53
- end
54
-
55
- # 0. Checkout git to Current Branch to Run Tests on the Current Branch
29
+ # 1. Checkout git to Current Branch to Run Tests on the Current Branch
56
30
  if params[:tests_branch_name].to_s.length > 0
57
31
  begin
58
32
  sh("git fetch")
@@ -62,7 +36,27 @@ module Fastlane
62
36
  end
63
37
  end
64
38
 
65
- # 1. Send Slack Message from Android Reporter Bot That Testing Task Has been Started ....
39
+ # 2. Get Build Version From Gradle.Props File
40
+ if params[:version_name_line_number].to_s.length > 0
41
+ UI.message("Step Read Version Name of the Build")
42
+ line_num = params[:version_name_line_number].to_i
43
+ text=File.open('gradle.properties').read
44
+ text.gsub!(/\r\n?/, "\n")
45
+ text.each_line.with_index do |line, index|
46
+ if (index + 1) == line_num
47
+ buildName = line
48
+ end
49
+ end
50
+ end
51
+
52
+ # 3. Split The String and Get the Value Without Key
53
+ if params[:version_name_line_number].to_s.length > 0
54
+ buildName = buildName.split('=', -1)
55
+ buildName = buildName[1]
56
+ UI.message("Current Build Name : " + buildName)
57
+ end
58
+
59
+ # 4. Send Slack Message from Android Reporter Bot That Testing Task Has been Started ....
66
60
  if is_slack_enabled
67
61
  UI.message("Slack Messages Bot Started .... [Configuration Step]")
68
62
  Slack.configure do |config|
@@ -75,6 +69,7 @@ module Fastlane
75
69
  text: " ================================================================================== \n" +
76
70
  " New UI Testing Task Started For Current Release : " + time + " \n " +
77
71
  " Current Branch Build : " + sh("git rev-parse --abbrev-ref HEAD") +
72
+ " Current Build Version : " + buildName +
78
73
  " ================================================================================== \n",
79
74
  as_user: true
80
75
  )
@@ -86,22 +81,26 @@ module Fastlane
86
81
  end
87
82
  end
88
83
 
89
- # 2. List All Available AVD's in The Device
90
- # 3. Run the Target AVD Name From Params
84
+ # 5. List All Available AVD's in The Device
85
+ # 6. Run the Target AVD Name From Params
91
86
  if params[:avd_name].to_s.length > 0
92
- UI.message("Android Reporting Started to Run AVD : (" + avd_name + ")")
93
- sh(android_sdk_path + "/tools/bin/avdmanager", "list", "avd", " -read-only")
94
- sh("cd", android_sdk_path)
95
- sh(android_sdk_path + "/emulator/emulator", "-avd", avd_name)
87
+ Thread.new do
88
+ UI.message("Android Reporting Started to Run AVD : (" + avd_name + ")")
89
+ sh(android_sdk_path + "/tools/bin/avdmanager", "list", "avd")
90
+ sh("cd", android_sdk_path)
91
+ sh(android_sdk_path + "/emulator/emulator", "-avd", avd_name)
92
+ end
96
93
  end
97
94
 
98
- # 4. Clear the Logcat Server Before Start
95
+ # 7. Clear the Logcat Server Before Start
99
96
  if params[:generate_adb_file]
100
- sh("adb logcat -c")
97
+ Process.fork do
98
+ sh("adb logcat -c")
99
+ end
101
100
  end
102
101
 
103
- # 5. Start Clean Task with Target UI Task
104
- # 6. If Gradle Task Success then Will Generate ADB Log File then Kill Server Connection inside ADB
102
+ # 8. Start Clean Task with Target UI Task
103
+ # 9. If Gradle Task Success then Will Generate ADB Log File then Kill Server Connection inside ADB
105
104
  begin
106
105
  UI.message([
107
106
  "Android Reporting Started to Run Gradle Testing Task ...",
@@ -118,17 +117,7 @@ module Fastlane
118
117
  "Android Reporter Started to Save Logcat Logs From ADB Connection Server",
119
118
  "ADB Reporting File : [logcat.txt]"
120
119
  ])
121
-
122
- begin
123
- sh("adb logcat -d > logcat.txt kill-server")
124
- sh("adb kill-server")
125
- rescue => error
126
- if error
127
- UI.error("Something Error with Logcat Debug Report File")
128
- end
129
- puts error.message
130
- puts error.backtrace
131
- end
120
+ sh("adb logcat -d > logcat.txt kill-server")
132
121
  end
133
122
  end
134
123
  end
@@ -136,47 +125,32 @@ module Fastlane
136
125
  rescue
137
126
  UI.error("Gradle Task Finished With Error ...")
138
127
  if params[:generate_adb_file]
139
- begin
140
- sh("adb logcat -e > logcat.txt kill-server")
141
- rescue => error
142
- if error
143
- UI.error("Something Error with Logcat Error Report File")
144
- end
145
- puts error.message
146
- puts error.backtrace
128
+ Process.fork do
129
+ sh("adb logcat -e > logcat.txt kill-server")
147
130
  end
148
131
  end
149
132
  end
150
133
 
151
- # 7. Generate Gradle Tasks (Failed and Success Files)
134
+ # 10. Generate Gradle Tasks (Failed and Success Files)
152
135
  if params[:generate_gradle_files]
153
- UI.message([
154
- "Android Reporting Started to Generate Gradle Reports Files",
155
- "Gradle Success Debug File : android-logs.txt",
156
- "Gradle Failed Debug File : android-error-logs.txt"
157
- ])
158
-
159
- begin
160
- sh("./gradlew build > android-logs.txt 2> android-error-logs.txt -Dhttp.socketTimeout=60000 -Dhttp.connectionTimeout=60000 -Dorg.gradle.daemon.idletimeout=60000")
161
- sh("./gradlew --stop")
162
- rescue => error
163
- if error
164
- UI.error("Something Error with Generate Gradle Files")
165
- end
166
- puts error.message
167
- puts error.backtrace
136
+ Process.fork do
137
+ sh("./gradlew build > android-logs.txt 2> android-error-logs.txt")
138
+ UI.message([
139
+ "Android Reporting Started to Generate Gradle Reports Files",
140
+ "Gradle Success Debug File : android-logs.txt",
141
+ "Gradle Failed Debug File : android-error-logs.txt"
142
+ ])
168
143
  end
169
144
  end
170
145
 
171
- # 8. Check Slack Option if Enabled or Not To Print The Message
146
+ # 11. Check Slack Option if Enabled or Not To Print The Message
172
147
  if is_slack_enabled
173
148
  UI.message("Slack Configuration Status : Started ...")
174
149
  else
175
150
  UI.message("Slack Configuration Status : Disabled ...")
176
151
  end
177
152
 
178
- sleep(60000)
179
- # 9. Upload Files to Slack
153
+ # 12. Upload Files to Slack
180
154
  if is_slack_enabled
181
155
  begin
182
156
  UI.message("Slack Messages Bot Upload Files Tasks Started ....")
@@ -258,7 +232,8 @@ module Fastlane
258
232
  puts error.backtrace
259
233
  end
260
234
 
261
- slackFinalMessageContent = "Files Status : With Time : " + time + " : Info = \n"
235
+ # 13. Send Message With Files Summery
236
+ slackFinalMessageContent = "Files Status : With Time : " + time + " : \n"
262
237
  if isGradleDebugFileUploaded
263
238
  slackFinalMessageContent += "Gradle Debug File Uploaded \n"
264
239
  end
@@ -272,6 +247,16 @@ module Fastlane
272
247
  end
273
248
 
274
249
  client.chat_postMessage(channel: "#" + params[:slack_channel_name], text: slackFinalMessageContent, as_user: true)
250
+
251
+ # 14. If the Gradle Task Success Then Run Specific Lane Else Send Slack Message The Build Failed
252
+ if gradle_task_result
253
+ if params[:target_lane_name].to_s.length > 0
254
+ sh("fastlane", params[:target_lane_name])
255
+ end
256
+ else
257
+ UI.message("Gradle Task Result Failed ...")
258
+ client.chat_postMessage(channel: "#" + params[:slack_channel_name], text: "Gradle Testing Task Failed Logs File Should be Uploaded", as_user: true)
259
+ end
275
260
  end
276
261
 
277
262
  end
@@ -340,13 +325,6 @@ module Fastlane
340
325
  optional: true,
341
326
  type: Boolean
342
327
  ),
343
- FastlaneCore::ConfigItem.new(
344
- key: :is_delete_prev_files_enabled,
345
- env_name: "ANDROID_GENERATED_PREV_FILES_ENABLED",
346
- description: "",
347
- optional: true,
348
- type: Boolean
349
- ),
350
328
  FastlaneCore::ConfigItem.new(
351
329
  key: :slack_api_key,
352
330
  env_name: "SLACK_API_TOKEN",
@@ -370,6 +348,22 @@ module Fastlane
370
348
  optional: true,
371
349
  type: String,
372
350
  sensitive: true
351
+ ),
352
+ FastlaneCore::ConfigItem.new(
353
+ key: :target_lane_name,
354
+ env_name: "TARGET_LANE_NAME",
355
+ description: "Target Lane Name To Execute Once Tests Task Successfully Built",
356
+ optional: true,
357
+ type: String,
358
+ sensitive: true
359
+ ),
360
+ FastlaneCore::ConfigItem.new(
361
+ key: :version_name_line_number,
362
+ env_name: "VERSION_NAME_LINE_NUMBER",
363
+ description: "Target Lane Name To Execute Once Tests Task Successfully Built",
364
+ optional: true,
365
+ type: String,
366
+ sensitive: true
373
367
  )
374
368
  ]
375
369
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module AndroidReporter
3
- VERSION = "0.1.26"
3
+ VERSION = "0.1.32"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-android_reporter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.26
4
+ version: 0.1.32
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yazan Tarifi