mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
Fix extra slash.
This commit is contained in:
parent
ca043beaf8
commit
ea8a812ed2
2 changed files with 10 additions and 13 deletions
|
@ -12,14 +12,14 @@ open class SimpleDep(open val mavenId: MavenId) : UnversionedDep(mavenId.groupId
|
||||||
val version: String get() = mavenId.version!!
|
val version: String get() = mavenId.version!!
|
||||||
|
|
||||||
private fun toFile(version: Version, suffix: String): String {
|
private fun toFile(version: Version, suffix: String): String {
|
||||||
|
val dir = toDirectory(version.version, false, trailingSlash = false)
|
||||||
val list =
|
val list =
|
||||||
if (version.snapshotTimestamp != null) {
|
if (version.snapshotTimestamp != null) {
|
||||||
listOf(toDirectory(version.version, false),
|
listOf(dir, artifactId + "-" + version.noSnapshotVersion + "-" + version.snapshotTimestamp + suffix)
|
||||||
artifactId + "-" + version.noSnapshotVersion + "-" + version.snapshotTimestamp + suffix)
|
} else {
|
||||||
} else {
|
listOf(dir, artifactId + "-" + version.version + suffix)
|
||||||
listOf(toDirectory(version.version, false), artifactId + "-" + version.version + suffix)
|
}
|
||||||
}
|
return list.joinToString("/").replace("//", "/")
|
||||||
return list.joinToString("/")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun toPomFile(v: String) = toFile(Version.of(v), ".pom")
|
fun toPomFile(v: String) = toFile(Version.of(v), ".pom")
|
||||||
|
@ -28,8 +28,6 @@ open class SimpleDep(open val mavenId: MavenId) : UnversionedDep(mavenId.groupId
|
||||||
|
|
||||||
fun toJarFile(v: String = version) = toFile(Version.of(v), suffix)
|
fun toJarFile(v: String = version) = toFile(Version.of(v), suffix)
|
||||||
|
|
||||||
fun toJarFile(v: Version) = toFile(v, suffix)
|
|
||||||
|
|
||||||
fun toPomFileName() = "$artifactId-$version.pom"
|
fun toPomFileName() = "$artifactId-$version.pom"
|
||||||
|
|
||||||
fun toJarFile(r: RepoFinder.RepoResult) = toFile(r.snapshotVersion ?: r.version!!, suffix)
|
fun toJarFile(r: RepoFinder.RepoResult) = toFile(r.snapshotVersion ?: r.version!!, suffix)
|
||||||
|
|
|
@ -19,13 +19,12 @@ open class UnversionedDep(open val groupId: String, open val artifactId: String)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Turn this dependency to a directory. If fileSystem is true, use the file system
|
* Turn this dependency to a directory. If fileSystem is true, use the file system
|
||||||
* dependent path separator, otherwise, use '/' (used to create URL's). The returned
|
* dependent path separator, otherwise, use '/' (used to create URL's).
|
||||||
* string always ends with the path separator.
|
|
||||||
*/
|
*/
|
||||||
fun toDirectory(v: String, fileSystem: Boolean = true): String {
|
fun toDirectory(v: String, fileSystem: Boolean = true, trailingSlash: Boolean = true): String {
|
||||||
val sep = if (fileSystem) File.separator else "/"
|
val sep = if (fileSystem) File.separator else "/"
|
||||||
val l = listOf(groupId.replace(".", sep), artifactId, v)
|
val l = listOf(groupId.replace(".", sep), artifactId, v)
|
||||||
val result = Strings.Companion.join(sep, l)
|
val result = Strings.Companion.join(sep, l)
|
||||||
return if (result.endsWith(sep)) result else result + sep
|
return if (trailingSlash && ! result.endsWith(sep)) result + sep else result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue