2022-07-18 05:06:48 -07:00
|
|
|
import java.util.Base64
|
|
|
|
|
2022-04-21 05:16:24 -07:00
|
|
|
plugins {
|
2022-04-25 05:07:50 -07:00
|
|
|
id("org.jetbrains.kotlin.multiplatform")
|
2022-04-21 07:16:42 -07:00
|
|
|
alias(libs.plugins.dokka)
|
2022-04-26 05:08:28 -07:00
|
|
|
id("bip39.kotlin-multiplatform-conventions")
|
|
|
|
id("bip39.dependency-conventions")
|
2022-07-18 05:06:48 -07:00
|
|
|
id("maven-publish")
|
|
|
|
id("signing")
|
2022-06-14 04:47:48 -07:00
|
|
|
}
|
2022-04-21 05:16:24 -07:00
|
|
|
|
2022-04-21 07:36:51 -07:00
|
|
|
kotlin {
|
2022-04-26 05:08:28 -07:00
|
|
|
jvm {
|
|
|
|
testRuns["test"].executionTask.configure {
|
|
|
|
useJUnitPlatform()
|
|
|
|
}
|
|
|
|
}
|
2022-07-18 05:06:48 -07:00
|
|
|
|
2022-04-21 07:36:51 -07:00
|
|
|
sourceSets {
|
|
|
|
val commonMain by getting {
|
|
|
|
dependencies {
|
|
|
|
}
|
2022-04-21 07:37:58 -07:00
|
|
|
}
|
2022-04-21 07:36:51 -07:00
|
|
|
val commonTest by getting {
|
|
|
|
dependencies {
|
|
|
|
implementation(kotlin("test"))
|
2022-10-10 13:49:37 -07:00
|
|
|
implementation(libs.kotest.framework.engine)
|
|
|
|
implementation(libs.kotest.assertion)
|
|
|
|
implementation(libs.kotest.property)
|
2022-04-21 07:36:51 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
val jvmMain by getting {
|
|
|
|
dependencies {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
val jvmTest by getting {
|
|
|
|
dependencies {
|
|
|
|
implementation(kotlin("test"))
|
2022-10-10 13:49:37 -07:00
|
|
|
implementation(libs.kotest.runner.junit5)
|
2022-04-21 07:36:51 -07:00
|
|
|
}
|
2022-04-21 07:37:58 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-07-18 05:06:48 -07:00
|
|
|
|
|
|
|
tasks {
|
|
|
|
val dokkaOutputDir = File(buildDir, "dokka")
|
|
|
|
|
|
|
|
dokkaHtml.configure {
|
|
|
|
outputDirectory.set(dokkaOutputDir)
|
|
|
|
}
|
|
|
|
|
|
|
|
val deleteDokkaOutputDir = register<Delete>("deleteDokkaOutputDirectory") {
|
|
|
|
delete(dokkaOutputDir)
|
|
|
|
}
|
|
|
|
|
|
|
|
register<Jar>("javadocJar") {
|
|
|
|
dependsOn(deleteDokkaOutputDir, dokkaHtml)
|
|
|
|
archiveClassifier.set("javadoc")
|
|
|
|
from(dokkaOutputDir)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
val publicationVariant = "release"
|
|
|
|
val myVersion = project.property("LIBRARY_VERSION").toString()
|
|
|
|
val myArtifactId = "kotlin-bip39"
|
|
|
|
val isSnapshot = project.property("IS_SNAPSHOT").toString().toBoolean()
|
|
|
|
|
|
|
|
publishing {
|
|
|
|
publications {
|
|
|
|
withType<MavenPublication> {
|
|
|
|
artifact(tasks.getByName("javadocJar"))
|
|
|
|
|
2022-07-29 06:12:54 -07:00
|
|
|
// Artifact id is tricky. Gradle uses the project name by default, but Kotlin multiplatform needs to add
|
|
|
|
// platform specific suffixes. Doing a partial replacement is the way to rename the artifact.
|
|
|
|
artifactId = artifactId.replace(project.name, myArtifactId)
|
2022-07-18 05:06:48 -07:00
|
|
|
groupId = "cash.z.ecc.android"
|
|
|
|
version = if (isSnapshot) {
|
|
|
|
"$myVersion-SNAPSHOT"
|
|
|
|
} else {
|
|
|
|
myVersion
|
|
|
|
}
|
|
|
|
|
|
|
|
pom {
|
|
|
|
name.set("Kotlin BIP-39")
|
|
|
|
description.set("A concise implementation of BIP-0039 in Kotlin.")
|
|
|
|
url.set("https://github.com/zcash/kotlin-bip39/")
|
|
|
|
inceptionYear.set("2020")
|
|
|
|
scm {
|
|
|
|
url.set("https://github.com/zcash/kotlin-bip39/")
|
|
|
|
connection.set("scm:git:git://github.com/zcash/kotlin-bip39.git")
|
|
|
|
developerConnection.set("scm:git:ssh://git@github.com/zcash/kotlin-bip39.git")
|
|
|
|
}
|
|
|
|
developers {
|
|
|
|
developer {
|
|
|
|
id.set("zcash")
|
|
|
|
name.set("Zcash")
|
|
|
|
url.set("https://github.com/zcash/")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
licenses {
|
|
|
|
license {
|
|
|
|
name.set("The MIT License")
|
|
|
|
url.set("https://opensource.org/licenses/MIT")
|
|
|
|
distribution.set("repo")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
repositories {
|
|
|
|
val mavenUrl = if (isSnapshot) {
|
|
|
|
project.property("ZCASH_MAVEN_PUBLISH_SNAPSHOT_URL").toString()
|
|
|
|
} else {
|
|
|
|
project.property("ZCASH_MAVEN_PUBLISH_RELEASE_URL").toString()
|
|
|
|
}
|
|
|
|
val mavenPublishUsername = project.property("ZCASH_MAVEN_PUBLISH_USERNAME").toString()
|
|
|
|
val mavenPublishPassword = project.property("ZCASH_MAVEN_PUBLISH_PASSWORD").toString()
|
|
|
|
|
|
|
|
mavenLocal {
|
|
|
|
name = "MavenLocal"
|
|
|
|
}
|
|
|
|
maven(mavenUrl) {
|
|
|
|
name = "MavenCentral"
|
|
|
|
credentials {
|
|
|
|
username = mavenPublishUsername
|
|
|
|
password = mavenPublishPassword
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
signing {
|
2022-07-26 09:54:07 -07:00
|
|
|
// Maven Central requires signing for non-snapshots
|
|
|
|
isRequired = !isSnapshot
|
2022-07-18 05:06:48 -07:00
|
|
|
|
|
|
|
val signingKey = run {
|
|
|
|
val base64EncodedKey = project.property("ZCASH_ASCII_GPG_KEY").toString()
|
|
|
|
if (base64EncodedKey.isNotEmpty()) {
|
|
|
|
val keyBytes = Base64.getDecoder().decode(base64EncodedKey)
|
|
|
|
String(keyBytes)
|
|
|
|
} else {
|
|
|
|
""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (signingKey.isNotEmpty()) {
|
|
|
|
useInMemoryPgpKeys(signingKey, "")
|
|
|
|
}
|
|
|
|
|
|
|
|
sign(publishing.publications)
|
|
|
|
}
|