Skip to content

Commit

Permalink
Fixed ListProductReleasesTask to return only significant versions f…
Browse files Browse the repository at this point in the history
…or Android Studio #928
  • Loading branch information
hsz committed Mar 28, 2022
1 parent f6ae5c7 commit 2d23887
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## next
- Make IDEA products releases cached hourly [#848](../../issues/848)
- Fixed `ListProductReleasesTask` to return only significant versions for Android Studio [#928](../../issues/928)

## 1.5.0
- Include Android Studio builds in the `ListProductsReleasesTask` results
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,11 @@ open class ListProductsReleasesTask @Inject constructor(
testVersion(version, build)
}
.filter { channels.contains(Channel.valueOf(it.channel.toUpperCase())) }
.groupBy { it.version }
.groupBy { it.version.split('.').dropLast(1).joinToString(".") }
.mapNotNull { entry ->
entry.value.maxByOrNull { it.platformBuild?.let(::parse) ?: Version() }
entry.value.maxByOrNull {
it.version.split('.').last().toInt()
}
}
.map { "AI-${it.version}" }
.toList()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,23 @@ class ListProductsReleasesTaskSpec : IntelliJPluginSpecBase() {
)
}

@Test
fun `get Android Studio releases for all channels`() {
buildFile.groovy("""
listProductsReleases {
sinceVersion = "2021.1"
types = ["AI"]
}
""")

val result = build(IntelliJPluginConstants.LIST_PRODUCTS_RELEASES_TASK_NAME)

assertEquals(
listOf("AI-2021.3.1.7", "AI-2021.2.1.11", "AI-2021.1.1.22"),
result.taskOutput()
)
}

@Test
fun `reuse configuration cache`() {
build(IntelliJPluginConstants.LIST_PRODUCTS_RELEASES_TASK_NAME, "--configuration-cache")
Expand Down

0 comments on commit 2d23887

Please sign in to comment.