@@ -150,6 +150,37 @@ abstract class GMavenService : BuildService<BuildServiceParameters.None> {
150
150
fun latestVersionOrNull (groupId : String , artifactId : String ) =
151
151
controller.latestVersionOrNull(groupId, artifactId)
152
152
153
+ /* *
154
+ * Gets the latest non-alpha version of the artifact that has been uploaded to GMaven, if any.
155
+ *
156
+ * ```
157
+ * gmaven.latestNonAlphaVersionOrNull("com.google.firebase", "firebase-components") // "18.0.1"
158
+ * ```
159
+ *
160
+ * @param groupId The group to search under.
161
+ * @param artifactId The artifact to search for.
162
+ * @return The latest released version as a string, or null if the artifact couldn't be found.
163
+ * @see latestVersion
164
+ */
165
+ fun latestNonAlphaVersionOrNull (groupId : String , artifactId : String ) =
166
+ controller.latestNonAlphaVersionOrNull(groupId, artifactId)
167
+
168
+ /* *
169
+ * Gets the latest non-alpha version of the artifact that has been uploaded to GMaven, if any.
170
+ *
171
+ * ```
172
+ * gmaven.latestNonAlphaVersionOrNull("com.google.firebase", "firebase-components") // "18.0.1"
173
+ * ```
174
+ *
175
+ * @param fullArtifactName The artifact to search for, represented as "groupId:artifactId".
176
+ * @return The latest released version as a string, or null if the artifact couldn't be found.
177
+ * @see latestVersion
178
+ */
179
+ fun latestNonAlphaVersionOrNull (fullArtifactName : String ): String? {
180
+ val (groupId, artifactId) = fullArtifactName.split(" :" )
181
+ return latestNonAlphaVersionOrNull(groupId, artifactId)
182
+ }
183
+
153
184
/* *
154
185
* Gets the latest version of the artifact that has been uploaded to GMaven, if any.
155
186
*
@@ -403,6 +434,11 @@ class GMavenServiceController(
403
434
return findFirebaseArtifact(groupId, artifactId)?.latestVersion
404
435
}
405
436
437
+ /* * @see GMavenService.latestNonAlphaVersionOrNull */
438
+ fun latestNonAlphaVersionOrNull (groupId : String , artifactId : String ): String? {
439
+ return findFirebaseArtifact(groupId, artifactId)?.latestNonAlphaVersion
440
+ }
441
+
406
442
/* * @see GMavenService.hasReleasedArtifact */
407
443
fun hasReleasedArtifact (groupId : String , artifactId : String ): Boolean {
408
444
return findFirebaseArtifact(groupId, artifactId) != = null
@@ -555,6 +591,7 @@ data class GroupIndexArtifact(
555
591
val artifactId : String ,
556
592
val versions : List <String >,
557
593
val latestVersion : String = versions.last(),
594
+ val latestNonAlphaVersion : String? = versions.findLast { !it.contains("alpha") },
558
595
) {
559
596
560
597
/* *
0 commit comments