kapt: Support inherited annotations in Gradle
This commit is contained in:
+2
@@ -23,6 +23,8 @@ public open class KaptExtension {
|
||||
|
||||
public open var generateStubs: Boolean = false
|
||||
|
||||
public open var inheritedAnnotations: Boolean = true
|
||||
|
||||
private var closure: Closure<*>? = null
|
||||
|
||||
public open fun arguments(closure: Closure<*>) {
|
||||
|
||||
+10
-3
@@ -536,7 +536,7 @@ private class SubpluginEnvironment(
|
||||
}
|
||||
}
|
||||
|
||||
val extraProperties = compileTask.getExtensions().getExtraProperties()
|
||||
val extraProperties = compileTask.extraProperties
|
||||
extraProperties.set("compilerPluginClasspaths", realPluginClasspaths.toTypedArray())
|
||||
extraProperties.set("compilerPluginArguments", pluginArguments.toTypedArray())
|
||||
}
|
||||
@@ -563,7 +563,7 @@ open class GradleUtils(val scriptHandler: ScriptHandler, val project: ProjectInt
|
||||
}
|
||||
|
||||
private fun AbstractCompile.storeKaptAnnotationsFile(kapt: AnnotationProcessingManager) {
|
||||
getExtensions().getExtraProperties().set("kaptAnnotationsFile", kapt.getAnnotationFile())
|
||||
extraProperties.set("kaptAnnotationsFile", kapt.getAnnotationFile())
|
||||
}
|
||||
|
||||
private fun Project.getAptDirsForSourceSet(kotlinTask: AbstractCompile, sourceSetName: String): Pair<File, File> {
|
||||
@@ -607,7 +607,7 @@ private fun Project.initKapt(
|
||||
kotlinTask.getLogger().kotlinDebug("kapt: Using class file stubs")
|
||||
|
||||
val stubsDir = File(getBuildDir(), "tmp/kapt/$variantName/classFileStubs")
|
||||
kotlinTask.getExtensions().getExtraProperties().set("stubsDir", stubsDir)
|
||||
kotlinTask.extraProperties.set("kaptStubsDir", stubsDir)
|
||||
|
||||
javaTask.setClasspath(javaTask.getClasspath() + files(stubsDir))
|
||||
|
||||
@@ -621,6 +621,10 @@ private fun Project.initKapt(
|
||||
kotlinTask.getLogger().kotlinDebug("kapt: Class file stubs are not used")
|
||||
}
|
||||
|
||||
if (kaptExtension.inheritedAnnotations) {
|
||||
kotlinTask.extraProperties.set("kaptInheritedAnnotations", true)
|
||||
}
|
||||
|
||||
kotlinTask.doFirst {
|
||||
kaptManager.generateJavaHackFile()
|
||||
}
|
||||
@@ -682,6 +686,9 @@ private fun loadAndroidPluginVersion(): String? {
|
||||
}
|
||||
}
|
||||
|
||||
private val AbstractCompile.extraProperties: ExtraPropertiesExtension
|
||||
get() = getExtensions().getExtraProperties()
|
||||
|
||||
//Copied from StringUtil.compareVersionNumbers
|
||||
private fun compareVersionNumbers(v1: String?, v2: String?): Int {
|
||||
if (v1 == null && v2 == null) {
|
||||
|
||||
Reference in New Issue
Block a user