Tests in their own module so that they can run on Android with the connectedCheck task
This commit is contained in:
parent
ffe4cc41dc
commit
17dd83e476
@ -36,12 +36,6 @@ kotlin {
|
||||
implementation(kotlin("stdlib-common"))
|
||||
}
|
||||
}
|
||||
val commonTest by sourceSets.getting {
|
||||
dependencies {
|
||||
implementation(kotlin("test-common"))
|
||||
implementation(kotlin("test-annotations-common"))
|
||||
}
|
||||
}
|
||||
|
||||
jvm {
|
||||
compilations.all {
|
||||
@ -50,11 +44,6 @@ kotlin {
|
||||
compilations["main"].dependencies {
|
||||
implementation(kotlin("stdlib-jdk8"))
|
||||
}
|
||||
compilations["test"].dependencies {
|
||||
implementation(project(":jni:jvm"))
|
||||
implementation(kotlin("stdlib-jdk8"))
|
||||
implementation(kotlin("test-junit"))
|
||||
}
|
||||
}
|
||||
|
||||
fun org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget.secp256k1CInterop(target: String) {
|
||||
@ -89,27 +78,31 @@ kotlin {
|
||||
}
|
||||
|
||||
// Disable cross compilation
|
||||
afterEvaluate {
|
||||
val currentOs = org.gradle.internal.os.OperatingSystem.current()
|
||||
val targets = when {
|
||||
currentOs.isLinux -> listOf()
|
||||
currentOs.isMacOsX -> listOf("linux")
|
||||
currentOs.isWindows -> listOf("linux")
|
||||
else -> listOf("linux")
|
||||
}.mapNotNull { kotlin.targets.findByName(it) as? org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget }
|
||||
allprojects {
|
||||
plugins.withId("org.jetbrains.kotlin.multiplatform") {
|
||||
afterEvaluate {
|
||||
val currentOs = org.gradle.internal.os.OperatingSystem.current()
|
||||
val targets = when {
|
||||
currentOs.isLinux -> listOf()
|
||||
currentOs.isMacOsX -> listOf("linux")
|
||||
currentOs.isWindows -> listOf("linux")
|
||||
else -> listOf("linux")
|
||||
}.mapNotNull { kotlin.targets.findByName(it) as? org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget }
|
||||
|
||||
configure(targets) {
|
||||
compilations.all {
|
||||
cinterops.all { tasks[interopProcessingTaskName].enabled = false }
|
||||
compileKotlinTask.enabled = false
|
||||
tasks[processResourcesTaskName].enabled = false
|
||||
}
|
||||
binaries.all { linkTask.enabled = false }
|
||||
configure(targets) {
|
||||
compilations.all {
|
||||
cinterops.all { tasks[interopProcessingTaskName].enabled = false }
|
||||
compileKotlinTask.enabled = false
|
||||
tasks[processResourcesTaskName].enabled = false
|
||||
}
|
||||
binaries.all { linkTask.enabled = false }
|
||||
|
||||
mavenPublication {
|
||||
val publicationToDisable = this
|
||||
tasks.withType<AbstractPublishToMaven>().all { onlyIf { publication != publicationToDisable } }
|
||||
tasks.withType<GenerateModuleMetadata>().all { onlyIf { publication.get() != publicationToDisable } }
|
||||
mavenPublication {
|
||||
val publicationToDisable = this
|
||||
tasks.withType<AbstractPublishToMaven>().all { onlyIf { publication != publicationToDisable } }
|
||||
tasks.withType<GenerateModuleMetadata>().all { onlyIf { publication.get() != publicationToDisable } }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,6 @@ include(
|
||||
":native",
|
||||
":jni",
|
||||
":jni:android",
|
||||
":jni:jvm"
|
||||
// ":jni"
|
||||
":jni:jvm",
|
||||
":tests"
|
||||
)
|
73
tests/build.gradle.kts
Normal file
73
tests/build.gradle.kts
Normal file
@ -0,0 +1,73 @@
|
||||
plugins {
|
||||
kotlin("multiplatform")
|
||||
id("com.android.library")
|
||||
}
|
||||
|
||||
kotlin {
|
||||
explicitApi()
|
||||
|
||||
val commonMain by sourceSets.getting {
|
||||
dependencies {
|
||||
implementation(kotlin("stdlib-common"))
|
||||
implementation(rootProject)
|
||||
}
|
||||
}
|
||||
val commonTest by sourceSets.getting {
|
||||
dependencies {
|
||||
implementation(kotlin("test-annotations-common"))
|
||||
}
|
||||
}
|
||||
|
||||
jvm {
|
||||
compilations.all {
|
||||
kotlinOptions.jvmTarget = "1.8"
|
||||
}
|
||||
compilations["main"].dependencies {
|
||||
implementation(kotlin("stdlib-jdk8"))
|
||||
implementation(project(":jni:jvm"))
|
||||
}
|
||||
compilations["test"].dependencies {
|
||||
implementation(kotlin("test-junit"))
|
||||
}
|
||||
}
|
||||
|
||||
android {
|
||||
compilations.all {
|
||||
kotlinOptions.jvmTarget = "1.8"
|
||||
}
|
||||
sourceSets["androidMain"].dependencies {
|
||||
implementation(kotlin("stdlib-jdk8"))
|
||||
implementation(project(":jni:android"))
|
||||
}
|
||||
sourceSets["androidTest"].dependencies {
|
||||
implementation(kotlin("test-junit"))
|
||||
implementation("androidx.test.ext:junit:1.1.1")
|
||||
implementation("androidx.test.espresso:espresso-core:3.2.0")
|
||||
}
|
||||
}
|
||||
|
||||
linuxX64("linux")
|
||||
|
||||
ios()
|
||||
}
|
||||
|
||||
android {
|
||||
defaultConfig {
|
||||
compileSdkVersion(30)
|
||||
minSdkVersion(21)
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
|
||||
|
||||
afterEvaluate {
|
||||
tasks.withType<com.android.build.gradle.tasks.factory.AndroidUnitTest>().all {
|
||||
enabled = false
|
||||
}
|
||||
}
|
||||
}
|
3
tests/src/androidMain/AndroidManifest.xml
Normal file
3
tests/src/androidMain/AndroidManifest.xml
Normal file
@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest package="fr.acinq.secp256k1.tests">
|
||||
</manifest>
|
@ -1,4 +1,4 @@
|
||||
package fr.acinq.secp256k1
|
||||
|
||||
|
||||
class Placeholder {}
|
||||
class Placeholder
|
@ -0,0 +1,7 @@
|
||||
package fr.acinq.secp256k1
|
||||
|
||||
import org.junit.Test
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
|
||||
class AndroidTest {}
|
Loading…
x
Reference in New Issue
Block a user