Advertisement
Guest User

Untitled

a guest
Sep 19th, 2019
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. // BluesquarePlugin.kt
  2. open class BluesquarePlugin : Plugin<Project> {
  3. override fun apply(project: Project) {
  4. project.configureAndroid()
  5. project.configureDependencies()
  6. }
  7. }
  8.  
  9. // Dependencies.kt
  10. const val jUnit = "junit:junit:4.12"
  11. const val androidTestRunner = "com.android.support.test:runner:1.0.2"
  12. const val androidTestRules = "com.android.support.test:rules:1.0.2"
  13. const val mockkAndroid = "io.mockk:mockk-android:1.9"
  14. const val mockk = "io.mockk:mockk:1.9"
  15. const val espressoCore = "com.android.support.test.espresso:espresso-core:3.0.2"
  16.  
  17. internal fun Project.configureDependencies() = dependencies {
  18. add("testImplementation", jUnit)
  19.  
  20. if (project.containsAndroidPlugin()) {
  21. add("androidTestImplementation", androidTestRunner)
  22. add("androidTestImplementation", androidTestRules)
  23. add("androidTestImplementation", espressoCore)
  24. }
  25. }
  26.  
  27. internal fun Project.containsAndroidPlugin(): Boolean {
  28. return project.plugins.toList().any { plugin -> plugin is AndroidBasePlugin }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement