com.flyjingfish.android_aop_plugin.AndroidAopPlugin.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of android-aop-plugin Show documentation
Show all versions of android-aop-plugin Show documentation
Lightweight Aop for Android platform, you deserve it, action is worse than your heartbeat
package com.flyjingfish.android_aop_plugin
import com.android.build.gradle.AppPlugin
import com.flyjingfish.android_aop_plugin.config.AndroidAopConfig
import com.flyjingfish.android_aop_plugin.plugin.CompilePlugin
import com.flyjingfish.android_aop_plugin.plugin.TransformPlugin
import org.gradle.api.Plugin
import org.gradle.api.Project
class AndroidAopPlugin : Plugin {
override fun apply(project: Project) {
project.extensions.add("androidAopConfig", AndroidAopConfig::class.java)
if (project.rootProject == project){
project.rootProject.childProjects.forEach { (_,value)->
value.afterEvaluate {
val notApp = !it.plugins.hasPlugin(AppPlugin::class.java)
val noneHasAop = !it.plugins.hasPlugin("android.aop")
if (notApp && noneHasAop && it.hasProperty("android")){
CompilePlugin(true).apply(it)
}
}
}
}
CompilePlugin(false).apply(project)
TransformPlugin.apply(project)
}
}