@agrid/agrid-react-native 4.12.11

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 (151) hide show
  1. package/README.md +691 -0
  2. package/dist/AgridContext.d.ts +5 -0
  3. package/dist/AgridContext.js +1 -0
  4. package/dist/AgridContext.js.map +1 -0
  5. package/dist/AgridProvider.d.ts +86 -0
  6. package/dist/AgridProvider.js +1 -0
  7. package/dist/AgridProvider.js.map +1 -0
  8. package/dist/agrid-rn.d.ts +612 -0
  9. package/dist/agrid-rn.js +1 -0
  10. package/dist/agrid-rn.js.map +1 -0
  11. package/dist/autocapture.d.ts +4 -0
  12. package/dist/autocapture.js +1 -0
  13. package/dist/autocapture.js.map +1 -0
  14. package/dist/error-tracking/index.d.ts +27 -0
  15. package/dist/error-tracking/index.js +1 -0
  16. package/dist/error-tracking/index.js.map +1 -0
  17. package/dist/error-tracking/utils.d.ts +5 -0
  18. package/dist/error-tracking/utils.js +1 -0
  19. package/dist/error-tracking/utils.js.map +1 -0
  20. package/dist/frameworks/wix-navigation.d.ts +3 -0
  21. package/dist/frameworks/wix-navigation.js +1 -0
  22. package/dist/frameworks/wix-navigation.js.map +1 -0
  23. package/dist/hooks/useAgrid.d.ts +2 -0
  24. package/dist/hooks/useAgrid.js +1 -0
  25. package/dist/hooks/useAgrid.js.map +1 -0
  26. package/dist/hooks/useFeatureFlag.d.ts +5 -0
  27. package/dist/hooks/useFeatureFlag.js +1 -0
  28. package/dist/hooks/useFeatureFlag.js.map +1 -0
  29. package/dist/hooks/useFeatureFlags.d.ts +3 -0
  30. package/dist/hooks/useFeatureFlags.js +1 -0
  31. package/dist/hooks/useFeatureFlags.js.map +1 -0
  32. package/dist/hooks/useNavigationTracker.d.ts +6 -0
  33. package/dist/hooks/useNavigationTracker.js +1 -0
  34. package/dist/hooks/useNavigationTracker.js.map +1 -0
  35. package/dist/index.d.ts +10 -0
  36. package/dist/index.js +1 -0
  37. package/dist/index.js.map +1 -0
  38. package/dist/native-deps.d.ts +4 -0
  39. package/dist/native-deps.js +1 -0
  40. package/dist/native-deps.js.map +1 -0
  41. package/dist/optional/OptionalAsyncStorage.d.ts +2 -0
  42. package/dist/optional/OptionalAsyncStorage.js +1 -0
  43. package/dist/optional/OptionalAsyncStorage.js.map +1 -0
  44. package/dist/optional/OptionalExpoApplication.d.ts +2 -0
  45. package/dist/optional/OptionalExpoApplication.js +1 -0
  46. package/dist/optional/OptionalExpoApplication.js.map +1 -0
  47. package/dist/optional/OptionalExpoDevice.d.ts +2 -0
  48. package/dist/optional/OptionalExpoDevice.js +1 -0
  49. package/dist/optional/OptionalExpoDevice.js.map +1 -0
  50. package/dist/optional/OptionalExpoFileSystem.d.ts +2 -0
  51. package/dist/optional/OptionalExpoFileSystem.js +1 -0
  52. package/dist/optional/OptionalExpoFileSystem.js.map +1 -0
  53. package/dist/optional/OptionalExpoFileSystemLegacy.d.ts +2 -0
  54. package/dist/optional/OptionalExpoFileSystemLegacy.js +1 -0
  55. package/dist/optional/OptionalExpoFileSystemLegacy.js.map +1 -0
  56. package/dist/optional/OptionalExpoLocalization.d.ts +2 -0
  57. package/dist/optional/OptionalExpoLocalization.js +1 -0
  58. package/dist/optional/OptionalExpoLocalization.js.map +1 -0
  59. package/dist/optional/OptionalReactNativeDeviceInfo.d.ts +2 -0
  60. package/dist/optional/OptionalReactNativeDeviceInfo.js +1 -0
  61. package/dist/optional/OptionalReactNativeDeviceInfo.js.map +1 -0
  62. package/dist/optional/OptionalReactNativeLocalize.d.ts +13 -0
  63. package/dist/optional/OptionalReactNativeLocalize.js +1 -0
  64. package/dist/optional/OptionalReactNativeLocalize.js.map +1 -0
  65. package/dist/optional/OptionalReactNativeNavigation.d.ts +2 -0
  66. package/dist/optional/OptionalReactNativeNavigation.js +1 -0
  67. package/dist/optional/OptionalReactNativeNavigation.js.map +1 -0
  68. package/dist/optional/OptionalReactNativeNavigationWix.d.ts +2 -0
  69. package/dist/optional/OptionalReactNativeNavigationWix.js +1 -0
  70. package/dist/optional/OptionalReactNativeNavigationWix.js.map +1 -0
  71. package/dist/optional/OptionalReactNativeSafeArea.d.ts +2 -0
  72. package/dist/optional/OptionalReactNativeSafeArea.js +1 -0
  73. package/dist/optional/OptionalReactNativeSafeArea.js.map +1 -0
  74. package/dist/optional/OptionalSessionReplay.d.ts +2 -0
  75. package/dist/optional/OptionalSessionReplay.js +1 -0
  76. package/dist/optional/OptionalSessionReplay.js.map +1 -0
  77. package/dist/storage.d.ts +21 -0
  78. package/dist/storage.js +1 -0
  79. package/dist/storage.js.map +1 -0
  80. package/dist/surveys/AgridSurveyProvider.d.ts +16 -0
  81. package/dist/surveys/AgridSurveyProvider.js +1 -0
  82. package/dist/surveys/AgridSurveyProvider.js.map +1 -0
  83. package/dist/surveys/components/BottomSection.d.ts +8 -0
  84. package/dist/surveys/components/BottomSection.js +1 -0
  85. package/dist/surveys/components/BottomSection.js.map +1 -0
  86. package/dist/surveys/components/Cancel.d.ts +5 -0
  87. package/dist/surveys/components/Cancel.js +1 -0
  88. package/dist/surveys/components/Cancel.js.map +1 -0
  89. package/dist/surveys/components/ConfirmationMessage.d.ts +12 -0
  90. package/dist/surveys/components/ConfirmationMessage.js +1 -0
  91. package/dist/surveys/components/ConfirmationMessage.js.map +1 -0
  92. package/dist/surveys/components/QuestionHeader.d.ts +6 -0
  93. package/dist/surveys/components/QuestionHeader.js +1 -0
  94. package/dist/surveys/components/QuestionHeader.js.map +1 -0
  95. package/dist/surveys/components/QuestionTypes.d.ts +26 -0
  96. package/dist/surveys/components/QuestionTypes.js +1 -0
  97. package/dist/surveys/components/QuestionTypes.js.map +1 -0
  98. package/dist/surveys/components/SurveyModal.d.ts +9 -0
  99. package/dist/surveys/components/SurveyModal.js +1 -0
  100. package/dist/surveys/components/SurveyModal.js.map +1 -0
  101. package/dist/surveys/components/Surveys.d.ts +13 -0
  102. package/dist/surveys/components/Surveys.js +1 -0
  103. package/dist/surveys/components/Surveys.js.map +1 -0
  104. package/dist/surveys/getActiveMatchingSurveys.d.ts +2 -0
  105. package/dist/surveys/getActiveMatchingSurveys.js +1 -0
  106. package/dist/surveys/getActiveMatchingSurveys.js.map +1 -0
  107. package/dist/surveys/icons.d.ts +8 -0
  108. package/dist/surveys/icons.js +1 -0
  109. package/dist/surveys/icons.js.map +1 -0
  110. package/dist/surveys/index.d.ts +6 -0
  111. package/dist/surveys/index.js +1 -0
  112. package/dist/surveys/index.js.map +1 -0
  113. package/dist/surveys/surveys-utils.d.ts +30 -0
  114. package/dist/surveys/surveys-utils.js +1 -0
  115. package/dist/surveys/surveys-utils.js.map +1 -0
  116. package/dist/surveys/useActivatedSurveys.d.ts +3 -0
  117. package/dist/surveys/useActivatedSurveys.js +1 -0
  118. package/dist/surveys/useActivatedSurveys.js.map +1 -0
  119. package/dist/surveys/useSurveyStorage.d.ts +8 -0
  120. package/dist/surveys/useSurveyStorage.js +1 -0
  121. package/dist/surveys/useSurveyStorage.js.map +1 -0
  122. package/dist/tooling/agridMetroSerializer.d.ts +17 -0
  123. package/dist/tooling/agridMetroSerializer.js +1 -0
  124. package/dist/tooling/agridMetroSerializer.js.map +1 -0
  125. package/dist/tooling/metroconfig.d.ts +15 -0
  126. package/dist/tooling/metroconfig.js +1 -0
  127. package/dist/tooling/metroconfig.js.map +1 -0
  128. package/dist/tooling/utils.d.ts +58 -0
  129. package/dist/tooling/utils.js +1 -0
  130. package/dist/tooling/utils.js.map +1 -0
  131. package/dist/tooling/vendor/expo/expoconfig.d.ts +23 -0
  132. package/dist/tooling/vendor/expo/expoconfig.js +1 -0
  133. package/dist/tooling/vendor/expo/expoconfig.js.map +1 -0
  134. package/dist/tooling/vendor/metro/countLines.d.ts +2 -0
  135. package/dist/tooling/vendor/metro/countLines.js +1 -0
  136. package/dist/tooling/vendor/metro/countLines.js.map +1 -0
  137. package/dist/tooling/vendor/metro/utils.d.ts +22 -0
  138. package/dist/tooling/vendor/metro/utils.js +1 -0
  139. package/dist/tooling/vendor/metro/utils.js.map +1 -0
  140. package/dist/types.d.ts +150 -0
  141. package/dist/types.js +1 -0
  142. package/dist/types.js.map +1 -0
  143. package/dist/utils.d.ts +20 -0
  144. package/dist/utils.js +1 -0
  145. package/dist/utils.js.map +1 -0
  146. package/dist/version.d.ts +1 -0
  147. package/dist/version.js +1 -0
  148. package/dist/version.js.map +1 -0
  149. package/package.json +134 -0
  150. package/tooling/agrid-xcode.sh +111 -0
  151. package/tooling/agrid.gradle +312 -0
@@ -0,0 +1,312 @@
1
+ // adapted from https://github.com/getsentry/sentry-react-native/blob/e76d0d388228437e82f235546de00f4e748fcbda/packages/core/sentry.gradle
2
+
3
+ import org.apache.tools.ant.taskdefs.condition.Os
4
+
5
+ import java.util.regex.Matcher
6
+ import java.util.regex.Pattern
7
+
8
+ interface InjectedExecOps {
9
+ @Inject //@javax.inject.Inject
10
+ ExecOperations getExecOps()
11
+ }
12
+
13
+ plugins.withId('com.android.application') {
14
+ def androidComponents = extensions.getByName("androidComponents")
15
+
16
+ androidComponents.onVariants(androidComponents.selector().all()) { v ->
17
+ if (!v.name.toLowerCase().contains("debug")) {
18
+ // separately we then hook into the bundle task of react native to inject
19
+ // sourcemap generation parameters. In case for whatever reason no release
20
+ // was found for the asset folder we just bail.
21
+ def bundleTasks = tasks.findAll { task -> (task.name.startsWith("createBundle") || task.name.startsWith("bundle")) && task.name.endsWith("JsAndAssets") && !task.name.contains("Debug") && task.enabled }
22
+ // this is the task that calls react-native bundle {params}
23
+ bundleTasks.each { bundleTask ->
24
+ def shouldCleanUp
25
+ def sourcemapOutput
26
+ def bundleOutput
27
+ def packagerSourcemapOutput
28
+ def bundleCommand
29
+ def props = bundleTask.getProperties()
30
+ def reactRoot = props.get("workingDir")
31
+ if (reactRoot == null) {
32
+ reactRoot = props.get("root").get() // RN 0.71 and above
33
+ }
34
+
35
+ (shouldCleanUp, bundleOutput, sourcemapOutput, packagerSourcemapOutput, bundleCommand) = forceSourceMapOutputFromBundleTask(bundleTask)
36
+
37
+ // Lets leave this here if we need to debug
38
+ // println bundleTask.properties
39
+ // .sort{it.key}
40
+ // .collect{it}
41
+ // .findAll{!['class', 'active'].contains(it.key)}
42
+ // .join('\n')
43
+
44
+ def currentVariants = extractCurrentVariants(bundleTask, v)
45
+ if (currentVariants == null) return
46
+
47
+ def previousCliTask = null
48
+ def applicationVariant = null
49
+
50
+ def nameCleanup = "${bundleTask.name}_AgridUploadCleanUp"
51
+ // Upload the source map several times if necessary: once for each release and versionCode.
52
+ currentVariants.each { key, currentVariant ->
53
+ def variant = currentVariant[0]
54
+ def releaseName = currentVariant[1]
55
+ def versionCode = currentVariant[2]
56
+ applicationVariant = currentVariant[3]
57
+
58
+ try {
59
+ if (versionCode instanceof String) {
60
+ versionCode = Integer.parseInt(versionCode)
61
+ versionCode = Math.abs(versionCode)
62
+ }
63
+ } catch (NumberFormatException e) {
64
+ project.logger.info("versionCode: '$versionCode' isn't an Integer, using the plain value.")
65
+ }
66
+
67
+ def nameCliTask = "${bundleTask.name}_AgridUpload_${releaseName}_${versionCode}"
68
+
69
+ // If several outputs have the same releaseName and versionCode, we'd do the exact same
70
+ // upload for each of them. No need to repeat.
71
+ try { tasks.named(nameCliTask); return } catch (Exception e) {}
72
+
73
+ /** Upload source map file to the Agrid server via CLI call. */
74
+ def cliTask = tasks.register(nameCliTask) {
75
+ description = "upload sourcemaps to Agrid"
76
+ group = 'agrid'
77
+
78
+ def extraArgs = []
79
+
80
+ def injected = project.objects.newInstance(InjectedExecOps)
81
+ doFirst {
82
+ injected.execOps.exec {
83
+ workingDir reactRoot
84
+
85
+ def cliPackage = "agrid-cli"
86
+ def args = [cliPackage]
87
+
88
+ args.addAll(["exp", "hermes", "clone",
89
+ "--minified-map-path", packagerSourcemapOutput, // The path to a sourcemap
90
+ "--composed-map-path", sourcemapOutput // The path of the composed source map
91
+ ])
92
+
93
+ args.addAll(extraArgs)
94
+
95
+ project.logger.info("agrid-cli clone arguments: ${args}")
96
+ def osCompatibility = Os.isFamily(Os.FAMILY_WINDOWS) ? ['cmd', '/c', 'node'] : []
97
+
98
+ commandLine(*osCompatibility, *args)
99
+ }
100
+ }
101
+
102
+ doLast {
103
+ injected.execOps.exec {
104
+ workingDir reactRoot
105
+
106
+ def cliPackage = "agrid-cli"
107
+ def args = [cliPackage]
108
+
109
+ def sourcemapDir = sourcemapOutput.getParent()
110
+ args.addAll(["exp", "hermes", "upload",
111
+ "--directory", sourcemapDir // The path to a sourcemap that should be uploaded.
112
+ ])
113
+
114
+ args.addAll(extraArgs)
115
+
116
+ project.logger.info("agrid-cli upload arguments: ${args}")
117
+ def osCompatibility = Os.isFamily(Os.FAMILY_WINDOWS) ? ['cmd', '/c', 'node'] : []
118
+
119
+ commandLine(*osCompatibility, *args)
120
+ }
121
+ }
122
+
123
+ enabled true
124
+ }
125
+
126
+ // chain the upload tasks so they run sequentially in order to run
127
+ // the cliCleanUpTask after the final upload task is run
128
+ if (previousCliTask != null) {
129
+ previousCliTask.configure { finalizedBy cliTask }
130
+ } else {
131
+ bundleTask.configure { finalizedBy cliTask }
132
+ }
133
+ previousCliTask = cliTask
134
+ }
135
+
136
+ /** Delete sourcemap files */
137
+ def cliCleanUpTask = tasks.register(nameCleanup, Delete) {
138
+ description = "clean up extra sourcemap"
139
+ group = 'agrid'
140
+
141
+ delete sourcemapOutput
142
+ delete "$buildDir/intermediates/assets/release/index.android.bundle.map"
143
+ // react native default bundle dir
144
+ }
145
+
146
+ // register clean task extension
147
+ cliCleanUpTask.configure { onlyIf { shouldCleanUp } }
148
+ // due to chaining the last value of previousCliTask will be the final
149
+ // upload task, after which the cleanup can be done
150
+ previousCliTask.configure { finalizedBy cliCleanUpTask }
151
+
152
+ def packageTasks = tasks.matching {
153
+ task -> ("package${applicationVariant}".equalsIgnoreCase(task.name) || "package${applicationVariant}Bundle".equalsIgnoreCase(task.name)) && task.enabled
154
+ }
155
+ }
156
+ }
157
+ }
158
+ }
159
+
160
+ def resolveAgridReactNativeSDKPath(reactRoot) {
161
+ def resolvedPath = null
162
+ try {
163
+ resolvedPath = new File(["node", "--print", "require.resolve('agrid-react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile();
164
+ } catch (Throwable ignored) {} // if the resolve fails we fallback to the default path
165
+ def packagePath = resolvedPath != null && resolvedPath.exists() ? resolvedPath.getAbsolutePath() : "$reactRoot/node_modules/agrid-react-native"
166
+ return packagePath
167
+ }
168
+
169
+ /** Extract from arguments collection bundle and sourcemap files output names. */
170
+ static extractBundleTaskArgumentsLegacy(cmdArgs, Project project) {
171
+ def bundleOutput = null
172
+ def sourcemapOutput = null
173
+ def packagerSourcemapOutput = null
174
+ // packagerBundleOutput doesn't exist, because packager output is overwritten by Hermes
175
+
176
+ cmdArgs.eachWithIndex { String arg, int i ->
177
+ if (arg == "--bundle-output") {
178
+ bundleOutput = cmdArgs[i + 1]
179
+ project.logger.info("--bundle-output: `${bundleOutput}`")
180
+ } else if (arg == "--sourcemap-output") {
181
+ sourcemapOutput = cmdArgs[i + 1]
182
+ packagerSourcemapOutput = sourcemapOutput
183
+ project.logger.info("--sourcemap-output param: `${sourcemapOutput}`")
184
+ }
185
+ }
186
+
187
+ // Best thing would be if we just had access to the local gradle variables here:
188
+ // https://github.com/facebook/react-native/blob/ff3b839e9a5a6c9e398a1327cde6dd49a3593092/react.gradle#L89-L97
189
+ // Now, the issue is that hermes builds have a different pipeline:
190
+ // `metro -> hermes -> compose-source-maps`, which then combines both intermediate sourcemaps into the final one.
191
+ // In this function here, we only grep through the first `metro` step, which only generates an intermediate sourcemap,
192
+ // which is wrong. We need the final one. Luckily, we can just generate the path from the `bundleOutput`, since
193
+ // the paths seem to be well defined.
194
+
195
+ // if sourcemapOutput is null, it means there's no source maps at all
196
+ // if hermes is enabled and has intermediates folder, we need to fix paths
197
+ // if hermes is disabled, sourcemapOutput is already ok
198
+ def enableHermes = project.ext.react.get("enableHermes", false);
199
+ project.logger.info("enableHermes: `${enableHermes}`")
200
+
201
+ if (bundleOutput != null && sourcemapOutput != null && enableHermes) {
202
+ // react-native < 0.60.1
203
+ def pattern = Pattern.compile("(/|\\\\)intermediates\\1sourcemaps\\1react\\1")
204
+ Matcher matcher = pattern.matcher(sourcemapOutput)
205
+ // if its intermediates/sourcemaps/react then it should be generated/sourcemaps/react
206
+ if (matcher.find()) {
207
+ project.logger.info("sourcemapOutput has the wrong path, let's fix it.")
208
+ // replacing from bundleOutput which is more reliable
209
+ sourcemapOutput = bundleOutput.replaceAll("(/|\\\\)generated\\1assets\\1react\\1", "\$1generated\$1sourcemaps\$1react\$1") + ".map"
210
+ project.logger.info("sourcemapOutput new path: `${sourcemapOutput}`")
211
+ }
212
+ }
213
+
214
+ // get the current bundle command, if not peresent use default plain "bundle"
215
+ // we use this later to decide how to upload source maps
216
+ def bundleCommand = project.ext.react.get("bundleCommand", "bundle")
217
+
218
+ return [bundleOutput, sourcemapOutput, packagerSourcemapOutput, bundleCommand]
219
+ }
220
+
221
+ /** Extract bundle and sourcemap paths from bundle task props.
222
+ * Based on https://github.com/facebook/react-native/blob/93c17cd0c43ba7fe3bc09f547b64771984992fbb/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/BundleHermesCTask.kt
223
+ * Output source map path is the same for both Hermes and JSC.
224
+ */
225
+ static extractBundleTaskArgumentsRN71AndAbove(bundleTask, logger) {
226
+ def props = bundleTask.getProperties()
227
+ def bundleAssetName = props.bundleAssetName?.get()
228
+
229
+ if (bundleAssetName == null) {
230
+ return [null, null]
231
+ }
232
+
233
+ def bundleCommand = props.bundleCommand.get()
234
+ def bundleFile = new File(props.jsBundleDir.get().asFile.absolutePath, bundleAssetName)
235
+ def outputSourceMap = new File(props.jsSourceMapsDir.get().asFile.absolutePath, "${bundleAssetName}.map")
236
+ def packagerOutputSourceMap = new File(props.jsIntermediateSourceMapsDir.get().asFile.absolutePath, "${bundleAssetName}.packager.map")
237
+
238
+ logger.info("bundleFile: `${bundleFile}`")
239
+ logger.info("outputSourceMap: `${outputSourceMap}`")
240
+ logger.info("packagerOutputSourceMap: `${packagerOutputSourceMap}`")
241
+ return [bundleFile, outputSourceMap, packagerOutputSourceMap, bundleCommand]
242
+ }
243
+
244
+ /** Force Bundle task to produce sourcemap files if they are not pre-configured by user yet. */
245
+ def forceSourceMapOutputFromBundleTask(bundleTask) {
246
+ def props = bundleTask.getProperties()
247
+ def cmd = props.get("commandLine") as List<String>
248
+ def cmdArgs = props.get("args") as List<String>
249
+ def shouldCleanUp = false
250
+ def bundleOutput = null
251
+ def sourcemapOutput = null
252
+ def packagerSourcemapOutput = null
253
+ def bundleCommand = null
254
+
255
+ (bundleOutput, sourcemapOutput, packagerSourcemapOutput, bundleCommand) = extractBundleTaskArgumentsRN71AndAbove(bundleTask, logger)
256
+ if (bundleOutput == null) {
257
+ (bundleOutput, sourcemapOutput, packagerSourcemapOutput, bundleCommand) = extractBundleTaskArgumentsLegacy(cmdArgs, project)
258
+ }
259
+
260
+ if (sourcemapOutput == null) {
261
+ sourcemapOutput = bundleOutput + ".map"
262
+
263
+ cmd.addAll(["--sourcemap-output", sourcemapOutput])
264
+ cmdArgs.addAll(["--sourcemap-output", sourcemapOutput])
265
+
266
+ shouldCleanUp = true
267
+
268
+ bundleTask.setProperty("commandLine", cmd)
269
+ bundleTask.setProperty("args", cmdArgs)
270
+
271
+ project.logger.info("forced sourcemap file output for `${bundleTask.name}` task")
272
+ } else {
273
+ project.logger.info("Info: used pre-configured source map files: ${sourcemapOutput}")
274
+ }
275
+
276
+ return [shouldCleanUp, bundleOutput, sourcemapOutput, packagerSourcemapOutput, bundleCommand]
277
+ }
278
+
279
+ /** compose array with one item - current build flavor name */
280
+ static extractCurrentVariants(bundleTask, variant) {
281
+ // examples: bundleLocalReleaseJsAndAssets, createBundleYellowDebugJsAndAssets
282
+ def pattern = Pattern.compile("(?:create)?(?:B|b)undle([A-Z][A-Za-z0-9_]+)JsAndAssets")
283
+
284
+ def currentRelease = ""
285
+
286
+ Matcher matcher = pattern.matcher(bundleTask.name)
287
+ if (matcher.find()) {
288
+ def match = matcher.group(1)
289
+ currentRelease = match.substring(0, 1).toLowerCase() + match.substring(1)
290
+ }
291
+
292
+ def currentVariants = null
293
+ if (variant.name.equalsIgnoreCase(currentRelease)) {
294
+ currentVariants = [:]
295
+ def variantName = variant.name
296
+ variant.outputs.each { output ->
297
+ def defaultVersionCode = output.versionCode.getOrElse(0)
298
+ def versionCode = defaultVersionCode
299
+ def appId = variant.applicationId.get()
300
+ def versionName = output.versionName.getOrElse('') // may be empty if not set
301
+ def defaultReleaseName = "${appId}@${versionName}+${versionCode}"
302
+ def releaseName = defaultReleaseName
303
+
304
+ def outputName = output.baseName
305
+
306
+ if (currentVariants[outputName] == null) currentVariants[outputName] = []
307
+ currentVariants[outputName] = [outputName, releaseName, versionCode, variantName]
308
+ }
309
+ }
310
+
311
+ return currentVariants
312
+ }