mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
Support parent poms.
This commit is contained in:
parent
34c630883c
commit
d4c51cb6ba
7 changed files with 31 additions and 11 deletions
|
@ -24,7 +24,8 @@ public class DependencyManager @Inject constructor(val executors: KobaltExecutor
|
|||
}
|
||||
|
||||
val result2 = reorderDependencies(result).filter {
|
||||
// Only keep existent files (nonexistent files are probably optional dependencies)
|
||||
// Only keep existent files (nonexistent files are probably optional dependencies or parent poms
|
||||
// that point to other poms but don't have a jar file themselves)
|
||||
it.jarFile.get().exists()
|
||||
}
|
||||
|
||||
|
|
|
@ -32,8 +32,12 @@ public class MavenDependency @Inject constructor(override @Assisted("groupId") v
|
|||
} else {
|
||||
val repoResult = repoFinder.findCorrectRepo(toId(groupId, artifactId, version))
|
||||
if (repoResult.found) {
|
||||
jarFile = downloadManager.download(repoResult.repoUrl + toJarFile(repoResult), jar.absolutePath,
|
||||
executor)
|
||||
jarFile =
|
||||
if (repoResult.hasJar) {
|
||||
downloadManager.download(repoResult.repoUrl + toJarFile(repoResult), jar.absolutePath, executor)
|
||||
} else {
|
||||
CompletedFuture(File("nonexistentFile")) // will be filtered out
|
||||
}
|
||||
pomFile = downloadManager.download(repoResult.repoUrl + toPomFile(repoResult), pom.absolutePath,
|
||||
executor)
|
||||
} else {
|
||||
|
|
|
@ -7,6 +7,7 @@ import com.beust.kobalt.misc.Strings
|
|||
import com.google.common.cache.CacheBuilder
|
||||
import com.google.common.cache.CacheLoader
|
||||
import com.google.common.cache.LoadingCache
|
||||
import java.io.File
|
||||
import java.util.concurrent.Callable
|
||||
import java.util.concurrent.ExecutorCompletionService
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
@ -24,7 +25,7 @@ public class RepoFinder @Inject constructor(val http: Http, val executors: Kobal
|
|||
return FOUND_REPOS.get(id)
|
||||
}
|
||||
|
||||
data class RepoResult(val repoUrl: String, val found: Boolean, val version: String,
|
||||
data class RepoResult(val repoUrl: String, val found: Boolean, val version: String, val hasJar: Boolean = true,
|
||||
val snapshotVersion: String = "")
|
||||
|
||||
private val FOUND_REPOS: LoadingCache<String, RepoResult> = CacheBuilder.newBuilder()
|
||||
|
@ -83,16 +84,26 @@ public class RepoFinder @Inject constructor(val http: Http, val executors: Kobal
|
|||
val dep = SimpleDep(c[0], c[1], c[2])
|
||||
val snapshotVersion = findSnapshotVersion(dep.toMetadataXmlPath(false), repoUrl)
|
||||
if (snapshotVersion != null) {
|
||||
return RepoResult(repoUrl, true, c[2], snapshotVersion)
|
||||
return RepoResult(repoUrl, true, c[2], true /* hasJar, potential bug here */, snapshotVersion)
|
||||
} else {
|
||||
return RepoResult(repoUrl, false, "")
|
||||
}
|
||||
} else {
|
||||
val dep = SimpleDep(c[0], c[1], c[2])
|
||||
val url = repoUrl + "/" + dep.toJarFile(dep.version)
|
||||
val body = http.get(url)
|
||||
log(2, "Result for ${repoUrl} for ${id}: ${body.code == 200}")
|
||||
return RepoResult(repoUrl, body.code == 200, dep.version)
|
||||
// Try to find the jar file
|
||||
val urlJar = repoUrl + dep.toJarFile(dep.version)
|
||||
val hasJar = http.get(urlJar).code == 200
|
||||
|
||||
val found =
|
||||
if (! hasJar) {
|
||||
// No jar, try to find the directory
|
||||
val url = repoUrl + File(dep.toJarFile(dep.version)).parentFile.path
|
||||
http.get(url).code == 200
|
||||
} else {
|
||||
true
|
||||
}
|
||||
log(2, "Result for $repoUrl for $id: $found")
|
||||
return RepoResult(repoUrl, found, dep.version, hasJar)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
kobalt.version=0.148
|
||||
kobalt.version=0.151
|
Loading…
Add table
Add a link
Reference in a new issue