diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 0d7f74f..47a3038 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -9,7 +9,7 @@ on: jobs: lint: name: Spotless check - runs-on: ubuntu-latest + runs-on: macos-latest steps: - name: Check out code uses: actions/checkout@v2 @@ -23,7 +23,7 @@ jobs: api_check: name: API check - runs-on: ubuntu-latest + runs-on: macos-latest steps: - name: Check out code uses: actions/checkout@v2 @@ -36,7 +36,7 @@ jobs: run: ./gradlew apiCheck build: - runs-on: ubuntu-latest + runs-on: macos-latest steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/publish-snapshot.yml b/.github/workflows/publish-snapshot.yml deleted file mode 100644 index e9af057..0000000 --- a/.github/workflows/publish-snapshot.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Publish Snapshot builds - -on: - push: - branches: - - main - workflow_dispatch: - -jobs: - publish: - name: Snapshot build and publish - runs-on: ubuntu-latest - steps: - - name: Check out code - uses: actions/checkout@v3.1.0 - - - name: Set up JDK 17 - uses: actions/setup-java@v3.5.1 - with: - distribution: 'zulu' - java-version: 17 - - - name: Grant Permission to Execute Gradle - run: chmod +x gradlew - - - name: Release build - run: ./gradlew assemble --scan - - - name: Publish to MavenCentral - run: | - ./gradlew publishAllPublicationsToMavenCentral --no-daemon --no-parallel - env: - ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.OSSRH_USERNAME }} - ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.OSSRH_PASSWORD }} - ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_KEY_ID }} - ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }} - ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }} - SNAPSHOT: true diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 77d3259..83f4c74 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -8,7 +8,7 @@ on: jobs: publish: name: Snapshot build and publish - runs-on: ubuntu-latest + runs-on: macos-latest steps: - name: Check out code uses: actions/checkout@v3.1.0 diff --git a/.kotlin/metadata/kotlinTransformedMetadataLibraries/org.jetbrains.kotlin-kotlin-stdlib-2.0.21-commonMain-WPEnbA.klib b/.kotlin/metadata/kotlinTransformedMetadataLibraries/org.jetbrains.kotlin-kotlin-stdlib-2.0.21-commonMain-WPEnbA.klib new file mode 100644 index 0000000..25c2d03 Binary files /dev/null and b/.kotlin/metadata/kotlinTransformedMetadataLibraries/org.jetbrains.kotlin-kotlin-stdlib-2.0.21-commonMain-WPEnbA.klib differ diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 1204b29..2329bff 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -2,6 +2,7 @@ plugins { id(libs.plugins.android.application.get().pluginId) id(libs.plugins.kotlin.android.get().pluginId) + id(libs.plugins.compose.compiler.get().pluginId) } android { @@ -30,10 +31,6 @@ android { jvmTarget = libs.versions.jvmTarget.get() } - composeOptions { - kotlinCompilerExtensionVersion = libs.versions.androidxComposeCompiler.get() - } - packaging { resources { excludes.add("/META-INF/{AL2.0,LGPL2.1}") diff --git a/build.gradle.kts b/build.gradle.kts index 816c35c..521b98a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,6 +4,8 @@ plugins { alias(libs.plugins.android.library) apply false alias(libs.plugins.kotlin.android) apply false alias(libs.plugins.kotlin.binary.compatibility) apply false + alias(libs.plugins.kotlin.multiplatform) apply false + alias(libs.plugins.compose.compiler) apply false alias(libs.plugins.nexus.plugin) alias(libs.plugins.spotless) alias(libs.plugins.dokka) diff --git a/gradle.properties b/gradle.properties index 86b40b5..0747c57 100644 --- a/gradle.properties +++ b/gradle.properties @@ -43,13 +43,13 @@ android.defaults.buildfeatures.shaders=false # https://developer.android.com/studio/releases/gradle-plugin#4.1-nontransitive-r-class android.nonTransitiveRClass=true +## Maven Central Publication ## # Required to publish to Nexus (see https://github.com/gradle/gradle/issues/11308) systemProp.org.gradle.internal.publish.checksums.insecure=true # Increase timeout when pushing to Sonatype (otherwise we get timeouts) systemProp.org.gradle.internal.http.socketTimeout=120000 - POM_URL=https://github.com/skydoves/whatif/ POM_SCM_URL=https://github.com/skydoves/whatif/ POM_SCM_CONNECTION=scm:git:git://github.com/skydoves/whatif.git diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 823c79e..5f27c73 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,26 +1,27 @@ [versions] -agp = "8.1.2" -kotlin = "1.9.10" +agp = "8.6.1" +kotlin = "2.0.21" dokka = "1.9.0" -nexusPlugin = "0.25.3" -kotlinBinaryCompatibility = "0.13.1" +nexusPlugin = "0.26.0" +kotlinBinaryCompatibility = "0.16.3" jvmTarget = "11" -material = "1.10.0" -androidxActivity = "1.8.0" -androidxAppCompat = "1.6.1" -androidxCompose = "1.5.3" -androidxComposeCompiler = "1.5.3" -landscapist = "2.2.10" +material = "1.12.0" +androidxActivity = "1.9.2" +androidxAppCompat = "1.7.0" +androidxCompose = "1.7.3" +landscapist = "2.4.1" coroutines = "1.7.3" retrofit = "2.9.0" retrofitAdapters = "1.0.9" -robolectric = "4.10.3" +robolectric = "4.12.1" spotless = "6.19.0" [plugins] android-application = { id = "com.android.application", version.ref = "agp" } android-library = { id = "com.android.library", version.ref = "agp" } kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } +kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } +compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" } nexus-plugin = { id = "com.vanniktech.maven.publish", version.ref = "nexusPlugin" } spotless = { id = "com.diffplug.spotless", version.ref = "spotless" } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 309b4e1..b256797 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ +#Tue Oct 15 22:13:09 KST 2024 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/settings.gradle.kts b/settings.gradle.kts index 3c8ca30..5019d76 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -7,7 +7,6 @@ pluginManagement { } } dependencyResolutionManagement { - repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) repositories { google() mavenCentral() diff --git a/whatif/api/android/whatif.api b/whatif/api/android/whatif.api new file mode 100644 index 0000000..0b19b51 --- /dev/null +++ b/whatif/api/android/whatif.api @@ -0,0 +1,62 @@ +public final class com/skydoves/whatif/WhatIfArrayKt { + public static final synthetic fun whatIfNotNullOrEmpty ([BLkotlin/jvm/functions/Function1;)[B + public static final synthetic fun whatIfNotNullOrEmpty ([BLkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;)[B + public static final synthetic fun whatIfNotNullOrEmpty ([CLkotlin/jvm/functions/Function1;)[C + public static final synthetic fun whatIfNotNullOrEmpty ([CLkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;)[C + public static final synthetic fun whatIfNotNullOrEmpty ([DLkotlin/jvm/functions/Function1;)[D + public static final synthetic fun whatIfNotNullOrEmpty ([DLkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;)[D + public static final synthetic fun whatIfNotNullOrEmpty ([FLkotlin/jvm/functions/Function1;)[F + public static final synthetic fun whatIfNotNullOrEmpty ([FLkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;)[F + public static final synthetic fun whatIfNotNullOrEmpty ([ILkotlin/jvm/functions/Function1;)[I + public static final synthetic fun whatIfNotNullOrEmpty ([ILkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;)[I + public static final synthetic fun whatIfNotNullOrEmpty ([JLkotlin/jvm/functions/Function1;)[J + public static final synthetic fun whatIfNotNullOrEmpty ([JLkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;)[J + public static final synthetic fun whatIfNotNullOrEmpty ([Ljava/lang/Object;Lkotlin/jvm/functions/Function1;)[Ljava/lang/Object; + public static final synthetic fun whatIfNotNullOrEmpty ([Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;)[Ljava/lang/Object; + public static final synthetic fun whatIfNotNullOrEmpty ([SLkotlin/jvm/functions/Function1;)[S + public static final synthetic fun whatIfNotNullOrEmpty ([SLkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;)[S + public static final synthetic fun whatIfNotNullOrEmpty ([ZLkotlin/jvm/functions/Function1;)[Z + public static final synthetic fun whatIfNotNullOrEmpty ([ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;)[Z +} + +public final class com/skydoves/whatif/WhatIfCollectionsKt { + public static final synthetic fun whatIfAnd (Ljava/lang/Iterable;Lkotlin/jvm/functions/Function0;)Ljava/lang/Iterable; + public static final synthetic fun whatIfAnd (Ljava/lang/Iterable;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function0;)Ljava/lang/Iterable; + public static final synthetic fun whatIfNotNullOrEmpty (Ljava/util/List;Lkotlin/jvm/functions/Function1;)Ljava/util/List; + public static final synthetic fun whatIfNotNullOrEmpty (Ljava/util/List;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;)Ljava/util/List; + public static final synthetic fun whatIfNotNullOrEmpty (Ljava/util/Map;Lkotlin/jvm/functions/Function1;)Ljava/util/Map; + public static final synthetic fun whatIfNotNullOrEmpty (Ljava/util/Map;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;)Ljava/util/Map; + public static final synthetic fun whatIfNotNullOrEmpty (Ljava/util/Set;Lkotlin/jvm/functions/Function1;)Ljava/util/Set; + public static final synthetic fun whatIfNotNullOrEmpty (Ljava/util/Set;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;)Ljava/util/Set; + public static final synthetic fun whatIfOr (Ljava/lang/Iterable;Lkotlin/jvm/functions/Function0;)Ljava/lang/Iterable; + public static final synthetic fun whatIfOr (Ljava/lang/Iterable;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function0;)Ljava/lang/Iterable; +} + +public final class com/skydoves/whatif/WhatIfKt { + public static final synthetic fun whatIf (Ljava/lang/Boolean;Lkotlin/jvm/functions/Function0;)Ljava/lang/Boolean; + public static final synthetic fun whatIf (Ljava/lang/Boolean;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function0;)Ljava/lang/Boolean; + public static final synthetic fun whatIf (Ljava/lang/Object;Ljava/lang/Boolean;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; + public static final synthetic fun whatIf (Ljava/lang/Object;Ljava/lang/Boolean;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; + public static final synthetic fun whatIf (Ljava/lang/Object;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; + public static final synthetic fun whatIf (Ljava/lang/Object;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; + public static final synthetic fun whatIf (Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;)Ljava/lang/Object; + public static final synthetic fun whatIf (Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function0;)Ljava/lang/Object; + public static final synthetic fun whatIfAnd (Ljava/lang/Boolean;Ljava/lang/Boolean;Lkotlin/jvm/functions/Function0;)Ljava/lang/Boolean; + public static final synthetic fun whatIfElse (Ljava/lang/Boolean;Lkotlin/jvm/functions/Function0;)Ljava/lang/Boolean; + public static final synthetic fun whatIfLet (Ljava/lang/Object;Ljava/lang/Boolean;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; + public static final synthetic fun whatIfLet (Ljava/lang/Object;Ljava/lang/Boolean;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; + public static final synthetic fun whatIfMap (Ljava/lang/Object;Ljava/lang/Boolean;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; + public static final synthetic fun whatIfMap (Ljava/lang/Object;Ljava/lang/Boolean;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; + public static final synthetic fun whatIfMap (Ljava/lang/Object;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; + public static final synthetic fun whatIfMap (Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; + public static final synthetic fun whatIfNotNull (Ljava/lang/Object;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; + public static final synthetic fun whatIfNotNull (Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;)Ljava/lang/Object; + public static final synthetic fun whatIfNotNullWith (Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; + public static final synthetic fun whatIfOr (Ljava/lang/Boolean;Ljava/lang/Boolean;Lkotlin/jvm/functions/Function0;)Ljava/lang/Boolean; +} + +public final class com/skydoves/whatif/WhatIfStringKt { + public static final synthetic fun whatIfNotNullOrEmpty (Ljava/lang/String;Lkotlin/jvm/functions/Function1;)Ljava/lang/String; + public static final synthetic fun whatIfNotNullOrEmpty (Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;)Ljava/lang/String; +} + diff --git a/whatif/api/jvm/whatif.api b/whatif/api/jvm/whatif.api new file mode 100644 index 0000000..0b19b51 --- /dev/null +++ b/whatif/api/jvm/whatif.api @@ -0,0 +1,62 @@ +public final class com/skydoves/whatif/WhatIfArrayKt { + public static final synthetic fun whatIfNotNullOrEmpty ([BLkotlin/jvm/functions/Function1;)[B + public static final synthetic fun whatIfNotNullOrEmpty ([BLkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;)[B + public static final synthetic fun whatIfNotNullOrEmpty ([CLkotlin/jvm/functions/Function1;)[C + public static final synthetic fun whatIfNotNullOrEmpty ([CLkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;)[C + public static final synthetic fun whatIfNotNullOrEmpty ([DLkotlin/jvm/functions/Function1;)[D + public static final synthetic fun whatIfNotNullOrEmpty ([DLkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;)[D + public static final synthetic fun whatIfNotNullOrEmpty ([FLkotlin/jvm/functions/Function1;)[F + public static final synthetic fun whatIfNotNullOrEmpty ([FLkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;)[F + public static final synthetic fun whatIfNotNullOrEmpty ([ILkotlin/jvm/functions/Function1;)[I + public static final synthetic fun whatIfNotNullOrEmpty ([ILkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;)[I + public static final synthetic fun whatIfNotNullOrEmpty ([JLkotlin/jvm/functions/Function1;)[J + public static final synthetic fun whatIfNotNullOrEmpty ([JLkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;)[J + public static final synthetic fun whatIfNotNullOrEmpty ([Ljava/lang/Object;Lkotlin/jvm/functions/Function1;)[Ljava/lang/Object; + public static final synthetic fun whatIfNotNullOrEmpty ([Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;)[Ljava/lang/Object; + public static final synthetic fun whatIfNotNullOrEmpty ([SLkotlin/jvm/functions/Function1;)[S + public static final synthetic fun whatIfNotNullOrEmpty ([SLkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;)[S + public static final synthetic fun whatIfNotNullOrEmpty ([ZLkotlin/jvm/functions/Function1;)[Z + public static final synthetic fun whatIfNotNullOrEmpty ([ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;)[Z +} + +public final class com/skydoves/whatif/WhatIfCollectionsKt { + public static final synthetic fun whatIfAnd (Ljava/lang/Iterable;Lkotlin/jvm/functions/Function0;)Ljava/lang/Iterable; + public static final synthetic fun whatIfAnd (Ljava/lang/Iterable;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function0;)Ljava/lang/Iterable; + public static final synthetic fun whatIfNotNullOrEmpty (Ljava/util/List;Lkotlin/jvm/functions/Function1;)Ljava/util/List; + public static final synthetic fun whatIfNotNullOrEmpty (Ljava/util/List;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;)Ljava/util/List; + public static final synthetic fun whatIfNotNullOrEmpty (Ljava/util/Map;Lkotlin/jvm/functions/Function1;)Ljava/util/Map; + public static final synthetic fun whatIfNotNullOrEmpty (Ljava/util/Map;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;)Ljava/util/Map; + public static final synthetic fun whatIfNotNullOrEmpty (Ljava/util/Set;Lkotlin/jvm/functions/Function1;)Ljava/util/Set; + public static final synthetic fun whatIfNotNullOrEmpty (Ljava/util/Set;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;)Ljava/util/Set; + public static final synthetic fun whatIfOr (Ljava/lang/Iterable;Lkotlin/jvm/functions/Function0;)Ljava/lang/Iterable; + public static final synthetic fun whatIfOr (Ljava/lang/Iterable;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function0;)Ljava/lang/Iterable; +} + +public final class com/skydoves/whatif/WhatIfKt { + public static final synthetic fun whatIf (Ljava/lang/Boolean;Lkotlin/jvm/functions/Function0;)Ljava/lang/Boolean; + public static final synthetic fun whatIf (Ljava/lang/Boolean;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function0;)Ljava/lang/Boolean; + public static final synthetic fun whatIf (Ljava/lang/Object;Ljava/lang/Boolean;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; + public static final synthetic fun whatIf (Ljava/lang/Object;Ljava/lang/Boolean;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; + public static final synthetic fun whatIf (Ljava/lang/Object;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; + public static final synthetic fun whatIf (Ljava/lang/Object;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; + public static final synthetic fun whatIf (Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;)Ljava/lang/Object; + public static final synthetic fun whatIf (Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function0;)Ljava/lang/Object; + public static final synthetic fun whatIfAnd (Ljava/lang/Boolean;Ljava/lang/Boolean;Lkotlin/jvm/functions/Function0;)Ljava/lang/Boolean; + public static final synthetic fun whatIfElse (Ljava/lang/Boolean;Lkotlin/jvm/functions/Function0;)Ljava/lang/Boolean; + public static final synthetic fun whatIfLet (Ljava/lang/Object;Ljava/lang/Boolean;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; + public static final synthetic fun whatIfLet (Ljava/lang/Object;Ljava/lang/Boolean;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; + public static final synthetic fun whatIfMap (Ljava/lang/Object;Ljava/lang/Boolean;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; + public static final synthetic fun whatIfMap (Ljava/lang/Object;Ljava/lang/Boolean;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; + public static final synthetic fun whatIfMap (Ljava/lang/Object;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; + public static final synthetic fun whatIfMap (Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; + public static final synthetic fun whatIfNotNull (Ljava/lang/Object;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; + public static final synthetic fun whatIfNotNull (Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;)Ljava/lang/Object; + public static final synthetic fun whatIfNotNullWith (Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; + public static final synthetic fun whatIfOr (Ljava/lang/Boolean;Ljava/lang/Boolean;Lkotlin/jvm/functions/Function0;)Ljava/lang/Boolean; +} + +public final class com/skydoves/whatif/WhatIfStringKt { + public static final synthetic fun whatIfNotNullOrEmpty (Ljava/lang/String;Lkotlin/jvm/functions/Function1;)Ljava/lang/String; + public static final synthetic fun whatIfNotNullOrEmpty (Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;)Ljava/lang/String; +} + diff --git a/whatif/build.gradle.kts b/whatif/build.gradle.kts index 547eaa5..a46eaf5 100644 --- a/whatif/build.gradle.kts +++ b/whatif/build.gradle.kts @@ -1,6 +1,7 @@ plugins { - kotlin("jvm") + id(libs.plugins.android.library.get().pluginId) id(libs.plugins.nexus.plugin.get().pluginId) + id(libs.plugins.kotlin.multiplatform.get().pluginId) id(libs.plugins.kotlin.binary.compatibility.get().pluginId) } @@ -20,11 +21,63 @@ mavenPublishing { } } +kotlin { + listOf( + iosX64(), + iosArm64(), + iosSimulatorArm64(), + macosArm64(), + macosX64(), + ).forEach { + it.binaries.framework { + baseName = "common" + } + } + + androidTarget { + publishLibraryVariants("release") + } + + jvm { + libs.versions.jvmTarget.get().toInt() + compilations.all { + kotlinOptions.jvmTarget = libs.versions.jvmTarget.get() + } + } + + applyDefaultHierarchyTemplate() + + sourceSets { + all { + languageSettings.optIn("kotlin.contracts.ExperimentalContracts") + languageSettings.optIn("com.skydoves.sandwich.annotations.InternalSandwichApi") + } + + val commonTest by getting { + dependencies { + implementation(libs.junit) + } + } + } + + explicitApi() +} + +android { + compileSdk = Configuration.compileSdk + namespace = "com.skydoves.whatif" + defaultConfig { + minSdk = Configuration.minSdk + consumerProguardFiles("consumer-rules.pro") + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + } +} + tasks.withType(JavaCompile::class.java).configureEach { this.targetCompatibility = libs.versions.jvmTarget.get() this.sourceCompatibility = libs.versions.jvmTarget.get() -} - -dependencies { - testImplementation(libs.junit) } \ No newline at end of file diff --git a/whatif/src/main/AndroidManifest.xml b/whatif/src/commonMain/AndroidManifest.xml similarity index 100% rename from whatif/src/main/AndroidManifest.xml rename to whatif/src/commonMain/AndroidManifest.xml diff --git a/whatif/src/main/kotlin/com/skydoves/whatif/WhatIf.kt b/whatif/src/commonMain/kotlin/com/skydoves/whatif/WhatIf.kt similarity index 99% rename from whatif/src/main/kotlin/com/skydoves/whatif/WhatIf.kt rename to whatif/src/commonMain/kotlin/com/skydoves/whatif/WhatIf.kt index 7f60ffb..e5be8d0 100644 --- a/whatif/src/main/kotlin/com/skydoves/whatif/WhatIf.kt +++ b/whatif/src/commonMain/kotlin/com/skydoves/whatif/WhatIf.kt @@ -15,13 +15,12 @@ */ @file:Suppress("unused") -@file:JvmName("WhatIf") -@file:JvmMultifileClass package com.skydoves.whatif import kotlin.contracts.InvocationKind import kotlin.contracts.contract +import kotlin.jvm.JvmSynthetic /** * WhatIf is kotlin extensions for expressing a single if-else statement, nullable and boolean. diff --git a/whatif/src/main/kotlin/com/skydoves/whatif/WhatIfArray.kt b/whatif/src/commonMain/kotlin/com/skydoves/whatif/WhatIfArray.kt similarity index 99% rename from whatif/src/main/kotlin/com/skydoves/whatif/WhatIfArray.kt rename to whatif/src/commonMain/kotlin/com/skydoves/whatif/WhatIfArray.kt index 5e6235d..2a686bf 100644 --- a/whatif/src/main/kotlin/com/skydoves/whatif/WhatIfArray.kt +++ b/whatif/src/commonMain/kotlin/com/skydoves/whatif/WhatIfArray.kt @@ -14,13 +14,11 @@ * limitations under the License. */ -@file:JvmName("WhatIfArray") -@file:JvmMultifileClass - package com.skydoves.whatif import kotlin.contracts.InvocationKind import kotlin.contracts.contract +import kotlin.jvm.JvmSynthetic /** * An expression for invoking [whatIf] when the [Array] is not null and not empty. diff --git a/whatif/src/main/kotlin/com/skydoves/whatif/WhatIfCollections.kt b/whatif/src/commonMain/kotlin/com/skydoves/whatif/WhatIfCollections.kt similarity index 99% rename from whatif/src/main/kotlin/com/skydoves/whatif/WhatIfCollections.kt rename to whatif/src/commonMain/kotlin/com/skydoves/whatif/WhatIfCollections.kt index a92087a..cdf8df5 100644 --- a/whatif/src/main/kotlin/com/skydoves/whatif/WhatIfCollections.kt +++ b/whatif/src/commonMain/kotlin/com/skydoves/whatif/WhatIfCollections.kt @@ -14,13 +14,11 @@ * limitations under the License. */ -@file:JvmName("WhatIfCollections") -@file:JvmMultifileClass - package com.skydoves.whatif import kotlin.contracts.InvocationKind import kotlin.contracts.contract +import kotlin.jvm.JvmSynthetic /** * An expression for invoking [whatIf] when the [List] is not null and not empty. diff --git a/whatif/src/main/kotlin/com/skydoves/whatif/WhatIfInlineOnly.kt b/whatif/src/commonMain/kotlin/com/skydoves/whatif/WhatIfInlineOnly.kt similarity index 100% rename from whatif/src/main/kotlin/com/skydoves/whatif/WhatIfInlineOnly.kt rename to whatif/src/commonMain/kotlin/com/skydoves/whatif/WhatIfInlineOnly.kt diff --git a/whatif/src/main/kotlin/com/skydoves/whatif/WhatIfString.kt b/whatif/src/commonMain/kotlin/com/skydoves/whatif/WhatIfString.kt similarity index 97% rename from whatif/src/main/kotlin/com/skydoves/whatif/WhatIfString.kt rename to whatif/src/commonMain/kotlin/com/skydoves/whatif/WhatIfString.kt index cfbf846..ce90244 100644 --- a/whatif/src/main/kotlin/com/skydoves/whatif/WhatIfString.kt +++ b/whatif/src/commonMain/kotlin/com/skydoves/whatif/WhatIfString.kt @@ -14,13 +14,11 @@ * limitations under the License. */ -@file:JvmName("WhatIfString") -@file:JvmMultifileClass - package com.skydoves.whatif import kotlin.contracts.InvocationKind import kotlin.contracts.contract +import kotlin.jvm.JvmSynthetic /** * An expression for invoking [whatIf] when the [String] is not null and not empty. diff --git a/whatif/src/test/kotlin/com/skydoves/whatif/Poster.kt b/whatif/src/commonTest/kotlin/com/skydoves/whatif/Poster.kt similarity index 100% rename from whatif/src/test/kotlin/com/skydoves/whatif/Poster.kt rename to whatif/src/commonTest/kotlin/com/skydoves/whatif/Poster.kt diff --git a/whatif/src/test/kotlin/com/skydoves/whatif/WhatIfArrayUnitTest.kt b/whatif/src/commonTest/kotlin/com/skydoves/whatif/WhatIfArrayUnitTest.kt similarity index 100% rename from whatif/src/test/kotlin/com/skydoves/whatif/WhatIfArrayUnitTest.kt rename to whatif/src/commonTest/kotlin/com/skydoves/whatif/WhatIfArrayUnitTest.kt diff --git a/whatif/src/test/kotlin/com/skydoves/whatif/WhatIfCollectionsUnitTest.kt b/whatif/src/commonTest/kotlin/com/skydoves/whatif/WhatIfCollectionsUnitTest.kt similarity index 100% rename from whatif/src/test/kotlin/com/skydoves/whatif/WhatIfCollectionsUnitTest.kt rename to whatif/src/commonTest/kotlin/com/skydoves/whatif/WhatIfCollectionsUnitTest.kt diff --git a/whatif/src/test/kotlin/com/skydoves/whatif/WhatIfStringUnitTest.kt b/whatif/src/commonTest/kotlin/com/skydoves/whatif/WhatIfStringUnitTest.kt similarity index 100% rename from whatif/src/test/kotlin/com/skydoves/whatif/WhatIfStringUnitTest.kt rename to whatif/src/commonTest/kotlin/com/skydoves/whatif/WhatIfStringUnitTest.kt diff --git a/whatif/src/test/kotlin/com/skydoves/whatif/WhatIfUnitTest.kt b/whatif/src/commonTest/kotlin/com/skydoves/whatif/WhatIfUnitTest.kt similarity index 100% rename from whatif/src/test/kotlin/com/skydoves/whatif/WhatIfUnitTest.kt rename to whatif/src/commonTest/kotlin/com/skydoves/whatif/WhatIfUnitTest.kt