mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 00:17:11 -07:00
Introducing ILocalMavenRepoPathInterceptor.
This commit is contained in:
parent
19d18bce82
commit
2251a1254a
3 changed files with 24 additions and 2 deletions
|
@ -4,6 +4,7 @@ import com.beust.kobalt.api.IClasspathDependency
|
|||
import com.beust.kobalt.api.Kobalt
|
||||
import com.beust.kobalt.api.annotation.Directive
|
||||
import com.beust.kobalt.internal.KobaltSettings
|
||||
import com.beust.kobalt.internal.PluginInfo
|
||||
import com.beust.kobalt.maven.DependencyManager
|
||||
import com.beust.kobalt.maven.dependency.FileDependency
|
||||
import org.eclipse.aether.repository.Proxy
|
||||
|
@ -71,5 +72,15 @@ fun authRepo(init: HostConfig.() -> Unit) = HostConfig().apply { init() }
|
|||
@Directive
|
||||
fun glob(g: String) : IFileSpec.GlobSpec = IFileSpec.GlobSpec(g)
|
||||
|
||||
/**
|
||||
* The location of the local Maven repository.
|
||||
*/
|
||||
@Directive
|
||||
fun localMaven() = file(Kobalt.INJECTOR.getInstance(KobaltSettings::class.java).localMavenRepo.path)
|
||||
fun localMaven() : String {
|
||||
var result = file(Kobalt.INJECTOR.getInstance(KobaltSettings::class.java).localMavenRepo.path)
|
||||
val pluginInfo = Kobalt.INJECTOR.getInstance(PluginInfo::class.java)
|
||||
pluginInfo.localMavenRepoPathInterceptors.forEach {
|
||||
result = it.repoPath(result)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
package com.beust.kobalt.api
|
||||
|
||||
/**
|
||||
* Plug-ins that want to
|
||||
*/
|
||||
interface ILocalMavenRepoPathInterceptor : IInterceptor {
|
||||
fun repoPath(currentPath: String) : String
|
||||
}
|
|
@ -95,6 +95,7 @@ class PluginInfo(val xml: KobaltPluginXml, val pluginClassLoader: ClassLoader?,
|
|||
val buildConfigContributors = arrayListOf<IBuildConfigContributor>()
|
||||
val mavenIdInterceptors = arrayListOf<IMavenIdInterceptor>()
|
||||
val jvmFlagContributors = arrayListOf<IJvmFlagContributor>()
|
||||
val localMavenRepoPathInterceptors = arrayListOf<ILocalMavenRepoPathInterceptor>()
|
||||
|
||||
// Note: intentionally repeating them here even though they are defined by our base class so
|
||||
// that this class always contains the full list of contributors and interceptors
|
||||
|
@ -210,6 +211,7 @@ class PluginInfo(val xml: KobaltPluginXml, val pluginClassLoader: ClassLoader?,
|
|||
if (this is ITestJvmFlagContributor) testJvmFlagContributors.add(this)
|
||||
if (this is ITestJvmFlagInterceptor) testJvmFlagInterceptors.add(this)
|
||||
if (this is IJvmFlagContributor) jvmFlagContributors.add(this)
|
||||
if (this is ILocalMavenRepoPathInterceptor) localMavenRepoPathInterceptors.add(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -223,7 +225,7 @@ class PluginInfo(val xml: KobaltPluginXml, val pluginClassLoader: ClassLoader?,
|
|||
testSourceDirContributors, buildConfigFieldContributors,
|
||||
taskContributors, incrementalTaskContributors, assemblyContributors,
|
||||
incrementalAssemblyContributors, testJvmFlagInterceptors,
|
||||
jvmFlagContributors
|
||||
jvmFlagContributors, localMavenRepoPathInterceptors
|
||||
).forEach {
|
||||
it.forEach {
|
||||
it.cleanUpActors()
|
||||
|
@ -263,6 +265,7 @@ class PluginInfo(val xml: KobaltPluginXml, val pluginClassLoader: ClassLoader?,
|
|||
testJvmFlagContributors.addAll(pluginInfo.testJvmFlagContributors)
|
||||
testJvmFlagInterceptors.addAll(pluginInfo.testJvmFlagInterceptors)
|
||||
jvmFlagContributors.addAll(pluginInfo.jvmFlagContributors)
|
||||
localMavenRepoPathInterceptors.addAll(pluginInfo.localMavenRepoPathInterceptors)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue