diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/api/KobaltContext.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/api/KobaltContext.kt index a503e9de..c927517d 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/api/KobaltContext.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/api/KobaltContext.kt @@ -9,6 +9,7 @@ import com.beust.kobalt.internal.KobaltSettings import com.beust.kobalt.internal.PluginInfo import com.beust.kobalt.maven.DependencyManager import com.beust.kobalt.maven.MavenId +import com.beust.kobalt.maven.PomGenerator import com.beust.kobalt.maven.SimpleDep import com.beust.kobalt.maven.aether.KobaltAether import com.beust.kobalt.misc.KobaltExecutors @@ -59,6 +60,11 @@ class KobaltContext(val args: Args) { } } + /** + * @return the content of the pom.xml for the given project. + */ + fun generatePom(project: Project) = pomGeneratorFactory.create(project).generate() + /** All the projects that are being built during this run */ val allProjects = arrayListOf() @@ -75,6 +81,7 @@ class KobaltContext(val args: Args) { lateinit var settings: KobaltSettings lateinit var incrementalManager: IncrementalManager lateinit var aether: KobaltAether + lateinit var pomGeneratorFactory: PomGenerator.IFactory } class InternalContext { diff --git a/src/main/kotlin/com/beust/kobalt/app/BuildFileCompiler.kt b/src/main/kotlin/com/beust/kobalt/app/BuildFileCompiler.kt index e8df5998..9229ea87 100644 --- a/src/main/kotlin/com/beust/kobalt/app/BuildFileCompiler.kt +++ b/src/main/kotlin/com/beust/kobalt/app/BuildFileCompiler.kt @@ -14,6 +14,7 @@ import com.beust.kobalt.internal.PluginInfo import com.beust.kobalt.internal.build.BuildFile import com.beust.kobalt.internal.build.VersionFile import com.beust.kobalt.maven.DependencyManager +import com.beust.kobalt.maven.PomGenerator import com.beust.kobalt.maven.aether.KobaltAether import com.beust.kobalt.misc.KFiles import com.beust.kobalt.misc.KobaltExecutors @@ -35,7 +36,7 @@ public class BuildFileCompiler @Inject constructor(@Assisted("buildFiles") val b val dependencyManager: DependencyManager, val pluginProperties: PluginProperties, val executors: KobaltExecutors, val buildScriptUtil: BuildScriptUtil, val settings: KobaltSettings, val incrementalManagerFactory: IncrementalManager.IFactory, val args: Args, - val aether: KobaltAether) { + val aether: KobaltAether, val pomGeneratorFactory: PomGenerator.IFactory) { interface IFactory { fun create(@Assisted("buildFiles") buildFiles: List, pluginInfo: PluginInfo) : BuildFileCompiler @@ -56,6 +57,7 @@ public class BuildFileCompiler @Inject constructor(@Assisted("buildFiles") val b context.settings = settings context.incrementalManager = incrementalManagerFactory.create() context.aether = aether + context.pomGeneratorFactory = pomGeneratorFactory Kobalt.context = context //