diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9710bef0..827f6e33 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,56 +24,6 @@ permissions: jobs: release: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Set up JDK 17 - uses: actions/setup-java@v3 - with: - java-version: '17' - distribution: 'temurin' - - name: Assembly - uses: gradle/gradle-build-action@v2 - with: - arguments: assemble sourcesJar javadocJar --parallel --stacktrace - - - name: Sign & publish to Maven Central - uses: gradle/gradle-build-action@v2 - env: - SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} - SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} - SIGNING_SECRET_FILE: ${{ secrets.SIGNING_SECRET_FILE }} - RELEASER_NEXUS2_USERNAME: ${{ secrets.RELEASER_NEXUS2_USERNAME }} - RELEASER_NEXUS2_PASSWORD: ${{ secrets.RELEASER_NEXUS2_PASSWORD }} - with: - arguments: assemble sourcesJar javadocJar signAllPublications publishJvmArtifacts publishLinuxArtifacts publishJsArtifacts --stacktrace - - windows-release: - runs-on: windows-latest - steps: - - uses: actions/checkout@v3 - - name: Set up JDK 17 - uses: actions/setup-java@v3 - with: - java-version: '17' - distribution: 'temurin' - - name: Assembly - uses: gradle/gradle-build-action@v2 - with: - arguments: assemble sourcesJar javadocJar --parallel --stacktrace - - - name: Sign & publish to Maven Central - uses: gradle/gradle-build-action@v2 - env: - SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} - SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} - SIGNING_SECRET_FILE: ${{ secrets.SIGNING_SECRET_FILE }} - RELEASER_NEXUS2_USERNAME: ${{ secrets.RELEASER_NEXUS2_USERNAME }} - RELEASER_NEXUS2_PASSWORD: ${{ secrets.RELEASER_NEXUS2_PASSWORD }} - with: - arguments: assemble sourcesJar javadocJar publishWindowsArtifacts publish --stacktrace - - macos-release: runs-on: macos-latest steps: - uses: actions/checkout@v3 @@ -96,4 +46,4 @@ jobs: RELEASER_NEXUS2_USERNAME: ${{ secrets.RELEASER_NEXUS2_USERNAME }} RELEASER_NEXUS2_PASSWORD: ${{ secrets.RELEASER_NEXUS2_PASSWORD }} with: - arguments: assemble sourcesJar javadocJar publishOSXArtifacts publish --stacktrace + arguments: assemble sourcesJar javadocJar signAllPublications publish --stacktrace diff --git a/.github/workflows/test-module.yml b/.github/workflows/test-module.yml index f06656ff..cede094b 100644 --- a/.github/workflows/test-module.yml +++ b/.github/workflows/test-module.yml @@ -12,10 +12,23 @@ on: containers: required: false type: string + linux: + required: false + type: boolean + default: true + windows: + required: false + type: boolean + default: false + osx: + required: false + type: boolean + default: false jobs: - run: + linux-test: name: ${{ inputs.module }} module + if: ${{ inputs.linux }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -33,3 +46,43 @@ jobs: uses: gradle/gradle-build-action@v2 with: arguments: ${{ inputs.path }}:test + windows-test: + name: ${{ inputs.module }} module + if: ${{ inputs.windows }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Check + run: ls -lh + - name: Run docker-compose + if: ${{ inputs.containers }} + run: docker compose up ${{ inputs.containers }} -d + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + - name: Run tests + uses: gradle/gradle-build-action@v2 + with: + arguments: ${{ inputs.path }}:test + osx-test: + name: ${{ inputs.module }} module + if: ${{ inputs.osx }} + runs-on: macos-latest + steps: + - uses: actions/checkout@v3 + - name: Check + run: ls -lh + - name: Run docker-compose + if: ${{ inputs.containers }} + run: docker compose up ${{ inputs.containers }} -d + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + - name: Run tests + uses: gradle/gradle-build-action@v2 + with: + arguments: ${{ inputs.path }}:test diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 36bcb316..c3093f4e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,6 +9,9 @@ jobs: with: module: River Core path: :core + windows: true + linux: true + osx: true amqp: uses: ./.github/workflows/test-module.yml @@ -90,6 +93,9 @@ jobs: with: module: Formats (JSON, CSV, Positional Flat Line) path: :connector:connector-format + windows: true + linux: true + osx: true ftp: uses: ./.github/workflows/test-module.yml diff --git a/build.gradle.kts b/build.gradle.kts index 38b05b90..798f4189 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -49,7 +49,7 @@ subprojects { apply(plugin = "signing") apply(plugin = "com.google.osdetector") - version = "1.0.0-alpha13" + version = rootProject.libs.versions.river.get() group = "com.river-kt" kotlin { @@ -107,7 +107,7 @@ subprojects { pluginManager.withPlugin("com.android.library") { extensions.configure { namespace = "com.river" - compileSdk = 30 + compileSdk = rootProject.libs.versions.android.compile.sdk.get().toInt() } } @@ -191,35 +191,6 @@ subprojects { email.set("gabfssilva@gmail.com") } } - -// withXml { -// asNode().appendNode("dependencies").apply { -// val dependencies = configurations.asMap["api"]?.dependencies ?: emptySet() -// -// for (dependency in dependencies) { -// appendNode("dependency").apply { -// appendNode("groupId", dependency.group) -// appendNode("artifactId", dependency.name) -// appendNode("version", dependency.version) -// -// val excludeRules = -// if (dependency is ModuleDependency) dependency.excludeRules -// else emptySet() -// -// if (excludeRules.isNotEmpty()) { -// appendNode("exclusions").apply { -// appendNode("exclusion").apply { -// excludeRules.forEach { excludeRule -> -// appendNode("groupId", excludeRule.group) -// appendNode("artifactId", excludeRule.module) -// } -// } -// } -// } -// } -// } -// } -// } } } } @@ -240,64 +211,14 @@ subprojects { dependsOn(tasks.withType()) } - onWindows { - val publishWindowsArtifacts by tasks.registering { - dependsOn( - tasks - .withType() - .filter { it.name.contains("mingw", ignoreCase = true) } - ) - } - } - - onMacOS { - val publishOSXArtifacts by tasks.registering { - val appleOs = listOf("ios", "macos", "watchos", "tvos") - - dependsOn( - tasks - .withType() - .filter { p -> - appleOs.any { p.name.contains(it, ignoreCase = true) } - } - ) - } - } - - onLinux { - val publishJvmArtifacts by tasks.registering { - dependsOn( - tasks - .withType() - .filter { it.name.contains("jvm", ignoreCase = true) } - ) - } - - val publishLinuxArtifacts by tasks.registering { - dependsOn( - tasks - .withType() - .filter { it.name.contains("linux", ignoreCase = true) } - ) - } - - val publishJsArtifacts by tasks.registering { - dependsOn( - tasks - .withType() - .filter { it.name.contains("js", ignoreCase = true) } - ) - } - } - signing { useInMemoryPgpKeys(signingKeyId, signingSecretKey, signingPassword) sign(publishing.publications) } - tasks.withType().configureEach { + tasks.withType().configureEach { skipExamples() - dependsOn(tasks.withType()) + dependsOn(signAllPublications) } tasks.withType().configureEach { @@ -311,12 +232,6 @@ subprojects { } ) } - -// tasks.javadoc { -// if (JavaVersion.current().isJava9Compatible) { -// (options as StandardJavadocDocletOptions).addBooleanOption("html5", true) -// } -// } } fun Task.skipExamples() { diff --git a/connectors/format/positional-flat-line/build.gradle.kts b/connectors/format/positional-flat-line/build.gradle.kts index e69de29b..8c1cbce6 100644 --- a/connectors/format/positional-flat-line/build.gradle.kts +++ b/connectors/format/positional-flat-line/build.gradle.kts @@ -0,0 +1,28 @@ +plugins { + alias(libs.plugins.android) +} + +kotlin { + linuxX64() + linuxArm64() + + mingwX64() + + js(IR) { + browser() + nodejs() + } + + androidTarget { + publishLibraryVariants("release", "debug") + } + + macosArm64() + macosX64() + + iosArm64() + + tvosArm64() + + watchosArm64() +} diff --git a/connectors/format/positional-flat-line/src/jvmMain/kotlin/com/river/connector/format/positional/flat/line/PositionalFlatLineExt.kt b/connectors/format/positional-flat-line/src/commonMain/kotlin/com/river/connector/format/positional/flat/line/PositionalFlatLineExt.kt similarity index 98% rename from connectors/format/positional-flat-line/src/jvmMain/kotlin/com/river/connector/format/positional/flat/line/PositionalFlatLineExt.kt rename to connectors/format/positional-flat-line/src/commonMain/kotlin/com/river/connector/format/positional/flat/line/PositionalFlatLineExt.kt index e5ec3857..ee411042 100644 --- a/connectors/format/positional-flat-line/src/jvmMain/kotlin/com/river/connector/format/positional/flat/line/PositionalFlatLineExt.kt +++ b/connectors/format/positional-flat-line/src/commonMain/kotlin/com/river/connector/format/positional/flat/line/PositionalFlatLineExt.kt @@ -4,7 +4,7 @@ import com.river.core.ExperimentalRiverApi import com.river.core.lines import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.map -import java.time.LocalDate +import kotlinx.datetime.LocalDate @ExperimentalRiverApi data class Field( diff --git a/core/build.gradle.kts b/core/build.gradle.kts index ed61663b..8c1cbce6 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -13,7 +13,9 @@ kotlin { nodejs() } - androidTarget() + androidTarget { + publishLibraryVariants("release", "debug") + } macosArm64() macosX64() diff --git a/core/src/commonMain/kotlin/com/river/core/FlowByteArrayExt.kt b/core/src/commonMain/kotlin/com/river/core/FlowByteArrayExt.kt index 5422aeee..efb2098e 100644 --- a/core/src/commonMain/kotlin/com/river/core/FlowByteArrayExt.kt +++ b/core/src/commonMain/kotlin/com/river/core/FlowByteArrayExt.kt @@ -3,15 +3,6 @@ package com.river.core import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.map -//import java.nio.ByteBuffer - -/** - * Converts the [Flow] of [ByteArray] to a [Flow] of [ByteBuffer]. - * - * @return A new [Flow] of [ByteBuffer] converted from the original [Flow] of [ByteArray]. - */ -//fun Flow.asByteBuffer(): Flow = map { ByteBuffer.wrap(it) } - /** * Converts the [Flow] of [ByteArray] to a [Flow] of [String]. * diff --git a/core/src/commonMain/kotlin/com/river/core/FlowStringExt.kt b/core/src/commonMain/kotlin/com/river/core/FlowStringExt.kt index ac66c639..b0dd45c5 100644 --- a/core/src/commonMain/kotlin/com/river/core/FlowStringExt.kt +++ b/core/src/commonMain/kotlin/com/river/core/FlowStringExt.kt @@ -4,9 +4,6 @@ import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.onCompletion -//import java.nio.ByteBuffer -//import java.nio.charset.Charset - /** * Splits and buffers the [Flow] of [String] based on the provided delimiter, emitting each piece as a separate element in the resulting [Flow]. * @@ -78,38 +75,3 @@ fun Flow.splitEvery( * ``` */ fun Flow.lines() = splitEvery("\n") -// -///** -// * Converts the [Flow] of [String] to a [Flow] of [Byte] using the specified [charset]. -// * -// * @param charset The [Charset] to use for converting the strings to bytes. Defaults to the system's default charset. -// * -// * @return A new [Flow] of [Byte] converted from the original [Flow] of [String]. -// */ -//fun Flow.asBytes( -// charset: Charset = Charset.defaultCharset() -//) = asByteArray(charset) -// .map { it.toList() } -// .flattenIterable() -// -///** -// * Converts the [Flow] of [String] to a [Flow] of [ByteArray] using the specified [charset]. -// * -// * @param charset The [Charset] to use for converting the strings to byte arrays. Defaults to the system's default charset. -// * -// * @return A new [Flow] of [ByteArray] converted from the original [Flow] of [String]. -// */ -//fun Flow.asByteArray( -// charset: Charset = Charset.defaultCharset() -//): Flow = map { it.toByteArray(charset) } -// -///** -// * Converts the [Flow] of [String] to a [Flow] of [ByteBuffer] using the specified [charset]. -// * -// * @param charset The [Charset] to use for converting the strings to byte buffers. Defaults to the system's default charset. -// * -// * @return A new [Flow] of [ByteBuffer] converted from the original [Flow] of [String]. -// */ -//fun Flow.asByteBuffer( -// charset: Charset = Charset.defaultCharset() -//): Flow = map { ByteBuffer.wrap(it.toByteArray(charset)) } diff --git a/core/src/jvmMain/kotlin/com/river/core/FlowByteArrayJvmExt.kt b/core/src/jvmMain/kotlin/com/river/core/FlowByteArrayJvmExt.kt new file mode 100644 index 00000000..021b3a64 --- /dev/null +++ b/core/src/jvmMain/kotlin/com/river/core/FlowByteArrayJvmExt.kt @@ -0,0 +1,12 @@ +package com.river.core + +import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.map +import java.nio.ByteBuffer + +/** + * Converts the [Flow] of [ByteArray] to a [Flow] of [ByteBuffer]. + * + * @return A new [Flow] of [ByteBuffer] converted from the original [Flow] of [ByteArray]. + */ +fun Flow.asByteBuffer(): Flow = map { ByteBuffer.wrap(it) } diff --git a/libs.versions.toml b/libs.versions.toml index e620f97c..d7e76617 100644 --- a/libs.versions.toml +++ b/libs.versions.toml @@ -1,5 +1,7 @@ [versions] +river = "1.0.0-alpha13" kotlin = "1.9.22" +java = "17" dokka = "1.9.10" aws-sdk = "2.23.2" coroutines = "1.7.3" @@ -33,6 +35,7 @@ kotlinx-datetime = "0.5.0" android = "8.1.4" setup-android-sdk = "3.1.0" os-detector = "1.7.3" +android-compile-sdk = "30" [plugins] kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }