mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
Shut down actors.
This commit is contained in:
parent
234172a1a7
commit
4a43d17288
4 changed files with 28 additions and 1 deletions
|
@ -1,6 +1,11 @@
|
||||||
package com.beust.kobalt.api
|
package com.beust.kobalt.api
|
||||||
|
|
||||||
interface IPluginActor
|
interface IPluginActor {
|
||||||
|
/**
|
||||||
|
* Clean up any state that your actor might have saved so it can be run again.
|
||||||
|
*/
|
||||||
|
fun shutdownActors() {}
|
||||||
|
}
|
||||||
|
|
||||||
interface IContributor : IPluginActor
|
interface IContributor : IPluginActor
|
||||||
|
|
||||||
|
|
|
@ -226,8 +226,13 @@ open class JvmCompilerPlugin @Inject constructor(
|
||||||
|
|
||||||
val allProjects = arrayListOf<ProjectDescription>()
|
val allProjects = arrayListOf<ProjectDescription>()
|
||||||
|
|
||||||
|
// IProjectContributor
|
||||||
override fun projects() = allProjects
|
override fun projects() = allProjects
|
||||||
|
|
||||||
|
override fun shutdownActors() {
|
||||||
|
allProjects.clear()
|
||||||
|
}
|
||||||
|
|
||||||
fun addDependentProjects(project: Project, dependents: List<Project>) {
|
fun addDependentProjects(project: Project, dependents: List<Project>) {
|
||||||
project.projectExtra.dependsOn.addAll(dependents)
|
project.projectExtra.dependsOn.addAll(dependents)
|
||||||
with(ProjectDescription(project, dependents)) {
|
with(ProjectDescription(project, dependents)) {
|
||||||
|
|
|
@ -168,6 +168,22 @@ class PluginInfo(val xml: KobaltPluginXml, val classLoader: ClassLoader?) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun shutdown() {
|
||||||
|
listOf(projectContributors, classpathContributors, initContributors,
|
||||||
|
repoContributors, compilerFlagContributors, compilerInterceptors,
|
||||||
|
sourceDirectoriesInterceptors, buildDirectoryInterceptors,
|
||||||
|
runnerContributors, testRunnerContributors, classpathInterceptors,
|
||||||
|
compilerContributors, docContributors, sourceDirContributors,
|
||||||
|
testSourceDirContributors, buildConfigFieldContributors,
|
||||||
|
taskContributors, assemblyContributors,
|
||||||
|
incrementalAssemblyContributors
|
||||||
|
).forEach {
|
||||||
|
it.forEach {
|
||||||
|
it.shutdownActors()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Populate pluginInfo with what was found in the plug-in's kobalt-plugin.xml
|
* Populate pluginInfo with what was found in the plug-in's kobalt-plugin.xml
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -45,6 +45,7 @@ fun mainNoExit(argv: Array<String>): Int {
|
||||||
Kobalt.INJECTOR = Guice.createInjector(MainModule(args, KobaltSettings.readSettingsXml()))
|
Kobalt.INJECTOR = Guice.createInjector(MainModule(args, KobaltSettings.readSettingsXml()))
|
||||||
val result = Kobalt.INJECTOR.getInstance(Main::class.java).run {
|
val result = Kobalt.INJECTOR.getInstance(Main::class.java).run {
|
||||||
val runResult = run(jc, args, argv)
|
val runResult = run(jc, args, argv)
|
||||||
|
pluginInfo.shutdown()
|
||||||
executors.shutdown()
|
executors.shutdown()
|
||||||
runResult
|
runResult
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue