Skip to content

Commit 3086d72

Browse files
author
David Motsonashvili
committed
fixes for comments, and removing an extraneous API
1 parent b029172 commit 3086d72

File tree

1 file changed

+4
-22
lines changed
  • plugins/src/main/java/com/google/firebase/gradle/plugins/services

1 file changed

+4
-22
lines changed

plugins/src/main/java/com/google/firebase/gradle/plugins/services/GmavenService.kt

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ abstract class GMavenService : BuildService<BuildServiceParameters.None> {
154154
* Gets the latest non-alpha version of the artifact that has been uploaded to GMaven, if any.
155155
*
156156
* ```
157-
* gmaven.latestVersionOrNull("com.google.firebase", "firebase-components") // "18.0.1"
157+
* gmaven.latestNonAlphaVersionOrNull("com.google.firebase", "firebase-components") // "18.0.1"
158158
* ```
159159
*
160160
* @param groupId The group to search under.
@@ -169,7 +169,7 @@ abstract class GMavenService : BuildService<BuildServiceParameters.None> {
169169
* Gets the latest non-alpha version of the artifact that has been uploaded to GMaven, if any.
170170
*
171171
* ```
172-
* gmaven.latestVersionOrNull("com.google.firebase", "firebase-components") // "18.0.1"
172+
* gmaven.latestNonAlphaVersionOrNull("com.google.firebase", "firebase-components") // "18.0.1"
173173
* ```
174174
*
175175
* @param fullArtifactName The artifact to search for, represented as "groupId:artifactId".
@@ -215,24 +215,6 @@ abstract class GMavenService : BuildService<BuildServiceParameters.None> {
215215
"Failed to get the latest version from gmaven for \'$artifactId\'. Has it been published?"
216216
)
217217

218-
/**
219-
* Gets the latest non-alpha version of the artifact that has been uploaded to GMaven.
220-
*
221-
* ```
222-
* gmaven.latestVersion("com.google.firebase", "firebase-components") // "18.0.1"
223-
* ```
224-
*
225-
* @param groupId The group to search under.
226-
* @param artifactId The artifact to search for.
227-
* @return The latest released version as a string.
228-
* @see latestNonAlphaVersionOrNull
229-
*/
230-
fun latestNonAlphaVersion(groupId: String, artifactId: String) =
231-
latestVersionOrNull(groupId, artifactId)
232-
?: throw RuntimeException(
233-
"Failed to get the latest version from gmaven for \'$artifactId\'. Has it been published?"
234-
)
235-
236218
/**
237219
* Checks if an artifact has been published to GMaven.
238220
*
@@ -452,7 +434,7 @@ class GMavenServiceController(
452434
return findFirebaseArtifact(groupId, artifactId)?.latestVersion
453435
}
454436

455-
/** @see GMavenService.latestVersionOrNull */
437+
/** @see GMavenService.latestNonAlphaVersionOrNull */
456438
fun latestNonAlphaVersionOrNull(groupId: String, artifactId: String): String? {
457439
return findFirebaseArtifact(groupId, artifactId)?.latestNonAlphaVersion
458440
}
@@ -609,7 +591,7 @@ data class GroupIndexArtifact(
609591
val artifactId: String,
610592
val versions: List<String>,
611593
val latestVersion: String = versions.last(),
612-
val latestNonAlphaVersion: String = versions.last { !it.contains("alpha") }
594+
val latestNonAlphaVersion: String? = versions.findLast { !it.contains("alpha") },
613595
) {
614596

615597
/**

0 commit comments

Comments
 (0)