mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
Clean up the Aether.kt file.
This commit is contained in:
parent
9286265f0d
commit
0885fb3e4a
4 changed files with 24 additions and 18 deletions
|
@ -225,7 +225,7 @@ class DependencyManager @Inject constructor(val executors: KobaltExecutors,
|
||||||
: List<IClasspathDependency> {
|
: List<IClasspathDependency> {
|
||||||
val transitive = hashSetOf<IClasspathDependency>()
|
val transitive = hashSetOf<IClasspathDependency>()
|
||||||
with(project) {
|
with(project) {
|
||||||
val scopeFilters = arrayListOf(Scope.COMPILE)
|
val scopeFilters : ArrayList<Scope> = arrayListOf(Scope.COMPILE)
|
||||||
context.variant.let { variant ->
|
context.variant.let { variant ->
|
||||||
val deps = arrayListOf(compileDependencies, compileProvidedDependencies,
|
val deps = arrayListOf(compileDependencies, compileProvidedDependencies,
|
||||||
variant.buildType.compileDependencies,
|
variant.buildType.compileDependencies,
|
||||||
|
|
|
@ -2,7 +2,6 @@ package com.beust.kobalt.maven.aether
|
||||||
|
|
||||||
import com.beust.kobalt.api.IClasspathDependency
|
import com.beust.kobalt.api.IClasspathDependency
|
||||||
import com.beust.kobalt.api.Kobalt
|
import com.beust.kobalt.api.Kobalt
|
||||||
import com.beust.kobalt.api.Project
|
|
||||||
import com.beust.kobalt.maven.CompletedFuture
|
import com.beust.kobalt.maven.CompletedFuture
|
||||||
import com.beust.kobalt.maven.LocalDep
|
import com.beust.kobalt.maven.LocalDep
|
||||||
import com.beust.kobalt.maven.LocalRepo
|
import com.beust.kobalt.maven.LocalRepo
|
||||||
|
@ -10,25 +9,9 @@ import com.beust.kobalt.maven.MavenId
|
||||||
import com.beust.kobalt.misc.Versions
|
import com.beust.kobalt.misc.Versions
|
||||||
import com.beust.kobalt.misc.warn
|
import com.beust.kobalt.misc.warn
|
||||||
import org.eclipse.aether.artifact.Artifact
|
import org.eclipse.aether.artifact.Artifact
|
||||||
import org.eclipse.aether.util.artifact.JavaScopes
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.concurrent.Future
|
import java.util.concurrent.Future
|
||||||
|
|
||||||
enum class Scope(val scope: String, val dependencyLambda: (Project) -> List<IClasspathDependency>) {
|
|
||||||
COMPILE(JavaScopes.COMPILE, Project::compileDependencies),
|
|
||||||
PROVIDED(JavaScopes.PROVIDED, Project::compileProvidedDependencies),
|
|
||||||
SYSTEM(JavaScopes.SYSTEM, { project -> emptyList() }),
|
|
||||||
RUNTIME(JavaScopes.RUNTIME, Project::compileRuntimeDependencies),
|
|
||||||
TEST(JavaScopes.TEST, Project::testDependencies)
|
|
||||||
;
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
fun toScopes(isTest: Boolean) = if (isTest) listOf(Scope.TEST, Scope.COMPILE) else listOf(Scope.COMPILE)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class DependencyResult(val dependency: IClasspathDependency, val repoUrl: String)
|
|
||||||
|
|
||||||
class AetherDependency(val artifact: Artifact, override val optional: Boolean = false)
|
class AetherDependency(val artifact: Artifact, override val optional: Boolean = false)
|
||||||
: IClasspathDependency, Comparable<AetherDependency> {
|
: IClasspathDependency, Comparable<AetherDependency> {
|
||||||
val aether: KobaltMavenResolver get() = Kobalt.INJECTOR.getInstance(KobaltMavenResolver::class.java)
|
val aether: KobaltMavenResolver get() = Kobalt.INJECTOR.getInstance(KobaltMavenResolver::class.java)
|
|
@ -0,0 +1,5 @@
|
||||||
|
package com.beust.kobalt.maven.aether
|
||||||
|
|
||||||
|
import com.beust.kobalt.api.IClasspathDependency
|
||||||
|
|
||||||
|
class DependencyResult(val dependency: IClasspathDependency, val repoUrl: String)
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.beust.kobalt.maven.aether
|
||||||
|
|
||||||
|
import com.beust.kobalt.api.IClasspathDependency
|
||||||
|
import com.beust.kobalt.api.Project
|
||||||
|
import org.eclipse.aether.util.artifact.JavaScopes
|
||||||
|
|
||||||
|
sealed class Scope(val scope: String, val dependencyLambda: (Project) -> List<IClasspathDependency>) {
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun toScopes(isTest: Boolean) = if (isTest) listOf(TEST, COMPILE) else listOf(COMPILE)
|
||||||
|
}
|
||||||
|
|
||||||
|
object COMPILE : Scope(JavaScopes.COMPILE, Project::compileDependencies)
|
||||||
|
object PROVIDED : Scope(JavaScopes.PROVIDED, Project::compileProvidedDependencies)
|
||||||
|
object SYSTEM : Scope(JavaScopes.SYSTEM, { project -> emptyList() })
|
||||||
|
object RUNTIME : Scope(JavaScopes.RUNTIME, Project::compileRuntimeDependencies)
|
||||||
|
object TEST : Scope(JavaScopes.TEST, Project::testDependencies)
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue