diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e055ca94..383e3921 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -64,15 +64,25 @@ jobs: with: distribution: 'zulu' java-version: '17' - cache: 'gradle' - name: Grant execute permission for Gradlew run: chmod +x gradlew - name: Upload Artifacts to Maven Central - run: ./gradlew publishToMavenCentral --no-daemon --no-parallel + run: ./gradlew publishAllPublicationsToMavenCentralRepository --no-daemon --no-parallel env: - ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }} - ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }} ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }} - ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }} \ No newline at end of file + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }} + + - name: Retrieve Version + run: | + echo "VERSION_NAME=$(cat gradle.properties | grep -w "VERSION_NAME" | cut -d'=' -f2)" >> $GITHUB_ENV + + - name: Publish Release + run: ./gradlew closeAndReleaseRepository --no-daemon --no-parallel + if: "!endsWith(env.VERSION_NAME, '-SNAPSHOT')" + env: + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }} \ No newline at end of file diff --git a/.github/workflows/create_swift_package.yml b/.github/workflows/create_swift_package.yml new file mode 100644 index 00000000..dca0c1f9 --- /dev/null +++ b/.github/workflows/create_swift_package.yml @@ -0,0 +1,7 @@ +name: Create Swift Package + +on: + workflow_dispatch: +jobs: + publish: + uses: touchlab/KMMBridgeGithubWorkflow/.github/workflows/faktorybuildbranches.yml@v0.6 \ No newline at end of file diff --git a/RELEASING.md b/RELEASING.md index 4d4ad538..4d42171d 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -2,22 +2,27 @@ Releasing ======== 1. Change the version in top level `gradle.properties` to a non-SNAPSHOT version. -2. Update the `CHANGELOG.md` for the impending release. -3. Update the `README.md` with the new version. -4. `git commit -sam "Prepare for release X.Y.Z."` (where X.Y.Z is the new version) -5. `git tag -a X.Y.X -m "Version X.Y.Z"` (where X.Y.Z is the new version) +2. Update the `cocoapods` version in `build.gradle.kts` in `:store`. +3. Modify `create_swift_package.yml` workflow. + * https://github.com/MobileNativeFoundation/Store/blob/e526400cdf51aa2f78b6b7e9e87f4a6845e6dcea/.github/workflows/create_swift_package.yml +4. Update the `CHANGELOG.md` for the impending release. +5. Update the `README.md` with the new version. +6. `git commit -sam "Prepare for release X.Y.Z."` (where X.Y.Z is the new version) +7. `git tag -a X.Y.X -m "Version X.Y.Z"` (where X.Y.Z is the new version) * Run `git tag` to verify it. -6. `git push && git push --tags` +8. `git push && git push --tags` * This should be pushed to your fork. -7. Create a PR with this commit and merge it. -8. Update the top level `build.gradle` to the next SNAPSHOT version. -9. `git commit -am "Prepare next development version."` -10. Create a PR with this commit and merge it. -11. Login to Sonatype to promote the artifacts https://central.sonatype.org/pages/releasing-the-deployment.html +9. Create a PR with this commit and merge it. +10. Update the top level `build.gradle` to the next SNAPSHOT version. +11. Modify `create_swift_package.yml` workflow to only run manually. + * https://github.com/MobileNativeFoundation/Store/blob/de9ed1764408eeaafe5e58fe602205c875a8b0b0/.github/workflows/create_swift_package.yml +12. `git commit -am "Prepare next development version."` +13. Create a PR with this commit and merge it. +14. Login to Sonatype to promote the artifacts https://central.sonatype.org/pages/releasing-the-deployment.html * This part is automated. If it fails in CI, follow the steps below. * Click on Staging Repositories under Build Promotion * Select all the Repositories that contain the content you want to release * Click on Close and refresh until the Release button is active * Click Release and submit -12. Update the sample module's `build.gradle` to point to the newly released version. (It may take ~2 hours for artifact to be available after release) +15. Update the sample module's `build.gradle` to point to the newly released version. (It may take ~2 hours for artifact to be available after release) \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 806a21c3..b3dfe068 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -19,6 +19,7 @@ buildscript { classpath(libs.jacoco.gradle.plugin) classpath(libs.maven.publish.plugin) classpath(libs.atomic.fu.gradle.plugin) + classpath(libs.kmmBridge.gradle.plugin) classpath(libs.binary.compatibility.validator) } } @@ -48,13 +49,13 @@ subprojects { tasks { withType { kotlinOptions { - jvmTarget = "17" + jvmTarget = "11" } } withType().configureEach { - sourceCompatibility = JavaVersion.VERSION_17.name - targetCompatibility = JavaVersion.VERSION_17.name + sourceCompatibility = JavaVersion.VERSION_11.name + targetCompatibility = JavaVersion.VERSION_11.name } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 226b34b8..1bf38f20 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,30 +1,35 @@ [versions] androidMinSdk = "24" androidCompileSdk = "33" -androidGradlePlugin = "8.0.2" +androidGradlePlugin = "8.0.0" androidTargetSdk = "33" atomicFu = "0.24.0" -baseKotlin = "2.1.21" +baseKotlin = "2.0.20" dokkaGradlePlugin = "1.9.20" ktlintGradle = "12.1.0" jacocoGradlePlugin = "0.8.12" mavenPublishPlugin = "0.34.0" moleculeGradlePlugin = "1.2.1" +pagingCompose = "3.3.0-alpha02" +pagingRuntime = "3.2.1" spotlessPluginGradle = "6.4.1" junit = "4.13.2" kotlinxCoroutines = "1.8.1" kotlinxSerialization = "1.6.3" kermit = "2.0.5" testCore = "1.6.1" +kmmBridge = "0.3.2" ktlint = "0.39.0" kover = "0.9.0-RC" store = "5.1.0-alpha07" truth = "1.1.3" turbine = "1.2.0" -binary-compatibility-validator = "0.16.3" +binary-compatibility-validator = "0.15.0-Beta.2" [libraries] android-gradle-plugin = { group = "com.android.tools.build", name = "gradle", version.ref = "androidGradlePlugin" } +androidx-paging-compose = { module = "androidx.paging:paging-compose", version.ref = "pagingCompose" } +androidx-paging-runtime = { module = "androidx.paging:paging-runtime", version.ref = "pagingRuntime" } kotlin-gradle-plugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "baseKotlin" } kotlin-serialization-plugin = { group = "org.jetbrains.kotlin", name = "kotlin-serialization", version.ref = "baseKotlin" } dokka-gradle-plugin = { group = "org.jetbrains.dokka", name = "dokka-gradle-plugin", version.ref = "dokkaGradlePlugin" } @@ -34,6 +39,7 @@ maven-publish-plugin = { group = "com.vanniktech", name = "gradle-maven-publish- kover-gradle-plugin = {group = "org.jetbrains.kotlinx", name = "kover-gradle-plugin", version.ref = "kover"} atomic-fu-gradle-plugin = { group = "org.jetbrains.kotlinx", name = "atomicfu-gradle-plugin", version.ref = "atomicFu" } +kmmBridge-gradle-plugin = { group = "co.touchlab.faktory.kmmbridge", name = "co.touchlab.faktory.kmmbridge.gradle.plugin", version.ref = "kmmBridge" } kotlinx-atomic-fu = { group = "org.jetbrains.kotlinx", name = "atomicfu", version.ref = "atomicFu" } kotlin-stdlib = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib", version.ref = "baseKotlin" } diff --git a/tooling/plugins/build.gradle.kts b/tooling/plugins/build.gradle.kts index 1d4fc618..49a28d78 100644 --- a/tooling/plugins/build.gradle.kts +++ b/tooling/plugins/build.gradle.kts @@ -5,11 +5,11 @@ plugins { group = "org.mobilenativefoundation.store" java { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 toolchain { - languageVersion.set(JavaLanguageVersion.of(17)) + languageVersion.set(JavaLanguageVersion.of(11)) } } @@ -18,6 +18,7 @@ dependencies { compileOnly(libs.kotlin.gradle.plugin) compileOnly(libs.dokka.gradle.plugin) compileOnly(libs.maven.publish.plugin) + compileOnly(libs.kmmBridge.gradle.plugin) compileOnly(libs.atomic.fu.gradle.plugin) } diff --git a/tooling/plugins/src/main/kotlin/org/mobilenativefoundation/store/tooling/plugins/AndroidConventionPlugin.kt b/tooling/plugins/src/main/kotlin/org/mobilenativefoundation/store/tooling/plugins/AndroidConventionPlugin.kt index ca96b4bd..7f105a3d 100644 --- a/tooling/plugins/src/main/kotlin/org/mobilenativefoundation/store/tooling/plugins/AndroidConventionPlugin.kt +++ b/tooling/plugins/src/main/kotlin/org/mobilenativefoundation/store/tooling/plugins/AndroidConventionPlugin.kt @@ -37,8 +37,8 @@ class AndroidConventionPlugin : Plugin { } compileOptions { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 } } diff --git a/tooling/plugins/src/main/kotlin/org/mobilenativefoundation/store/tooling/plugins/KotlinMultiplatformConventionPlugin.kt b/tooling/plugins/src/main/kotlin/org/mobilenativefoundation/store/tooling/plugins/KotlinMultiplatformConventionPlugin.kt index 35927daa..ddfcabc4 100644 --- a/tooling/plugins/src/main/kotlin/org/mobilenativefoundation/store/tooling/plugins/KotlinMultiplatformConventionPlugin.kt +++ b/tooling/plugins/src/main/kotlin/org/mobilenativefoundation/store/tooling/plugins/KotlinMultiplatformConventionPlugin.kt @@ -2,12 +2,15 @@ package org.mobilenativefoundation.store.tooling.plugins +import addGithubPackagesRepository +import co.touchlab.faktory.KmmBridgeExtension import com.android.build.api.dsl.LibraryExtension import com.vanniktech.maven.publish.MavenPublishBaseExtension import kotlinx.atomicfu.plugin.gradle.AtomicFUPluginExtension import org.gradle.api.JavaVersion import org.gradle.api.Plugin import org.gradle.api.Project +import org.gradle.api.plugins.ExtensionAware import org.gradle.api.plugins.JavaPluginExtension import org.gradle.jvm.toolchain.JavaLanguageVersion import org.gradle.kotlin.dsl.configure @@ -16,6 +19,7 @@ import org.gradle.kotlin.dsl.withType import org.jetbrains.dokka.gradle.DokkaTask import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension +import org.jetbrains.kotlin.gradle.plugin.cocoapods.CocoapodsExtension import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget class KotlinMultiplatformConventionPlugin : Plugin { @@ -28,7 +32,9 @@ class KotlinMultiplatformConventionPlugin : Plugin { apply("com.android.library") apply("com.vanniktech.maven.publish") apply("org.jetbrains.dokka") + apply("co.touchlab.faktory.kmmbridge") apply("maven-publish") + apply("org.jetbrains.kotlin.native.cocoapods") apply("kotlinx-atomicfu") apply("org.jetbrains.kotlinx.binary-compatibility-validator") } @@ -36,9 +42,10 @@ class KotlinMultiplatformConventionPlugin : Plugin { extensions.configure { - androidTarget() applyDefaultHierarchyTemplate() + androidTarget() + jvm() iosX64() @@ -57,7 +64,7 @@ class KotlinMultiplatformConventionPlugin : Plugin { nodejs() } - jvmToolchain(17) + jvmToolchain(11) targets.all { compilations.all { @@ -110,13 +117,15 @@ class KotlinMultiplatformConventionPlugin : Plugin { dependsOn(sourceSets.getByName("commonMain")) } - + configureCocoapods() } configureKotlin() configureAndroid() configureDokka() configureMavenPublishing() + addGithubPackagesRepository() + configureKmmBridge() configureAtomicFu() } } @@ -129,14 +138,13 @@ fun Project.configureKotlin() { fun Project.configureJava() { java { toolchain { - languageVersion.set(JavaLanguageVersion.of(17)) + languageVersion.set(JavaLanguageVersion.of(11)) } } } fun Project.configureAndroid() { android { - namespace = "org.mobilenativefoundation.store.$name" sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml") compileSdk = Versions.COMPILE_SDK defaultConfig { @@ -151,8 +159,8 @@ fun Project.configureAndroid() { } compileOptions { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 } } } @@ -172,11 +180,18 @@ object Versions { fun Project.configureMavenPublishing() = extensions.configure { - publishToMavenCentral(automaticRelease = true) + publishToMavenCentral() signAllPublications() } +fun Project.configureKmmBridge() = extensions.configure { + githubReleaseArtifacts() + githubReleaseVersions() + versionPrefix.set(Versions.STORE) + spm() +} + fun Project.configureAtomicFu() = extensions.configure { transformJvm = false @@ -187,6 +202,18 @@ fun Project.configureDokka() = tasks.withType().configureEach { dokkaSourceSets.configureEach { reportUndocumented.set(false) skipDeprecated.set(true) - jdkVersion.set(17) + jdkVersion.set(11) + } +} + +fun Project.android(name: String) { + android { + namespace = "org.mobilenativefoundation.store.$name" + } +} + +fun KotlinMultiplatformExtension.configureCocoapods(){ + (this as ExtensionAware).extensions.configure(CocoapodsExtension::class.java) { + version = Versions.STORE } } \ No newline at end of file