mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 16:28:12 -07:00
javadoc/sources upload fix.
This commit is contained in:
parent
cc34b80e26
commit
626eade9d4
1 changed files with 25 additions and 18 deletions
|
@ -40,33 +40,27 @@ class MavenDependency @Inject constructor(
|
||||||
val jar = File(localRepo.toFullPath(toJarFile(version)))
|
val jar = File(localRepo.toFullPath(toJarFile(version)))
|
||||||
val aar = File(localRepo.toFullPath(toAarFile(version)))
|
val aar = File(localRepo.toFullPath(toAarFile(version)))
|
||||||
val pom = File(localRepo.toFullPath(toPomFile(version)))
|
val pom = File(localRepo.toFullPath(toPomFile(version)))
|
||||||
|
|
||||||
|
fun toSuffix(name: String, suffix: String = "") : String {
|
||||||
|
val dot = name.lastIndexOf(".")
|
||||||
|
return name.substring(0, dot) + suffix + name.substring(dot)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun download(url: String, fileName: String, suffix: String = "") : Future<File> {
|
||||||
|
val localPath = localRepo.toFullPath(toSuffix(fileName, suffix))
|
||||||
|
return downloadManager.download(HostConfig(toSuffix(url, suffix)), localPath, executor)
|
||||||
|
}
|
||||||
|
|
||||||
if (pom.exists() && (jar.exists() || aar.exists())) {
|
if (pom.exists() && (jar.exists() || aar.exists())) {
|
||||||
jarFile = CompletedFuture(if (jar.exists()) jar else aar)
|
jarFile = CompletedFuture(if (jar.exists()) jar else aar)
|
||||||
pomFile = CompletedFuture(pom)
|
pomFile = CompletedFuture(pom)
|
||||||
} else {
|
} else {
|
||||||
val repoResult = repoFinder.findCorrectRepo(mavenId.toId)
|
val repoResult = repoFinder.findCorrectRepo(mavenId.toId)
|
||||||
|
|
||||||
fun toSuffix(name: String, suffix: String = "") : String {
|
|
||||||
val dot = name.lastIndexOf(".")
|
|
||||||
return name.substring(0, dot) + suffix + name.substring(dot)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun download(url: String, fileName: String, suffix: String = "") : Future<File> {
|
|
||||||
val localPath = localRepo.toFullPath(toSuffix(fileName, suffix))
|
|
||||||
return downloadManager.download(HostConfig(toSuffix(url, suffix)), localPath, executor)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (repoResult.found) {
|
if (repoResult.found) {
|
||||||
jarFile =
|
jarFile =
|
||||||
if (repoResult.archiveUrl != null) {
|
if (repoResult.archiveUrl != null) {
|
||||||
val result = download(repoResult.archiveUrl, repoResult.path!!)
|
download(repoResult.archiveUrl, repoResult.path!!)
|
||||||
if (downloadSources) {
|
|
||||||
download(repoResult.archiveUrl, repoResult.path, "-sources")
|
|
||||||
}
|
|
||||||
if (downloadJavadocs) {
|
|
||||||
download(repoResult.archiveUrl, repoResult.path, "-javadoc")
|
|
||||||
}
|
|
||||||
result
|
|
||||||
} else {
|
} else {
|
||||||
CompletedFuture(File("nonexistentFile")) // will be filtered out
|
CompletedFuture(File("nonexistentFile")) // will be filtered out
|
||||||
}
|
}
|
||||||
|
@ -76,6 +70,19 @@ class MavenDependency @Inject constructor(
|
||||||
throw KobaltException("Couldn't resolve ${mavenId.toId}")
|
throw KobaltException("Couldn't resolve ${mavenId.toId}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (downloadSources || downloadJavadocs) {
|
||||||
|
val repoResult = repoFinder.findCorrectRepo(mavenId.toId)
|
||||||
|
if (repoResult.archiveUrl != null && repoResult.path != null) {
|
||||||
|
if (downloadSources) {
|
||||||
|
download(repoResult.archiveUrl, repoResult.path, "-sources")
|
||||||
|
}
|
||||||
|
if (downloadJavadocs) {
|
||||||
|
download(repoResult.archiveUrl, repoResult.path, "-javadoc")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue