Created
August 19, 2019 07:25
-
-
Save Hackforid/fce754688668b3a6baaa10f80cf554f8 to your computer and use it in GitHub Desktop.
ButterKnife-Reflection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.gradle.api.Plugin | |
import org.gradle.api.Project | |
class ButterKnifePlugin: Plugin<Project> { | |
private val KAPT_NAME = "kapt" | |
private val APT_NAME = "annotationProcessor" | |
private val KOTLIN_KAPT_PLUGIN_ID = "org.jetbrains.kotlin.kapt" | |
private val BUTTER_KNIFE_PLUGIN_ID = "com.jakewharton.butterknife" | |
override fun apply(project: Project) { | |
val useKapt = project.pluginManager.hasPlugin(KOTLIN_KAPT_PLUGIN_ID) | |
System.out.println("use kapt = $useKapt") | |
if (!project.pluginManager.hasPlugin(BUTTER_KNIFE_PLUGIN_ID)) { | |
project.pluginManager.apply(BUTTER_KNIFE_PLUGIN_ID) | |
} | |
// project.dependencies.add(if (useKapt) KAPT_NAME else APT_NAME, "com.jakewharton:butterknife-compiler:8.6.0") | |
// project.dependencies.add("implementation", "com.smile.gifshow.butterknife:butterknife:8.5.1.1") | |
// state.env.put("isModuleApp", gradle.rootProject.extensions.getByName("ext").properties.getOrDefault("isModuleApplication", false)) | |
project.dependencies.add("implementation", "com.jakewharton:butterknife-reflect:9.0.0") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment