1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 08:27:12 -07:00

Faster .jarFile.

This commit is contained in:
Cedric Beust 2016-07-19 01:00:40 -08:00
parent 80f732bb00
commit b5c81c4e8d

View file

@ -8,6 +8,8 @@ import com.beust.kobalt.internal.KobaltSettings
import com.beust.kobalt.internal.KobaltSettingsXml import com.beust.kobalt.internal.KobaltSettingsXml
import com.beust.kobalt.internal.getProxy import com.beust.kobalt.internal.getProxy
import com.beust.kobalt.maven.CompletedFuture import com.beust.kobalt.maven.CompletedFuture
import com.beust.kobalt.maven.LocalDep
import com.beust.kobalt.maven.LocalRepo
import com.beust.kobalt.maven.MavenId import com.beust.kobalt.maven.MavenId
import com.beust.kobalt.misc.KobaltLogger import com.beust.kobalt.misc.KobaltLogger
import com.beust.kobalt.misc.Versions import com.beust.kobalt.misc.Versions
@ -196,13 +198,15 @@ class AetherDependency(val artifact: Artifact): IClasspathDependency, Comparable
get() = if (artifact.file != null) { get() = if (artifact.file != null) {
CompletedFuture(artifact.file) CompletedFuture(artifact.file)
} else { } else {
val td = aether.transitiveDependencies(artifact) val localRepo = Kobalt.INJECTOR.getInstance(LocalRepo::class.java)
if (td?.root?.artifact?.file != null) { val file = File(LocalDep(MavenId.create(id), localRepo).toAbsoluteJarFilePath(version))
CompletedFuture(td!!.root.artifact.file) if (file.exists()) {
CompletedFuture(file)
} else { } else {
val resolved = aether.resolve(artifact) val td = aether.resolve(artifact)
if (resolved.size > 0) { val newFile = td[0].artifact.file
CompletedFuture(resolved[0].artifact.file) if (newFile != null) {
CompletedFuture(newFile)
} else { } else {
CompletedFuture(File("DONOTEXIST")) // will be filtered out CompletedFuture(File("DONOTEXIST")) // will be filtered out
} }