mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-25 16:07:12 -07:00
Add javadoc { args() }.
This commit is contained in:
parent
c0ed9a5a03
commit
13f544d67c
1 changed files with 24 additions and 2 deletions
|
@ -44,9 +44,18 @@ class JavaPlugin @Inject constructor(val javaCompiler: JavaCompiler, override va
|
||||||
// IDocFlagContributor
|
// IDocFlagContributor
|
||||||
override fun docFlagsFor(project: Project, context: KobaltContext, currentFlags: List<String>,
|
override fun docFlagsFor(project: Project, context: KobaltContext, currentFlags: List<String>,
|
||||||
suffixesBeingCompiled: List<String>): List<String> {
|
suffixesBeingCompiled: List<String>): List<String> {
|
||||||
return listOf("-d", "javadoc", "-Xdoclint:none", "-Xmaxerrs", "1", "-quiet")
|
val config = javadocConfigurations[project.name]
|
||||||
|
val args = config?.args ?: DEFAULT_JAVADOC_ARGS
|
||||||
|
return args
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val DEFAULT_JAVADOC_ARGS = listOf("-d", "javadoc", "-Xdoclint:none", "-Xmaxerrs", "1", "-quiet")
|
||||||
|
|
||||||
|
val javadocConfigurations = hashMapOf<String, JavadocConfig>()
|
||||||
|
|
||||||
|
fun addJavadocConfiguration(project: Project, configuration: JavadocConfig)
|
||||||
|
= javadocConfigurations.put(project.name, configuration)
|
||||||
|
|
||||||
// ICompilerContributor
|
// ICompilerContributor
|
||||||
val compiler = CompilerDescription(PLUGIN_NAME, "java", SOURCE_SUFFIXES, javaCompiler)
|
val compiler = CompilerDescription(PLUGIN_NAME, "java", SOURCE_SUFFIXES, javaCompiler)
|
||||||
|
|
||||||
|
@ -78,3 +87,16 @@ fun Project.javaCompiler(init: JavaConfig.() -> Unit) =
|
||||||
config.init()
|
config.init()
|
||||||
(Kobalt.findPlugin(JavaPlugin.PLUGIN_NAME) as JavaPlugin).addConfiguration(this, config)
|
(Kobalt.findPlugin(JavaPlugin.PLUGIN_NAME) as JavaPlugin).addConfiguration(this, config)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class JavadocConfig(val project: Project) {
|
||||||
|
val args = arrayListOf<String>()
|
||||||
|
fun args(vararg options: String) = args.addAll(options)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Directive
|
||||||
|
fun Project.javadoc(init: JavadocConfig.() -> Unit) =
|
||||||
|
JavadocConfig(this).also { config ->
|
||||||
|
config.init()
|
||||||
|
(Kobalt.findPlugin(JavaPlugin.PLUGIN_NAME) as JavaPlugin).addJavadocConfiguration(this, config)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue