Skip to content

Commit

Permalink
androidx.compose.ui:ui is a valid maven coordinate
Browse files Browse the repository at this point in the history
The assumption that the name of the maven coordinate has at least 3 characters was incorrect.

The group has at least 4 characters like "a.de" (and probably more).

This way we can still differentiate with "hh::mm:ss" which is not a valid maven coordinate
  • Loading branch information
jmfayard committed Aug 26, 2021
1 parent 92fee74 commit bfcc15e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ private const val versionChars = "[a-zA-Z0-9_.{}$-]"

@Language("RegExp")
private val mavenCoordinateRegex =
"(['\"]$mavenChars{3,}:$mavenChars{3,}:)(?:_|$versionChars{3,})([\"'])".toRegex()
"(['\"]$mavenChars{4,}:$mavenChars{2,}:)(?:_|$versionChars{3,})([\"'])".toRegex()

internal fun findFilesWithDependencyNotations(fromDir: File): List<File> {
require(fromDir.isDirectory) { "Expected a directory, got ${fromDir.absolutePath}" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class MigrationTest : StringSpec({
implementation 'com.example:name:1.2.3.eap.1'
implementation 'com.example:name:1.2.3.eap1'
implementation 'com.example:name:1.2.3-native-mt'
implementation "androidx.compose.ui:ui:${'$'}compose_version"
""".trimIndent().lines()
val expected = """
implementation("com.example:name:_")
Expand All @@ -53,6 +54,7 @@ class MigrationTest : StringSpec({
implementation 'com.example:name:_'
implementation 'com.example:name:_'
implementation 'com.example:name:_'
implementation "androidx.compose.ui:ui:_"
""".trimIndent().lines()
input.size shouldBeExactly expected.size
List(input.size) { input[it] to expected[it] }
Expand Down

0 comments on commit bfcc15e

Please sign in to comment.