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"))
|
implementation(kotlin("stdlib-common"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val commonTest by sourceSets.getting {
|
|
||||||
dependencies {
|
|
||||||
implementation(kotlin("test-common"))
|
|
||||||
implementation(kotlin("test-annotations-common"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
jvm {
|
jvm {
|
||||||
compilations.all {
|
compilations.all {
|
||||||
@ -50,11 +44,6 @@ kotlin {
|
|||||||
compilations["main"].dependencies {
|
compilations["main"].dependencies {
|
||||||
implementation(kotlin("stdlib-jdk8"))
|
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) {
|
fun org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget.secp256k1CInterop(target: String) {
|
||||||
@ -89,27 +78,31 @@ kotlin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Disable cross compilation
|
// Disable cross compilation
|
||||||
afterEvaluate {
|
allprojects {
|
||||||
val currentOs = org.gradle.internal.os.OperatingSystem.current()
|
plugins.withId("org.jetbrains.kotlin.multiplatform") {
|
||||||
val targets = when {
|
afterEvaluate {
|
||||||
currentOs.isLinux -> listOf()
|
val currentOs = org.gradle.internal.os.OperatingSystem.current()
|
||||||
currentOs.isMacOsX -> listOf("linux")
|
val targets = when {
|
||||||
currentOs.isWindows -> listOf("linux")
|
currentOs.isLinux -> listOf()
|
||||||
else -> listOf("linux")
|
currentOs.isMacOsX -> listOf("linux")
|
||||||
}.mapNotNull { kotlin.targets.findByName(it) as? org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget }
|
currentOs.isWindows -> listOf("linux")
|
||||||
|
else -> listOf("linux")
|
||||||
|
}.mapNotNull { kotlin.targets.findByName(it) as? org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget }
|
||||||
|
|
||||||
configure(targets) {
|
configure(targets) {
|
||||||
compilations.all {
|
compilations.all {
|
||||||
cinterops.all { tasks[interopProcessingTaskName].enabled = false }
|
cinterops.all { tasks[interopProcessingTaskName].enabled = false }
|
||||||
compileKotlinTask.enabled = false
|
compileKotlinTask.enabled = false
|
||||||
tasks[processResourcesTaskName].enabled = false
|
tasks[processResourcesTaskName].enabled = false
|
||||||
}
|
}
|
||||||
binaries.all { linkTask.enabled = false }
|
binaries.all { linkTask.enabled = false }
|
||||||
|
|
||||||
mavenPublication {
|
mavenPublication {
|
||||||
val publicationToDisable = this
|
val publicationToDisable = this
|
||||||
tasks.withType<AbstractPublishToMaven>().all { onlyIf { publication != publicationToDisable } }
|
tasks.withType<AbstractPublishToMaven>().all { onlyIf { publication != publicationToDisable } }
|
||||||
tasks.withType<GenerateModuleMetadata>().all { onlyIf { publication.get() != publicationToDisable } }
|
tasks.withType<GenerateModuleMetadata>().all { onlyIf { publication.get() != publicationToDisable } }
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,6 @@ include(
|
|||||||
":native",
|
":native",
|
||||||
":jni",
|
":jni",
|
||||||
":jni:android",
|
":jni:android",
|
||||||
":jni:jvm"
|
":jni:jvm",
|
||||||
// ":jni"
|
":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
|
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