From 6d20a719ccb09ff3843f1b6c92896dfff0640704 Mon Sep 17 00:00:00 2001 From: Mattia Tommasone Date: Thu, 13 Jan 2022 22:10:57 +0100 Subject: [PATCH] Convert to Kotlin --- mockk/android/build.gradle | 70 -------------------------------- mockk/android/build.gradle.kts | 74 ++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+), 70 deletions(-) delete mode 100644 mockk/android/build.gradle create mode 100644 mockk/android/build.gradle.kts diff --git a/mockk/android/build.gradle b/mockk/android/build.gradle deleted file mode 100644 index b836d1f94..000000000 --- a/mockk/android/build.gradle +++ /dev/null @@ -1,70 +0,0 @@ -plugins { - id("mpp-android") -} - -ext { - mavenName = 'MockK Android' - mavenDescription = 'mocking library for Kotlin (Android instrumented test)' -} -apply from: "${gradles}/upload.gradle" - -android { - compileSdkVersion 'android-31' - - lintOptions { - abortOnError false - disable 'InvalidPackage' - warning 'NewApi' - } - - packagingOptions { - exclude 'META-INF/main.kotlin_module' - exclude 'META-INF/LICENSE.md' - exclude 'META-INF/LICENSE-notice.md' - } - - defaultConfig { - minSdkVersion 21 - targetSdkVersion 31 - versionName project['version'] - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" - testInstrumentationRunnerArgument "notAnnotation", "io.mockk.test.SkipInstrumentedAndroidTest" - } - - sourceSets { - androidTest.kotlin.srcDirs += '../common/src/test/kotlin' - } - - compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - } - -} - -dependencies { - api "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - // very weird hack to make it working in IDE (check settings.gradle) - def mockKProject = findProject(':mockk-jvm') ?: project(":mockk") - api(mockKProject, { - exclude group: 'io.mockk', module: 'mockk-agent-jvm' - }) - implementation project(":mockk-agent-android") - implementation project(":mockk-agent-api") - - testImplementation 'junit:junit:4.13.1' - androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.2', { - exclude group: 'com.android.support', module: 'support-annotations' - }) - androidTestImplementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" - androidTestImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version" - androidTestImplementation("org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version") { - exclude group: "junit", module: "junit" - } - androidTestImplementation 'com.android.support.test:rules:1.0.2' - - androidTestImplementation "org.junit.jupiter:junit-jupiter-api:$junit_jupiter_version" - androidTestImplementation "org.junit.jupiter:junit-jupiter-engine:$junit_jupiter_version" - androidTestImplementation "org.junit.vintage:junit-vintage-engine:$junit_vintage_version" -} - diff --git a/mockk/android/build.gradle.kts b/mockk/android/build.gradle.kts new file mode 100644 index 000000000..d5ade77fa --- /dev/null +++ b/mockk/android/build.gradle.kts @@ -0,0 +1,74 @@ +import io.mockk.dependencies.Deps +import io.mockk.dependencies.kotlinVersion + +plugins { + id("mpp-android") +} + +extra["mavenName"] = "MockK Android" +extra["mavenDescription"] = "mocking library for Kotlin (Android instrumented test)" + +apply(from = "${rootProject.extensions.extraProperties["gradles"]}/upload.gradle") + +android { + compileSdkVersion("android-31") + + + lintOptions { + isAbortOnError = false + disable("InvalidPackage") + warning("NewApi") + } + + packagingOptions { + exclude("META-INF/main.kotlin_module") + exclude("META-INF/LICENSE.md") + exclude("META-INF/LICENSE-notice.md") + } + + defaultConfig { + minSdk = 21 + targetSdk = 31 + versionName = "${project.version}" + testInstrumentationRunner = "android.support.test.runner.AndroidJUnitRunner" + testInstrumentationRunnerArguments + testInstrumentationRunnerArguments["notAnnotation"] = "io.mockk.test.SkipInstrumentedAndroidTest" + } + + sourceSets { + getByName("androidTest").assets.srcDirs("$projectDir/common/src/test/kotlin") + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + +} + +// very weird hack to make it working in IDE (check settings.gradle) +val mockKProject = findProject(":mockk-jvm")?.project ?: project(":mockk") + +dependencies { + api(project(":${mockKProject.name}")) { + exclude(group = "io.mockk", module = "mockk-agent-jvm") + } + implementation(project(":mockk-agent-android")) + implementation(project(":mockk-agent-api")) + + testImplementation("junit:junit:4.13.1") + androidTestImplementation("com.android.support.test.espresso:espresso-core:3.0.2") { + exclude(group = "com.android.support", module = "support-annotations") + } + androidTestImplementation(Deps.Libs.kotlinReflect(kotlinVersion())) + androidTestImplementation(Deps.Libs.kotlinCoroutinesCore()) + androidTestImplementation(Deps.Libs.kotlinTestJunit()) { + exclude(group = "junit", module = "junit") + } + androidTestImplementation("com.android.support.test:rules:1.0.2") + + androidTestImplementation(Deps.Libs.junitJupiterApi) + androidTestImplementation(Deps.Libs.junitJupiterEngine) + androidTestImplementation(Deps.Libs.junitVintageEngine) +} +