AllOpen, NoArg: Use presets in Gradle plugins
This commit is contained in:
+1
-1
@@ -23,6 +23,6 @@ class KotlinJpaSubplugin : Plugin<Project> {
|
||||
override fun apply(project: Project) {
|
||||
project.plugins.apply(NoArgGradleSubplugin::class.java)
|
||||
val noArgExtension = NoArgGradleSubplugin.getNoArgExtension(project)
|
||||
noArgExtension.annotation("javax.persistence.Entity")
|
||||
noArgExtension.myPresets += "jpa"
|
||||
}
|
||||
}
|
||||
+1
@@ -18,6 +18,7 @@ package org.jetbrains.kotlin.noarg.gradle
|
||||
|
||||
open class NoArgExtension {
|
||||
internal val myAnnotations = mutableListOf<String>()
|
||||
internal val myPresets = mutableListOf<String>()
|
||||
|
||||
open fun annotation(fqName: String) {
|
||||
myAnnotations.add(fqName)
|
||||
|
||||
+7
-2
@@ -67,7 +67,8 @@ class NoArgKotlinGradleSubplugin : KotlinGradleSubplugin<AbstractCompile> {
|
||||
val NOARG_GROUP_NAME = "org.jetbrains.kotlin"
|
||||
val NOARG_ARTIFACT_NAME = "kotlin-noarg"
|
||||
|
||||
private val ANNOTATIONS_ARG_NAME = "annotation"
|
||||
private val ANNOTATION_ARG_NAME = "annotation"
|
||||
private val PRESET_ARG_NAME = "preset"
|
||||
}
|
||||
|
||||
override fun isApplicable(project: Project, task: AbstractCompile) = NoArgGradleSubplugin.isEnabled(project)
|
||||
@@ -86,7 +87,11 @@ class NoArgKotlinGradleSubplugin : KotlinGradleSubplugin<AbstractCompile> {
|
||||
val options = mutableListOf<SubpluginOption>()
|
||||
|
||||
for (anno in noArgExtension.myAnnotations) {
|
||||
options += SubpluginOption(ANNOTATIONS_ARG_NAME, anno)
|
||||
options += SubpluginOption(ANNOTATION_ARG_NAME, anno)
|
||||
}
|
||||
|
||||
for (preset in noArgExtension.myPresets) {
|
||||
options += SubpluginOption(PRESET_ARG_NAME, preset)
|
||||
}
|
||||
|
||||
return options
|
||||
|
||||
Reference in New Issue
Block a user