Created
September 9, 2019 08:34
-
-
Save LizzieStudeneer/0d03b6cbcd67e2a3d6c3361a4367ab5d to your computer and use it in GitHub Desktop.
This file contains 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
// BluesquarePlugin.kt | |
open class BluesquarePlugin : Plugin<Project> { | |
override fun apply(project: Project) { | |
project.configureAndroid() | |
project.configureDependencies() | |
} | |
} | |
// Dependencies.kt | |
const val jUnit = "junit:junit:4.12" | |
const val androidTestRunner = "com.android.support.test:runner:1.0.2" | |
const val androidTestRules = "com.android.support.test:rules:1.0.2" | |
const val mockkAndroid = "io.mockk:mockk-android:1.9" | |
const val mockk = "io.mockk:mockk:1.9" | |
const val espressoCore = "com.android.support.test.espresso:espresso-core:3.0.2" | |
internal fun Project.configureDependencies() = dependencies { | |
add("testImplementation", jUnit) | |
if (project.containsAndroidPlugin()) { | |
add("androidTestImplementation", androidTestRunner) | |
add("androidTestImplementation", androidTestRules) | |
add("androidTestImplementation", espressoCore) | |
} | |
} | |
internal fun Project.containsAndroidPlugin(): Boolean { | |
return project.plugins.toList().any { plugin -> plugin is AndroidBasePlugin } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment