Skip to content

Commit 8ee26c7

Browse files
author
David Motsonashvili
committed
replace latestNonAlphaVersion with latestStableVersion
1 parent 964dccc commit 8ee26c7

File tree

3 files changed

+17
-16
lines changed

3 files changed

+17
-16
lines changed

plugins/src/main/java/com/google/firebase/gradle/bomgenerator/GenerateTutorialBundleTask.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ abstract class GenerateTutorialBundleTask : DefaultTask() {
195195
} else {
196196
logger.info("Fetching the latest version for an artifact: $fullArtifactName")
197197

198-
return gmaven.get().latestNonAlphaVersionOrNull(fullArtifactName)
198+
return gmaven.get().latestStableVersionOrNull(fullArtifactName)
199199
?: throw RuntimeException(
200200
"An artifact required for the tutorial bundle is missing from gmaven: $fullArtifactName"
201201
)

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

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -151,34 +151,35 @@ abstract class GMavenService : BuildService<BuildServiceParameters.None> {
151151
controller.latestVersionOrNull(groupId, artifactId)
152152

153153
/**
154-
* Gets the latest non-alpha version of the artifact that has been uploaded to GMaven, if any.
155-
*
154+
* Gets the latest version with no qualifiers of the artifact that has been uploaded to GMaven, if
155+
* any. *
156156
* ```
157-
* gmaven.latestNonAlphaVersionOrNull("com.google.firebase", "firebase-components") // "18.0.1"
157+
* gmaven.latestStableVersionOrNull("com.google.firebase", "firebase-components") // "18.0.1"
158158
* ```
159159
*
160160
* @param groupId The group to search under.
161161
* @param artifactId The artifact to search for.
162162
* @return The latest released version as a string, or null if the artifact couldn't be found.
163163
* @see latestVersion
164164
*/
165-
fun latestNonAlphaVersionOrNull(groupId: String, artifactId: String) =
166-
controller.latestNonAlphaVersionOrNull(groupId, artifactId)
165+
fun latestStableVersionOrNull(groupId: String, artifactId: String) =
166+
controller.latestStableVersionOrNull(groupId, artifactId)
167167

168168
/**
169-
* Gets the latest non-alpha version of the artifact that has been uploaded to GMaven, if any.
169+
* Gets the latest version with no qualifiers of the artifact that has been uploaded to GMaven, if
170+
* any.
170171
*
171172
* ```
172-
* gmaven.latestNonAlphaVersionOrNull("com.google.firebase", "firebase-components") // "18.0.1"
173+
* gmaven.latestStableVersionOrNull("com.google.firebase", "firebase-components") // "18.0.1"
173174
* ```
174175
*
175176
* @param fullArtifactName The artifact to search for, represented as "groupId:artifactId".
176177
* @return The latest released version as a string, or null if the artifact couldn't be found.
177178
* @see latestVersion
178179
*/
179-
fun latestNonAlphaVersionOrNull(fullArtifactName: String): String? {
180+
fun latestStableVersionOrNull(fullArtifactName: String): String? {
180181
val (groupId, artifactId) = fullArtifactName.split(":")
181-
return latestNonAlphaVersionOrNull(groupId, artifactId)
182+
return latestStableVersionOrNull(groupId, artifactId)
182183
}
183184

184185
/**
@@ -434,9 +435,9 @@ class GMavenServiceController(
434435
return findFirebaseArtifact(groupId, artifactId)?.latestVersion
435436
}
436437

437-
/** @see GMavenService.latestNonAlphaVersionOrNull */
438-
fun latestNonAlphaVersionOrNull(groupId: String, artifactId: String): String? {
439-
return findFirebaseArtifact(groupId, artifactId)?.latestNonAlphaVersion
438+
/** @see GMavenService.latestStableVersionOrNull */
439+
fun latestStableVersionOrNull(groupId: String, artifactId: String): String? {
440+
return findFirebaseArtifact(groupId, artifactId)?.latestStableVersion
440441
}
441442

442443
/** @see GMavenService.hasReleasedArtifact */
@@ -591,7 +592,7 @@ data class GroupIndexArtifact(
591592
val artifactId: String,
592593
val versions: List<String>,
593594
val latestVersion: String = versions.last(),
594-
val latestNonAlphaVersion: String? = versions.findLast { !it.contains("alpha") },
595+
val latestStableVersion: String? = versions.findLast { !it.contains("-") },
595596
) {
596597

597598
/**

plugins/src/test/kotlin/com/google/firebase/gradle/plugins/GenerateTutorialBundleTests.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ class GenerateTutorialBundleTests : FunSpec() {
242242
@Test
243243
fun `throws an error if an unreleased artifact is used`() {
244244
shouldThrowSubstring("missing from gmaven", "com.google.firebase:firebase-auth") {
245-
every { service.latestNonAlphaVersionOrNull(any()) } answers { null }
245+
every { service.latestStableVersionOrNull(any()) } answers { null }
246246

247247
val task = makeTask { firebaseArtifacts.set(listOf("com.google.firebase:firebase-auth")) }
248248

@@ -294,7 +294,7 @@ class GenerateTutorialBundleTests : FunSpec() {
294294
"$groupId:$artifactId" to version
295295
}
296296
.onEach { entry ->
297-
every { service.latestNonAlphaVersionOrNull(entry.key) } answers { entry.value }
297+
every { service.latestStableVersionOrNull(entry.key) } answers { entry.value }
298298
}
299299
}
300300

0 commit comments

Comments
 (0)