mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 16:28:12 -07:00
Fix #127.
This commit is contained in:
parent
01df4b8d94
commit
f92c3f59f9
1 changed files with 19 additions and 2 deletions
|
@ -45,11 +45,28 @@ class MavenDependency @Inject constructor(
|
||||||
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 path = localRepo.toFullPath(repoResult.path!!)
|
val result = download(repoResult.archiveUrl, repoResult.path!!)
|
||||||
downloadManager.download(HostConfig(url = repoResult.archiveUrl), path, executor)
|
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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue