diff --git a/ruler-common/src/main/java/com/spotify/ruler/common/dependency/DependencySanitizer.kt b/ruler-common/src/main/java/com/spotify/ruler/common/dependency/DependencySanitizer.kt index 2bb11abc..14021f7a 100644 --- a/ruler-common/src/main/java/com/spotify/ruler/common/dependency/DependencySanitizer.kt +++ b/ruler-common/src/main/java/com/spotify/ruler/common/dependency/DependencySanitizer.kt @@ -58,9 +58,14 @@ class DependencySanitizer(private val classNameSanitizer: ClassNameSanitizer) { } } - /** Determines the correct component type for a given [entry]. */ + private val versionRegex = Regex("^\\d+\\.\\d+\\.\\d.*") + + /** + * Determines the correct component type for a given [entry]. + * Assuming that all external dependencies do have a version number in the format XX.XX.XX + * */ private fun getComponentType(entry: DependencyEntry): ComponentType = when { - entry.component.startsWith(':') -> ComponentType.INTERNAL - else -> ComponentType.EXTERNAL + versionRegex.containsMatchIn(entry.component.substringAfterLast(":","")) -> ComponentType.EXTERNAL + else -> ComponentType.INTERNAL } }