Skip to content

Commit

Permalink
fixed publishing and dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
krisbitney committed Aug 14, 2023
1 parent 5575167 commit 2e1a06f
Show file tree
Hide file tree
Showing 13 changed files with 94 additions and 29 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/logger-plugin-kt-cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- name: Build and Test
run: ./gradlew build
- name: Build
run: ./gradlew assemble
working-directory: ./logger/implementations/kt

- name: Publish
Expand Down
4 changes: 2 additions & 2 deletions logger/implementations/kt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ The Logger plugin implements the `logger-interface` @ [wrapscan.io/polywrap/logg
Kotlin
```kotlin
dependencies {
implementation("io.polywrap:logger-plugin:0.10.0-SNAPSHOT")
implementation("io.polywrap.plugins:logger-plugin:0.10.0-SNAPSHOT")
}
```

Groovy
```groovy
dependencies {
implementation "io.polywrap:logger-plugin:0.10.0-SNAPSHOT"
implementation "io.polywrap.plugins:logger-plugin:0.10.0-SNAPSHOT"
}
```

Expand Down
61 changes: 43 additions & 18 deletions logger/implementations/kt/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,37 +1,62 @@
plugins {
kotlin("jvm") version "1.9.0"
id("com.android.library") version "8.2"
kotlin("multiplatform") version "1.9.0"
kotlin("plugin.serialization") version "1.9.0"
id("org.jlleitschuh.gradle.ktlint") version "11.5.0"
id("org.jetbrains.dokka") version "1.8.20"
id("convention.publication")
}

group = "io.polywrap"
group = "io.polywrap.plugins"
version = "0.10.0-SNAPSHOT"

repositories {
google()
mavenCentral()
maven {
url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
}
}

tasks.test {
useJUnitPlatform()
maven { url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/") }
}

kotlin {
jvmToolchain(17)
jvm {
jvmToolchain(17)
testRuns["test"].executionTask.configure {
useJUnitPlatform()
}
}
androidTarget {
publishLibraryVariants("release")
}
sourceSets {
val commonMain by getting {
dependencies {
implementation("io.polywrap:polywrap-client:0.10.0-SNAPSHOT")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.5.1")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3")
implementation("org.slf4j:slf4j-api:2.0.7")
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test"))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.3")
implementation("ch.qos.logback:logback-classic:1.3.5")
}
}
}
}

dependencies {
implementation("io.polywrap:polywrap-client:0.10.0-SNAPSHOT")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.5.1")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3")
implementation("org.slf4j:slf4j-api:2.0.7")
testImplementation(kotlin("test"))
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.3")
testImplementation("ch.qos.logback:logback-classic:1.3.5")
android {
namespace = "io.polywrap.plugins.logger"
compileSdk = 32
defaultConfig.minSdk = 24
compileOptions {
targetCompatibility = JavaVersion.VERSION_17
}
testOptions {
unitTests.all {
it.enabled = false
}
}
}

// javadoc generation for Maven repository publication
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,6 @@ afterEvaluate {
}
}

publications.create<MavenPublication>("jvm") {
from(components["kotlin"])
artifactId = "logger-plugin"
}

// Configure all publications
publications.withType<MavenPublication> {
// Stub javadoc.jar artifact
Expand Down Expand Up @@ -102,3 +97,19 @@ signing {
)
sign(publishing.publications)
}

tasks.withType<PublishToMavenRepository> {
dependsOn(
"signJvmPublication",
"signAndroidReleasePublication",
"signKotlinMultiplatformPublication"
)
}

tasks.withType<PublishToMavenLocal> {
dependsOn(
"signJvmPublication",
"signAndroidReleasePublication",
"signKotlinMultiplatformPublication"
)
}
10 changes: 9 additions & 1 deletion logger/implementations/kt/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
pluginManagement {
repositories {
mavenCentral()
google()
gradlePluginPortal()
mavenCentral()
}
resolutionStrategy {
eachPlugin {
if (requested.id.namespace == "com.android") {
useModule("com.android.tools.build:gradle:7.4.2")
}
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
package io.polywrap.plugins.logger

import io.polywrap.configBuilder.polywrapClient
import io.polywrap.core.InvokeResult
import io.polywrap.core.resolution.Uri
import io.polywrap.plugins.logger.loggerPlugin
import io.polywrap.plugins.logger.wrap.ArgsLog
import io.polywrap.plugins.logger.wrap.LogLevel
import kotlinx.serialization.Serializable
import kotlin.test.Test
import kotlin.test.assertNull
import kotlin.test.assertTrue

class HelloWorld {

val aggregatorWrapUri = "wrap://http/https://wraps.wrapscan.io/r/polywrap/[email protected]"
val interfaceUri = "wrapscan.io/polywrap/[email protected]"

val client = polywrapClient {
addDefaults()
setPackage("plugin/logger" to loggerPlugin(null))
Expand All @@ -31,4 +35,21 @@ class HelloWorld {
assertNull(result.exceptionOrNull())
assertTrue(result.getOrThrow())
}

@Test
fun printHelloWorldThroughAggregatorWrap() {
@Serializable
class ArgsInfo(val message: String)

println("Invoking Method: info")

val result: InvokeResult<Boolean> = client.invoke(
uri = Uri(aggregatorWrapUri),
method = "info",
args = ArgsInfo("Hello, World!")
)

assertNull(result.exceptionOrNull())
assertTrue(result.getOrThrow())
}
}

0 comments on commit 2e1a06f

Please sign in to comment.