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

Enable source downloading.

This commit is contained in:
Cedric Beust 2016-02-13 08:48:49 -08:00
parent a29d837f42
commit 01df4b8d94
14 changed files with 56 additions and 27 deletions

View file

@ -7,6 +7,7 @@ import com.beust.kobalt.maven.ArtifactFetcher
import com.beust.kobalt.maven.LocalRepo
import com.beust.kobalt.maven.Pom
import com.beust.kobalt.maven.PomGenerator
import com.beust.kobalt.maven.dependency.MavenDependency
import com.beust.kobalt.misc.DependencyExecutor
import com.beust.kobalt.misc.KobaltExecutors
import com.beust.kobalt.plugin.publish.BintrayApi
@ -33,7 +34,8 @@ public open class MainModule(val args: Args, val settings: KobaltSettings) : Abs
BintrayApi.IFactory::class.java,
Pom.IFactory::class.java,
BuildFileCompiler.IFactory::class.java,
ArtifactFetcher.IFactory::class.java)
ArtifactFetcher.IFactory::class.java,
MavenDependency.IFactory::class.java)
.forEach {
install(builder.build(it))
}

View file

@ -45,7 +45,7 @@ class GetDependenciesCommand @Inject constructor(val executors: KobaltExecutors,
val executor = executors.miscExecutor
fun toDependencyData(d: IClasspathDependency, scope: String) : DependencyData {
val dep = MavenDependency.create(d.id, executor)
val dep = MavenDependency.create(d.id, executor = executor)
return DependencyData(d.id, scope, dep.jarFile.get().absolutePath)
}

View file

@ -115,7 +115,8 @@ class KotlinCompiler @Inject constructor(
otherClasspath: List<String>, sourceFiles: List<String>, outputDir: File, args: List<String>) : TaskResult {
val executor = executors.newExecutor("KotlinCompiler", 10)
val compilerDep = depFactory.create("org.jetbrains.kotlin:kotlin-compiler-embeddable:$KOTLIN_VERSION", executor)
val compilerDep = depFactory.create("org.jetbrains.kotlin:kotlin-compiler-embeddable:$KOTLIN_VERSION",
executor = executor)
val deps = dependencyManager.transitiveClosure(listOf(compilerDep))
// Force a download of the compiler dependencies

View file

@ -94,7 +94,7 @@ class KotlinPlugin @Inject constructor(val executors: KobaltExecutors)
private fun getKotlinCompilerJar(name: String): String {
val id = "org.jetbrains.kotlin:$name:${KotlinCompiler.KOTLIN_VERSION}"
val dep = MavenDependency.create(id, executors.miscExecutor)
val dep = MavenDependency.create(id, executor = executors.miscExecutor)
val result = dep.jarFile.get().absolutePath
return result
}

View file

@ -41,7 +41,7 @@ class DownloadTest @Inject constructor(
if (success) {
arrayListOf("$groupId:$artifactId:$version", "$groupId:$artifactId:$previousVersion").forEach {
val dep = depFactory.create(it, executor)
val dep = depFactory.create(it, executor = executor)
val future = dep.jarFile
Assert.assertFalse(future is CompletedFuture)
val file = future.get()
@ -62,7 +62,7 @@ class DownloadTest @Inject constructor(
public fun shouldDownloadNoVersion() {
val success = deleteDir()
if (success) {
val dep = depFactory.create(idNoVersion, executor)
val dep = depFactory.create(idNoVersion, executor = executor)
val future = dep.jarFile
val file = future.get()
@ -80,7 +80,7 @@ class DownloadTest @Inject constructor(
val range = "[2.5,)"
val expected = "3.0-alpha-1"
val dep = depFactory.create("javax.servlet:servlet-api:$range", executor)
val dep = depFactory.create("javax.servlet:servlet-api:$range", executor = executor)
val future = dep.jarFile
val file = future.get()
Assert.assertFalse(future is CompletedFuture)
@ -91,7 +91,7 @@ class DownloadTest @Inject constructor(
@Test
public fun shouldFindLocalJar() {
MavenDependency.create("$idNoVersion$version")
val dep = depFactory.create("$idNoVersion$version", executor)
val dep = depFactory.create("$idNoVersion$version", executor = executor)
val future = dep.jarFile
// Assert.assertTrue(future is CompletedFuture)
val file = future.get()

View file

@ -24,8 +24,8 @@ class RemoteRepoTest @Inject constructor(val repoFinder: RepoFinder,
@Test(enabled = false)
fun metadataForSnapshots() {
val jar = MavenDependency.create("org.apache.maven.wagon:wagon-provider-test:2.10-SNAPSHOT", executor)
.jarFile
val jar = MavenDependency.create("org.apache.maven.wagon:wagon-provider-test:2.10-SNAPSHOT",
executor = executor).jarFile
Assert.assertTrue(jar.get().exists())
}