Created
September 6, 2019 07:18
-
-
Save quickbirdstudios-eng/7e3048eeb50a24298c345463952df552 to your computer and use it in GitHub Desktop.
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
// 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