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

Rename DepFactory -> DependencyFactory.

This commit is contained in:
Cedric Beust 2016-03-25 12:35:28 +04:00
parent 21bc80b832
commit 9cc5d62cd3
18 changed files with 41 additions and 60 deletions

View file

@ -14,7 +14,7 @@ import com.beust.kobalt.internal.KobaltSettings
import com.beust.kobalt.internal.PluginInfo
import com.beust.kobalt.internal.TaskManager
import com.beust.kobalt.internal.build.BuildFile
import com.beust.kobalt.maven.DepFactory
import com.beust.kobalt.maven.DependencyFactory
import com.beust.kobalt.maven.Http
import com.beust.kobalt.maven.dependency.FileDependency
import com.beust.kobalt.misc.*
@ -66,7 +66,7 @@ private class Main @Inject constructor(
val server: KobaltServer,
val pluginInfo: PluginInfo,
val projectGenerator: ProjectGenerator,
val depFactory: DepFactory,
val depFactory: DependencyFactory,
val dependencyData: DependencyData,
val resolveDependency: ResolveDependency) {
@ -77,7 +77,7 @@ private class Main @Inject constructor(
val dependencies = arrayListOf<IClasspathDependency>()
args.pluginIds?.let {
// We want this call to go to the network if no version was specified, so set localFirst to false
dependencies.addAll(it.split(",").map { depFactory.create(it, localFirst = false) })
dependencies.addAll(it.split(",").map { depFactory.create(it) })
}
args.pluginJarFiles?.let {
dependencies.addAll(it.split(",").map { FileDependency(it) })

View file

@ -7,7 +7,7 @@ import com.beust.kobalt.app.BuildFileCompiler
import com.beust.kobalt.internal.JvmCompilerPlugin
import com.beust.kobalt.internal.PluginInfo
import com.beust.kobalt.internal.build.BuildFile
import com.beust.kobalt.maven.DepFactory
import com.beust.kobalt.maven.DependencyFactory
import com.beust.kobalt.maven.DependencyManager
import com.beust.kobalt.maven.dependency.FileDependency
import com.beust.kobalt.misc.KFiles
@ -18,7 +18,7 @@ import java.nio.file.Paths
class DependencyData @Inject constructor(val executors: KobaltExecutors, val dependencyManager: DependencyManager,
val buildFileCompilerFactory: BuildFileCompiler.IFactory, val pluginInfo: PluginInfo,
val depFactory: DepFactory) {
val depFactory: DependencyFactory) {
fun dependenciesDataFor(buildFilePath: String, args: Args) : GetDependenciesData {
val projectDatas = arrayListOf<ProjectData>()

View file

@ -2,7 +2,7 @@ package com.beust.kobalt.plugin.apt
import com.beust.kobalt.api.*
import com.beust.kobalt.api.annotation.Directive
import com.beust.kobalt.maven.DepFactory
import com.beust.kobalt.maven.DependencyFactory
import com.beust.kobalt.misc.KFiles
import com.beust.kobalt.misc.log
import com.google.common.collect.ArrayListMultimap
@ -18,7 +18,7 @@ import javax.inject.Singleton
* (outputDir, etc...).
*/
@Singleton
class AptPlugin @Inject constructor(val depFactory: DepFactory, val configActor: ConfigActor<AptConfig>)
class AptPlugin @Inject constructor(val depFactory: DependencyFactory, val configActor: ConfigActor<AptConfig>)
: BasePlugin(), ICompilerFlagContributor, ISourceDirectoryContributor, IConfigActor<AptConfig> by configActor {
// ISourceDirectoryContributor

View file

@ -5,7 +5,7 @@ import com.beust.kobalt.api.*
import com.beust.kobalt.internal.ICompilerAction
import com.beust.kobalt.internal.JvmCompiler
import com.beust.kobalt.kotlin.ParentLastClassLoader
import com.beust.kobalt.maven.DepFactory
import com.beust.kobalt.maven.DependencyFactory
import com.beust.kobalt.maven.DependencyManager
import com.beust.kobalt.maven.dependency.FileDependency
import com.beust.kobalt.misc.KFiles
@ -31,7 +31,7 @@ import kotlin.properties.Delegates
class KotlinCompiler @Inject constructor(
val files: KFiles,
val dependencyManager: DependencyManager,
val depFactory: DepFactory,
val depFactory: DependencyFactory,
val executors: KobaltExecutors,
val jvmCompiler: JvmCompiler) {
companion object {
@ -137,8 +137,7 @@ 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 = executor)
val compilerDep = depFactory.create("org.jetbrains.kotlin:kotlin-compiler-embeddable:$KOTLIN_VERSION")
val deps = dependencyManager.transitiveClosure(listOf(compilerDep))
// Force a download of the compiler dependencies

View file

@ -6,7 +6,7 @@ import com.beust.kobalt.api.*
import com.beust.kobalt.api.annotation.Directive
import com.beust.kobalt.internal.BaseJvmPlugin
import com.beust.kobalt.internal.JvmCompilerPlugin
import com.beust.kobalt.maven.DepFactory
import com.beust.kobalt.maven.DependencyFactory
import com.beust.kobalt.maven.dependency.FileDependency
import com.beust.kobalt.misc.KFiles
import com.beust.kobalt.misc.KobaltExecutors
@ -17,7 +17,7 @@ import javax.inject.Inject
import javax.inject.Singleton
@Singleton
class KotlinPlugin @Inject constructor(val executors: KobaltExecutors, val depFactory: DepFactory,
class KotlinPlugin @Inject constructor(val executors: KobaltExecutors, val depFactory: DependencyFactory,
override val configActor: ConfigActor<KotlinConfig>)
: BaseJvmPlugin<KotlinConfig>(configActor), IDocContributor, IClasspathContributor, ICompilerContributor,
IBuildConfigContributor {

View file

@ -10,7 +10,7 @@ import javax.inject.Inject
import kotlin.properties.Delegates
@Guice(modules = arrayOf(TestModule::class))
public class DependencyTest @Inject constructor(val depFactory: DepFactory,
public class DependencyTest @Inject constructor(val depFactory: DependencyFactory,
val executors: KobaltExecutors) {
@DataProvider

View file

@ -18,7 +18,7 @@ class DownloadTest @Inject constructor(
val localRepo: LocalRepo,
val pomFactory: Pom.IFactory,
val dependencyManager: DependencyManager,
val depFactory: DepFactory,
val depFactory: DependencyFactory,
val aether: KobaltAether,
val executors: KobaltExecutors) : KobaltTest() {
private var executor: ExecutorService by Delegates.notNull()
@ -40,7 +40,7 @@ class DownloadTest @Inject constructor(
if (success) {
arrayListOf("$groupId:$artifactId:$version", "$groupId:$artifactId:$previousVersion").forEach {
val dep = depFactory.create(it, executor = executor)
val dep = depFactory.create(it)
val future = dep.jarFile
val file = future.get()
Assert.assertTrue(file.exists(), "Couldn't find ${file.absolutePath}")
@ -60,7 +60,7 @@ class DownloadTest @Inject constructor(
fun shouldDownloadNoVersion() {
val success = deleteDir()
if (success) {
val dep = depFactory.create(idNoVersion, executor = executor)
val dep = depFactory.create(idNoVersion)
val future = dep.jarFile
val file = future.get()
@ -77,7 +77,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 = executor)
val dep = depFactory.create("javax.servlet:servlet-api:$range")
val future = dep.jarFile
val file = future.get()
Assert.assertEquals(file.name, "servlet-api-$expected.jar")
@ -87,7 +87,7 @@ class DownloadTest @Inject constructor(
@Test
fun shouldFindLocalJar() {
depFactory.create("$idNoVersion$version")
val dep = depFactory.create("$idNoVersion$version", executor = executor)
val dep = depFactory.create("$idNoVersion$version")
val future = dep.jarFile
// Assert.assertTrue(future is CompletedFuture)
val file = future.get()

View file

@ -6,7 +6,7 @@ import org.testng.Assert
import org.testng.annotations.Test
@Test
class PomGenerationTest @Inject constructor(val depFactory: DepFactory): KobaltTest() {
class PomGenerationTest @Inject constructor(val depFactory: DependencyFactory): KobaltTest() {
fun shouldGenerateDependencies() {
val md = depFactory.create("org.testng:testng:6.9.9").toMavenDependencies()
Assert.assertEquals(md.groupId, "org.testng")

View file

@ -10,7 +10,7 @@ import javax.inject.Inject
@Test
@org.testng.annotations.Guice(modules = arrayOf(TestModule::class))
class RemoteRepoTest @Inject constructor(val repoFinder: RepoFinder, val depFactory: DepFactory,
class RemoteRepoTest @Inject constructor(val repoFinder: RepoFinder, val depFactory: DependencyFactory,
@DependencyExecutor val executor: ExecutorService, val args: Args){
@Test