diff --git a/.github/workflows/publish-dokka.yml b/.github/workflows/publish-dokka.yml index 9b3dd3231..6e18fb58a 100644 --- a/.github/workflows/publish-dokka.yml +++ b/.github/workflows/publish-dokka.yml @@ -33,7 +33,7 @@ jobs: link-to-sdk: true - name: Build doc - run: gradle -Pandroid dokkaHtml + run: gradle -Pandroid=true dokkaHtml - name: Deploy doc if: ${{ inputs.live-run || false }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6225f9320..b8d09014a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,6 +30,10 @@ on: type: string description: Release number of Zenoh required: false + branch: + type: string + description: Release branch + required: false jobs: tag: @@ -45,6 +49,7 @@ jobs: repo: ${{ github.repository }} live-run: ${{ inputs.live-run || false }} version: ${{ inputs.version }} + branch: ${{ inputs.branch }} github-token: ${{ secrets.BOT_TOKEN_WORKFLOW }} - name: Checkout this repository diff --git a/zenoh-kotlin/src/commonMain/kotlin/io/zenoh/Session.kt b/zenoh-kotlin/src/commonMain/kotlin/io/zenoh/Session.kt index c8a55a8b2..4da978e57 100644 --- a/zenoh-kotlin/src/commonMain/kotlin/io/zenoh/Session.kt +++ b/zenoh-kotlin/src/commonMain/kotlin/io/zenoh/Session.kt @@ -51,7 +51,7 @@ import java.time.Duration */ class Session private constructor(private val config: Config) : AutoCloseable { - private var jniSession: JNISession? = JNISession() + private var jniSession: JNISession? = null private var declarations = mutableListOf() @@ -440,7 +440,10 @@ class Session private constructor(private val config: Config) : AutoCloseable { /** Launches the session through the jni session, returning the [Session] on success. */ private fun launch(): Result = runCatching { - return jniSession!!.open(config).map { this@Session } + jniSession = JNISession() + return jniSession!!.open(config) + .map { this@Session } + .onFailure { jniSession = null } } } diff --git a/zenoh-kotlin/src/commonTest/kotlin/io/zenoh/SessionTest.kt b/zenoh-kotlin/src/commonTest/kotlin/io/zenoh/SessionTest.kt index 02a8f5444..48f69ee9a 100644 --- a/zenoh-kotlin/src/commonTest/kotlin/io/zenoh/SessionTest.kt +++ b/zenoh-kotlin/src/commonTest/kotlin/io/zenoh/SessionTest.kt @@ -17,8 +17,8 @@ package io.zenoh import io.zenoh.exceptions.SessionException import io.zenoh.keyexpr.KeyExpr import io.zenoh.keyexpr.intoKeyExpr -import io.zenoh.sample.Sample import kotlinx.coroutines.runBlocking +import java.nio.file.Path import kotlin.test.* class SessionTest { @@ -42,6 +42,12 @@ class SessionTest { assertFalse(session.isOpen()) } + @Test + fun sessionOpeningFailure() { + val invalidConfig = Config.from(Path.of("invalid")) + assertFailsWith { Session.open(invalidConfig).getOrThrow() } + } + @Test fun sessionClose_succeedsDespiteNotFreeingAllDeclarations() { val session = Session.open().getOrThrow()