Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable useUniqueModuleNames #121

Merged
merged 2 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 54 additions & 53 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,83 +6,79 @@ env:
GRADLE_OPTS: -Dorg.gradle.daemon=false -Dkotlin.incremental=false -Dorg.gradle.jvmargs="-XX:+HeapDumpOnOutOfMemoryError -XX:MetaspaceSize=1g"

jobs:
build:
check:
strategy:
fail-fast: false
matrix:
os: [ macos-latest, ubuntu-latest, windows-latest ]

java-version: [ 11, 19 ]
runs-on: ${{ matrix.os }}

steps:
- name: Checkout Repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
uses: gradle/actions/wrapper-validation@v3

- name: Setup Caches [ Gradle Wrapper ]
uses: actions/cache@v1
- name: Setup JDK
uses: actions/setup-java@v4
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.*') }}
restore-keys: ${{ runner.os }}-gradle-wrapper-
distribution: 'zulu'
java-version: ${{ matrix.java-version }}

- name: Setup Caches [ Konan ]
uses: actions/cache@v1
with:
path: ~/.konan
key: ${{ runner.os }}-konan-${{ hashFiles('**/*.gradle.kts') }}-${{ hashFiles('gradle/libs.versions.toml') }}
restore-keys: ${{ runner.os }}-konan-
- name: Run macOS Tests [ Java 11 ]
if: matrix.os == 'macos-latest' && matrix.java-version == 11
run: >
./gradlew check --stacktrace
-PKMP_TARGETS="IOS_ARM64,IOS_X64,IOS_SIMULATOR_ARM64,JS,JVM,WASM_JS,WASM_WASI"

- name: Setup Caches [ Gradle Caches ]
uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle.kts') }}-${{ hashFiles('gradle/libs.versions.toml') }}
restore-keys: ${{ runner.os }}-gradle-caches-

# Windows does not build ANDROID, but needs Java 11 for JPMS Multi-Release Jar build
- name: Setup JDK 11
if: matrix.os == 'windows-latest'
uses: actions/setup-java@v3.4.0
with:
distribution: 'zulu'
java-version: 11
- name: Run macOS Tests [ Java 19 ]
if: matrix.os == 'macos-latest' && matrix.java-version == 19
run: >
./gradlew check --stacktrace
-PKMP_TARGETS="JVM,MACOS_ARM64,MACOS_X64,TVOS_ARM64,TVOS_X64,TVOS_SIMULATOR_ARM64,WATCHOS_ARM32,WATCHOS_ARM64,WATCHOS_DEVICE_ARM64,WATCHOS_X64,WATCHOS_SIMULATOR_ARM64"

- name: Setup JDK 19
if: matrix.os != 'windows-latest'
uses: actions/setup-java@v3.4.0
with:
distribution: 'zulu'
java-version: 19
- name: Run Linux Tests [ Java 11 ]
if: matrix.os == 'ubuntu-latest' && matrix.java-version == 11
run: >
./gradlew check --stacktrace
-PKMP_TARGETS="JS,JVM,WASM_JS,WASM_WASI"

- name: Run macOS Tests
if: matrix.os == 'macos-latest'
- name: Run Linux Tests [ Java 19 ]
if: matrix.os == 'ubuntu-latest' && matrix.java-version == 19
run: >
./gradlew check --stacktrace
-PKMP_TARGETS="JVM,JS,IOS_ARM64,IOS_X64,IOS_SIMULATOR_ARM64,MACOS_ARM64,MACOS_X64,TVOS_ARM64,TVOS_X64,TVOS_SIMULATOR_ARM64,WATCHOS_ARM32,WATCHOS_ARM64,WATCHOS_DEVICE_ARM64,WATCHOS_X64,WATCHOS_SIMULATOR_ARM64,WASM_JS,WASM_WASI"
- name: Run Linux Tests
if: matrix.os == 'ubuntu-latest'
-PKMP_TARGETS="ANDROID,ANDROID_ARM32,ANDROID_ARM64,ANDROID_X64,ANDROID_X86,JVM,LINUX_ARM64,LINUX_X64"

- name: Run Windows Tests [ Java 11 ]
if: matrix.os == 'windows-latest' && matrix.java-version == 11
run: >
./gradlew check --stacktrace
-PKMP_TARGETS="JVM,JS,ANDROID,ANDROID_ARM32,ANDROID_ARM64,ANDROID_X64,ANDROID_X86,LINUX_ARM64,LINUX_X64,WASM_JS,WASM_WASI"
- name: Run Windows Tests
if: matrix.os == 'windows-latest'
-PKMP_TARGETS="JS,JVM,WASM_JS,WASM_WASI"

- name: Run Windows Tests [ Java 19 ]
if: matrix.os == 'windows-latest' && matrix.java-version == 19
run: >
./gradlew check --stacktrace
-PKMP_TARGETS="JVM,JS,MINGW_X64,WASM_JS,WASM_WASI"
-PKMP_TARGETS="JVM,MINGW_X64"

emulator:
runs-on: ubuntu-latest
- name: Upload Test Reports
uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: test-report-${{ matrix.os }}-java${{ matrix.java-version }}
path: '**/build/reports/tests/**'
retention-days: 1

android-check:
strategy:
fail-fast: false
matrix:
api-level: [ 15, 17, 21, 24, 29 ]
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Enable KVM
run: |
Expand All @@ -91,20 +87,25 @@ jobs:
sudo udevadm trigger --name-match=kvm

- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
uses: gradle/actions/wrapper-validation@v3

- name: Setup JDK
uses: actions/setup-java@v3.11.0
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17

- name: Build
uses: gradle/gradle-build-action@v2

- name: Run Android Instrumented Tests
uses: reactivecircus/android-emulator-runner@v2
with:
emulator-boot-timeout: 300 # 5 minutes
api-level: ${{ matrix.api-level }}
script: ./gradlew :library:process-testing:connectedCheck -PKMP_TARGETS="ANDROID,JVM"

- name: Upload Test Reports
uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: test-report-android-${{ matrix.api-level }}
path: '**/build/reports/androidTests/**'
retention-days: 1
6 changes: 3 additions & 3 deletions .kotlin-js-store/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,9 @@ emoji-regex@^8.0.0:
integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==

escalade@^3.1.1:
version "3.1.2"
resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.2.tgz#54076e9ab29ea5bf3d8f1ed62acffbb88272df27"
integrity sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==
version "3.2.0"
resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.2.0.tgz#011a3f69856ba189dffa7dc8fcce99d2a87903e5"
integrity sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==

escape-string-regexp@4.0.0:
version "4.0.0"
Expand Down
28 changes: 22 additions & 6 deletions build-logic/src/main/kotlin/-KmpConfigurationExtension.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,48 @@
* See the License for the specific language governing permissions and
* limitations under the License.
**/
import io.matthewnelson.kmp.configuration.ExperimentalKmpConfigurationApi
import io.matthewnelson.kmp.configuration.extension.KmpConfigurationExtension
import io.matthewnelson.kmp.configuration.extension.container.target.KmpConfigurationContainerDsl
import org.gradle.api.Action
import org.gradle.api.JavaVersion
import org.jetbrains.kotlin.konan.target.HostManager
import java.io.File

fun KmpConfigurationExtension.configureShared(
java9ModuleName: String? = null,
publish: Boolean = false,
action: Action<KmpConfigurationContainerDsl>
) {
if (publish) {
require(!java9ModuleName.isNullOrBlank()) { "publications must specify a module-info name" }
}

configure {
options {
useUniqueModuleNames = true
}

jvm {
kotlinJvmTarget = JavaVersion.VERSION_1_8
compileSourceCompatibility = JavaVersion.VERSION_1_8
compileTargetCompatibility = JavaVersion.VERSION_1_8

// windows always throws a fit if not using Java 11. This disables
// compilations of module-info.java. Nobody deploys from Windows
// anyway...
if (!HostManager.hostIsMingw) {
@OptIn(ExperimentalKmpConfigurationApi::class)
java9ModuleInfoName = java9ModuleName
}
}

js {
target {
nodejs {
@Suppress("RedundantSamConstructor")
testTask(Action {
testTask {
useMocha { timeout = "30s" }
})
}
}
}
}
Expand Down Expand Up @@ -92,9 +110,7 @@ fun KmpConfigurationExtension.configureShared(

""".trimIndent())

with(sourceSets) {
commonTest.get().kotlin.srcDir(kotlinSrc)
}
sourceSets.commonTest.get().kotlin.srcDir(kotlinSrc)
}

action.execute(this)
Expand Down
7 changes: 1 addition & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,18 @@ plugins {
}

allprojects {

findProperty("GROUP")?.let { group = it }
findProperty("VERSION_NAME")?.let { version = it }
findProperty("POM_DESCRIPTION")?.let { description = it.toString() }

repositories {
mavenCentral()
google()
gradlePluginPortal()

maven("https://s01.oss.sonatype.org/content/repositories/snapshots")
}

}

@Suppress("PropertyName")
val CHECK_PUBLICATION = (findProperty("CHECK_PUBLICATION") as? String) != null
val CHECK_PUBLICATION = findProperty("CHECK_PUBLICATION") != null

plugins.withType<YarnPlugin> {
the<YarnRootExtension>().lockFileDirectory = rootDir.resolve(".kotlin-js-store")
Expand Down
30 changes: 16 additions & 14 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
[versions]
androidx-test-core = "1.5.0"
androidx-test-runner = "1.5.2"

gradle-android = "8.2.2"
gradle-binary-compat = "0.14.0"
gradle-kmp-configuration = "0.2.2"
gradle-binary-compat = "0.16.3"
gradle-kmp-configuration = "0.3.2"
gradle-kotlin = "1.9.24"
gradle-publish-maven = "0.28.0"
gradle-publish-maven = "0.29.0"

immutable = "0.1.3"
immutable = "0.1.4"

kmp-file = "0.1.0"
kmp-tor-resource = "408.10.0-SNAPSHOT"
kotlincrypto-endians = "0.3.0"
kmp-file = "0.1.1"
kotlincrypto-endians = "0.3.1"
kotlinx-coroutines = "1.8.1"

[libraries]
androidx-test-core = { module = "androidx.test:core", version.ref = "androidx-test-core" }
androidx-test-runner = { module = "androidx.test:runner", version.ref = "androidx-test-runner" }
# tests
androidx-test-core = "1.5.0"
androidx-test-runner = "1.5.2"
kmp-tor-resource = "408.10.0-SNAPSHOT"

[libraries]
gradle-android = { module = "com.android.tools.build:gradle", version.ref = "gradle-android" }
gradle-kmp-configuration = { module = "io.matthewnelson:gradle-kmp-configuration-plugin", version.ref = "gradle-kmp-configuration" }
gradle-kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "gradle-kotlin" }
Expand All @@ -27,9 +25,13 @@ gradle-publish-maven = { module = "com.vanniktech:gradle-maven-publish-plugin",
immutable-collections = { module = "io.matthewnelson.immutable:collections", version.ref = "immutable" }

kmp-file = { module = "io.matthewnelson.kmp-file:file", version.ref = "kmp-file" }
kmp-tor-resource-tor = { module = "io.matthewnelson.kmp-tor:resource-tor", version.ref = "kmp-tor-resource" }
kotlincrypto-endians = { module = "org.kotlincrypto.endians:endians", version.ref = "kotlincrypto-endians" }
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" }

# tests
androidx-test-core = { module = "androidx.test:core", version.ref = "androidx-test-core" }
androidx-test-runner = { module = "androidx.test:runner", version.ref = "androidx-test-runner" }
kmp-tor-resource-tor = { module = "io.matthewnelson.kmp-tor:resource-tor", version.ref = "kmp-tor-resource" }
kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinx-coroutines" }

[plugins]
Expand Down
4 changes: 4 additions & 0 deletions library/process-testing/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ plugins {
id("configuration")
}

repositories {
google()
}

kmpConfiguration {
configureShared {
androidLibrary {
Expand Down
8 changes: 1 addition & 7 deletions library/process/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
**/
import io.matthewnelson.kmp.configuration.ExperimentalKmpConfigurationApi
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
import org.jetbrains.kotlin.konan.target.Family
import org.jetbrains.kotlin.konan.target.HostManager
Expand All @@ -23,12 +22,7 @@ plugins {
}

kmpConfiguration {
configureShared(publish = true) {
jvm {
@OptIn(ExperimentalKmpConfigurationApi::class)
java9ModuleInfoName = "io.matthewnelson.kmp.process"
}

configureShared(java9ModuleName = "io.matthewnelson.kmp.process", publish = true) {
common {
sourceSetMain {
dependencies {
Expand Down