Skip to content

Commit

Permalink
feat: integrate authenticate-sdk, buildSrc (Deps + Version globals), …
Browse files Browse the repository at this point in the history
…Protos and basic dependencies from old SDK
  • Loading branch information
elribonazo committed Nov 13, 2022
1 parent 4eeea4c commit 1b0e6b5
Show file tree
Hide file tree
Showing 40 changed files with 3,854 additions and 13 deletions.
148 changes: 148 additions & 0 deletions authenticate-sdk/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
import org.gradle.internal.os.OperatingSystem
import org.jetbrains.dokka.gradle.DokkaTask
import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackOutput.Target

version = rootProject.version
val currentModuleName: String = "authenticate_sdk"
val os: OperatingSystem = OperatingSystem.current()

plugins {
kotlin("multiplatform")
id("com.android.library")
id("org.jetbrains.dokka")
}

kotlin {
android {
publishAllLibraryVariants()
}
jvm {
compilations.all {
kotlinOptions {
jvmTarget = "11"
}
}
testRuns["test"].executionTask.configure {
useJUnitPlatform()
}
}

js(IR) {
this.moduleName = currentModuleName
this.binaries.library()
this.useCommonJs()
this.compilations["main"].packageJson {
this.version = rootProject.version.toString()
}
this.compilations["test"].packageJson {
this.version = rootProject.version.toString()
}
browser {
this.webpackTask {
this.output.library = currentModuleName
this.output.libraryTarget = Target.VAR
}
this.commonWebpackConfig {
this.cssSupport {
this.enabled = true
}
}
this.testTask {
this.useKarma {
this.useChromeHeadless()
}
}
}
nodejs {
this.testTask {
this.useKarma {
this.useChromeHeadless()
}
}
}
}


sourceSets {
val commonMain by getting {
dependencies {
implementation("com.benasher44:uuid:0.3.0")
implementation(project(":core-sdk"))
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test"))
}
}
val jvmMain by getting
val jvmTest by getting {
dependencies {
implementation("junit:junit:4.13.2")
}
}
val androidMain by getting
val androidTest by getting {
dependencies {
implementation("junit:junit:4.13.2")
}
}
val jsMain by getting
val jsTest by getting

all {
languageSettings.optIn("kotlin.RequiresOptIn")
}
}
}

android {
compileSdk = 32
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
defaultConfig {
minSdk = 21
targetSdk = 32
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
/**
* Because Software Components will not be created automatically for Maven publishing from
* Android Gradle Plugin 8.0. To opt-in to the future behavior, set the Gradle property android.
* disableAutomaticComponentCreation=true in the `gradle.properties` file or use the new
* publishing DSL.
*/
publishing {
multipleVariants {
withSourcesJar()
withJavadocJar()
allVariants()
}
}
}

// Dokka implementation
tasks.withType<DokkaTask> {
moduleName.set(project.name)
moduleVersion.set(rootProject.version.toString())
description = """
This is a Kotlin Multiplatform Wallet-SDK Library
""".trimIndent()
dokkaSourceSets {
// TODO: Figure out how to include files to the documentations
named("commonMain") {
includes.from("Module.md", "docs/Module.md")
}
}
}

// afterEvaluate {
// tasks.withType<AbstractTestTask> {
// testLogging {
// events("passed", "skipped", "failed", "standard_out", "standard_error")
// showExceptions = true
// showStackTraces = true
// }
// }
// }
2 changes: 2 additions & 0 deletions authenticate-sdk/src/androidMain/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="io.iohk.prism.authenticate" />
3 changes: 3 additions & 0 deletions authenticate-sdk/src/androidMain/kotlin/authenticate.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
actual fun authenticate(did: String, signature: String, originalText: String):String {
return "hola";
}
3 changes: 3 additions & 0 deletions authenticate-sdk/src/androidMain/kotlin/createChallenge.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
actual fun createChallenge(expiration: Int): String {
return "hola";
}
1 change: 1 addition & 0 deletions authenticate-sdk/src/commonMain/kotlin/authenticate.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
expect fun authenticate(did: String, signature: String, originalText: String):String
1 change: 1 addition & 0 deletions authenticate-sdk/src/commonMain/kotlin/createChallenge.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
expect fun createChallenge(expiration: Int): String
4 changes: 4 additions & 0 deletions authenticate-sdk/src/jsMain/kotlin/authenticate.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@JsExport
actual fun authenticate(did: String, signature: String, originalText: String):String {
return "hola";
}
5 changes: 5 additions & 0 deletions authenticate-sdk/src/jsMain/kotlin/createChallenge.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

@JsExport
actual fun createChallenge(expiration: Int): String {
return "hola";
}
3 changes: 3 additions & 0 deletions authenticate-sdk/src/jvmMain/kotlin/authenticate.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
actual fun authenticate(did: String, signature: String, originalText: String):String {
return "hola";
}
3 changes: 3 additions & 0 deletions authenticate-sdk/src/jvmMain/kotlin/createChallenge.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
actual fun createChallenge(expiration: Int): String {
return "hola";
}
39 changes: 33 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,17 +1,38 @@
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(11))
vendor.set(JvmVendorSpec.ADOPTOPENJDK)
}
}

plugins {
id("maven-publish")
id("org.jetbrains.dokka") version "1.7.10"
id("org.jlleitschuh.gradle.ktlint") version "11.0.0"
java
kotlin(Plugins.multiplatform) version PluginVersions.multiplatform apply false
kotlin(Plugins.serialization) version PluginVersions.multiplatform apply false
id(Plugins.protobuf) version PluginVersions.protobuf apply false
id(Plugins.npmPublish) version PluginVersions.npmPublish apply false
id(Plugins.gitVersion) version PluginVersions.gitVersion
id(Plugins.klint) version PluginVersions.klint
id(Plugins.compatibilityValidator) version PluginVersions.compatibilityValidator
id(Plugins.gitOps) version PluginVersions.gitOps
id(Plugins.koverage) version PluginVersions.koverage
id(Plugins.dokka) version PluginVersions.dokka
`maven-publish`
}

buildscript {
repositories {
gradlePluginPortal()
google()
mavenCentral()
mavenLocal()
google()
maven("https://plugins.gradle.org/m2/")
// Needed for Kotlin coroutines that support new memory management mode
maven {
url = uri("https://maven.pkg.jetbrains.space/public/p/kotlinx-coroutines/maven")
}
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.20")
Expand All @@ -24,8 +45,14 @@ group = "io.iohk.atala.prism"

allprojects {
repositories {
google()
mavenCentral()
mavenLocal()
google()
maven("https://plugins.gradle.org/m2/")
// Needed for Kotlin coroutines that support new memory management mode
maven {
url = uri("https://maven.pkg.jetbrains.space/public/p/kotlinx-coroutines/maven")
}
}

// apply(plugin = "org.gradle.maven-publish")
Expand Down
9 changes: 9 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import org.gradle.kotlin.dsl.`kotlin-dsl`

plugins {
`kotlin-dsl`
}

repositories {
mavenCentral()
}
30 changes: 30 additions & 0 deletions buildSrc/src/main/kotlin/Deps.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
object Deps {
const val kotlinSerializationJson = "org.jetbrains.kotlinx:kotlinx-serialization-json:${Versions.kotlinSerializationJson}"
const val kotlinBignum = "com.ionspin.kotlin:bignum:${Versions.kotlinBignum}"
const val kotlinCoroutines = "org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.kotlinCoroutines}"
const val kotlinCoroutinesJDK8 = "org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:${Versions.kotlinCoroutinesJDK8}"
const val kotlinNodejs = "org.jetbrains.kotlinx:kotlinx-nodejs:${Versions.kotlinNodejs}"
const val kotlinDatetime = "org.jetbrains.kotlinx:kotlinx-datetime:${Versions.kotlinDatetime}"
const val grpcKotlinStub = "io.grpc:grpc-kotlin-stub:${Versions.grpcKotlinStub}"
const val grpcKotlinOkhttp = "io.grpc:grpc-okhttp:${Versions.grpcKotlinOkhttp}"

const val bitcoinj = "org.bitcoinj:bitcoinj-core:${Versions.bitcoinj}"
const val bitcoinKmp = "fr.acinq.bitcoin:bitcoin-kmp:${Versions.bitcoinKmp}"

const val pbandkRuntime = "io.iohk:pbandk-runtime:${Versions.pbandk}"
const val pbandkProtocGen = "io.iohk:protoc-gen-pbandk-lib-jvm:${Versions.pbandk}"
// NOTE: this adds Kotlin interop with some of the jvm8 features (e.g. CompletableFuture).
const val pbandkProtocGenJDK8 = "io.iohk:protoc-gen-pbandk-jvm:${Versions.pbandk}:jvm8@jar"
const val pbandkPrismClientsGenerator = "io.iohk.atala:pbandk-prism-clients-generator:${Versions.pbandk}"

const val protobufJava = "com.google.protobuf:protobuf-java:${Versions.protobuf}"
const val protobufProtoc = "com.google.protobuf:protoc:${Versions.protobuf}"
const val protobufLite = "io.grpc:grpc-protobuf-lite:${Versions.protobufLite}"

const val betterParse = "com.github.h0tk3y.betterParse:better-parse:${Versions.betterParse}"
const val krypto = "com.soywiz.korlibs.krypto:krypto:${Versions.krypto}"
const val guava = "com.google.guava:guava:${Versions.guava}"
const val spongyCastle = "com.madgag.spongycastle:prov:${Versions.spongyCastle}"
const val bouncyCastle = "org.bouncycastle:bcprov-jdk15on:${Versions.bouncyCastle}"
const val uuid = "com.benasher44:uuid:${Versions.uuid}"
}
14 changes: 14 additions & 0 deletions buildSrc/src/main/kotlin/PluginVersions.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
object PluginVersions {
const val multiplatform = "1.6.0"
const val androidLibrary = "4.1.2"
const val protobuf = "0.8.14"
const val npmPublish = "2.0.2"
const val gitVersion = "0.12.3"
const val klint = "10.0.0"
const val multiplatformSwift = "2.0.3"
const val kfcDefinitions = "4.32.0"
const val compatibilityValidator = "0.8.0-RC"
const val gitOps = "5.0.0-rc.3"
const val koverage = "0.5.0"
const val dokka = "1.7.0"
}
15 changes: 15 additions & 0 deletions buildSrc/src/main/kotlin/Plugins.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
object Plugins {
const val multiplatform = "multiplatform"
const val serialization = "plugin.serialization"
const val androidLibrary = "com.android.library"
const val protobuf = "com.google.protobuf"
const val npmPublish = "dev.petuska.npm.publish"
const val gitVersion = "com.palantir.git-version"
const val klint = "org.jlleitschuh.gradle.ktlint"
const val multiplatformSwift = "com.chromaticnoise.multiplatform-swiftpackage"
const val kfcDefinitions = "com.github.turansky.kfc.definitions"
const val compatibilityValidator = "org.jetbrains.kotlinx.binary-compatibility-validator"
const val gitOps = "org.ajoberstar.grgit"
const val koverage = "org.jetbrains.kotlinx.kover"
const val dokka = "org.jetbrains.dokka"
}
30 changes: 30 additions & 0 deletions buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
object Versions {
const val jvmTarget = "11"
const val iosTarget = "13"
const val androidTargetSdk = 29
const val androidMinSdk = 26

const val kotlinSerializationJson = "1.3.0"
const val kotlinBignum = "0.3.1"
const val kotlinCoroutines = "1.5.1-new-mm-dev2"
const val kotlinCoroutinesJDK8 = "1.5.2"
const val kotlinNodejs = "0.0.7"
const val kotlinDatetime = "0.2.1"
const val grpcKotlinStub = "1.0.0"
const val grpcKotlinOkhttp = "1.36.0"

const val bitcoinj = "0.15.10"
const val bitcoinKmp = "0.7.0"

const val pbandk = "0.20.7"
const val protobuf = "3.12.0"
const val protobufLite = "1.36.0"

const val swiftTools = "5.3"
const val betterParse = "0.4.3"
const val krypto = "2.4.12"
const val guava = "30.1-jre"
const val spongyCastle = "1.58.0.0"
const val bouncyCastle = "1.68"
const val uuid = "0.3.0"
}
2 changes: 1 addition & 1 deletion core-sdk/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import org.jetbrains.dokka.gradle.DokkaTask
import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackOutput.Target

version = rootProject.version
val currentModuleName: String = "wallet-core-sdk"
val currentModuleName: String = "wallet_core_sdk"
val os: OperatingSystem = OperatingSystem.current()

plugins {
Expand Down
4 changes: 2 additions & 2 deletions core-sdk/core_sdk.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Pod::Spec.new do |spec|
spec.authors = 'IOG'
spec.license = ''
spec.summary = 'Wallet-Core-SDK'
spec.vendored_frameworks = 'build/cocoapods/framework/wallet-core-sdk.framework'
spec.vendored_frameworks = 'build/cocoapods/framework/wallet_core_sdk.framework'
spec.libraries = 'c++'
spec.ios.deployment_target = '13.0'
spec.osx.deployment_target = '12.0'
Expand All @@ -16,7 +16,7 @@ Pod::Spec.new do |spec|

spec.pod_target_xcconfig = {
'KOTLIN_PROJECT_PATH' => ':core-sdk',
'PRODUCT_MODULE_NAME' => 'wallet-core-sdk',
'PRODUCT_MODULE_NAME' => 'wallet_core_sdk',
}

spec.script_phases = [
Expand Down
Loading

0 comments on commit 1b0e6b5

Please sign in to comment.