diff --git a/.github/workflows/publish-new-version.yml b/.github/workflows/publish-new-version.yml index ef5196d631c..4908de06f87 100644 --- a/.github/workflows/publish-new-version.yml +++ b/.github/workflows/publish-new-version.yml @@ -58,20 +58,22 @@ jobs: publish: needs: generate_release_notes - uses: GetStream/android-ci-actions/.github/workflows/release-new-version.yml@v0.1 + uses: GetStream/android-ci-actions/.github/workflows/release-new-version.yml@main with: ref: "release" bump: ${{ inputs.bump }} file-path: ./buildSrc/src/main/kotlin/io/getstream/chat/android/Configuration.kt release-notes: ${{ needs.generate_release_notes.outputs.release_notes }} excluded-modules: "stream-chat-android-ui-components-sample,stream-chat-android-compose-sample,stream-chat-android-docs" + use-official-plugin: false + # Disable explicit documentation tasks as they are already included while publishing + documentation-tasks: tasks secrets: OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} SIGNING_KEY: ${{ secrets.SIGNING_KEY }} - SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} STREAM_PUBLIC_BOT_TOKEN: ${{ secrets.STREAM_PUBLIC_BOT_TOKEN }} update_develop_changelog: @@ -100,4 +102,4 @@ jobs: with: github_token: ${{ secrets.STREAM_PUBLIC_BOT_TOKEN }} branch: develop - force: true \ No newline at end of file + force: true diff --git a/.github/workflows/publish-snapshot.yml b/.github/workflows/publish-snapshot.yml index d9ccd7e3a6b..93461bc8b07 100644 --- a/.github/workflows/publish-snapshot.yml +++ b/.github/workflows/publish-snapshot.yml @@ -14,20 +14,15 @@ jobs: - name: Check out code uses: actions/checkout@v3.1.0 - uses: GetStream/android-ci-actions/actions/setup-java@main - - name: Release build - # assembleRelease for all modules, excluding non-library modules: samples, docs - run: ./gradlew assembleRelease -x :stream-chat-android-ui-components-sample:assembleRelease -x :stream-chat-android-compose-sample:assembleRelease -x :stream-chat-android-docs:assembleRelease - - name: Source jar and dokka - run: ./gradlew androidSourcesJar javadocJar - name: Publish to MavenCentral - run: ./gradlew publishReleasePublicationToSonatypeRepository + run: ./gradlew publishToMavenCentral env: - OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} - OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} - SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} - SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} - SIGNING_KEY: ${{ secrets.SIGNING_KEY }} - SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} + 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 }} + ORG_GRADLE_PROJECT_RELEASE_SIGNING_ENABLED: true SNAPSHOT: true - name: Show snapshot version run: ./scripts/show-last-snapshot-update.sh diff --git a/build.gradle.kts b/build.gradle.kts index ee602699bbe..a1d4a005db3 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,6 +1,8 @@ import com.android.build.api.dsl.ApplicationExtension import com.android.build.gradle.LibraryExtension import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask +import com.vanniktech.maven.publish.MavenPublishBaseExtension +import io.getstream.chat.android.Configuration import io.getstream.chat.android.Dependencies import io.getstream.chat.android.command.changelog.task.ChangelogReleaseSectionTask import io.getstream.chat.android.command.release.task.ReleaseTask @@ -37,9 +39,8 @@ plugins { id("io.getstream.chat.VersionPrintPlugin") alias(libs.plugins.gitversioner) alias(libs.plugins.gradle.versions) - alias(libs.plugins.nexus.publish) alias(libs.plugins.binary.compatibility.validator) - alias(libs.plugins.dokka) + alias(libs.plugins.maven.publish) } buildscript { @@ -133,4 +134,81 @@ apiValidation { ) } -apply(from = "${rootDir}/scripts/publish-root.gradle") +private val isSnapshot = System.getenv("SNAPSHOT")?.toBoolean() == true +version = if (isSnapshot) Configuration.snapshotVersionName else Configuration.versionName + +subprojects { + plugins.withId("com.vanniktech.maven.publish") { + extensions.configure { + publishToMavenCentral(automaticRelease = true) + + pom { + name.set(project.name) + description.set("Stream Chat official Android SDK") + url.set("https://github.com/getstream/stream-chat-android") + + licenses { + license { + name.set("Stream License") + url.set("https://github.com/GetStream/stream-chat-android/blob/main/LICENSE") + } + } + + developers { + developer { + id = "aleksandar-apostolov" + name = "Aleksandar Apostolov" + email = "aleksandar.apostolov@getstream.io" + } + developer { + id = "VelikovPetar" + name = "Petar Velikov" + email = "petar.velikov@getstream.io" + } + developer { + id = "andremion" + name = "André Mion" + email = "andre.rego@getstream.io" + } + developer { + id = "rahul-lohra" + name = "Rahul Kumar Lohra" + email = "rahul.lohra@getstream.io" + } + developer { + id = "PratimMallick" + name = "Pratim Mallick" + email = "pratim.mallick@getstream.io" + } + developer { + id = "gpunto" + name = "Gianmarco David" + email = "gianmarco.david@getstream.io" + } + } + + scm { + connection.set("scm:git:github.com/getstream/stream-chat-android.git") + developerConnection.set("scm:git:ssh://github.com/getstream/stream-chat-android.git") + url.set("https://github.com/getstream/stream-chat-android/tree/main") + } + } + } + } +} + +tasks.register("printAllArtifacts") { + group = "publishing" + description = "Prints all artifacts that will be published" + + doLast { + subprojects.forEach { subproject -> + subproject.plugins.withId("com.vanniktech.maven.publish") { + subproject.extensions.findByType(PublishingExtension::class.java) + ?.publications + ?.filterIsInstance() + ?.forEach { println("${it.groupId}:${it.artifactId}:${it.version}") } + } + } + } +} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 2e3c8737949..7844417d145 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -47,7 +47,6 @@ firebaseCrashlyticsPlugin = "3.0.2" firebaseMessaging = "24.1.0" gitversioner = "0.5.0" googleServices = "4.4.2" -gradleNexusPublishPlugin = "1.3.0" gradleVersionsPlugin = "0.51.0" huaweiPush = "6.11.0.300" ituDateVersion = "1.10.2" @@ -93,6 +92,7 @@ turbine = "1.2.0" work = "2.9.1" playServicesLocation = "21.3.0" kover = "0.9.2" +mavenPublish = "0.34.0" [libraries] allure-kotlin-model = { module = "io.qameta.allure:allure-kotlin-model", version.ref = "allureKotlin"} @@ -245,7 +245,7 @@ kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin"} kotlin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin"} kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin"} ksp = { id = "com.google.devtools.ksp", version.ref = "ksp"} -nexus-publish = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "gradleNexusPublishPlugin"} +maven-publish = { id = "com.vanniktech.maven.publish", version.ref = "mavenPublish"} shot = { id = "shot", version.ref = "shot"} sonarqube = { id = "org.sonarqube", version.ref = "sonarqube"} spotless = { id = "com.diffplug.spotless", version.ref = "spotless"} diff --git a/scripts/publish-module.gradle b/scripts/publish-module.gradle deleted file mode 100644 index 595e232da53..00000000000 --- a/scripts/publish-module.gradle +++ /dev/null @@ -1,121 +0,0 @@ -apply plugin: 'maven-publish' -apply plugin: 'signing' -apply plugin: 'org.jetbrains.dokka' - -tasks.register('androidSourcesJar', Jar) { - archiveClassifier.set('sources') - if (project.plugins.findPlugin("com.android.library")) { - from android.sourceSets.main.java.srcDirs - from android.sourceSets.main.kotlin.srcDirs - } else { - from sourceSets.main.java.srcDirs - from sourceSets.main.kotlin.srcDirs - } -} - -tasks.withType(dokkaHtmlPartial.getClass()).configureEach { - pluginsMapConfiguration.set( - ["org.jetbrains.dokka.base.DokkaBase": """{ "separateInheritedMembers": true}"""] - ) -} - -task javadocJar(type: Jar, dependsOn: dokkaJavadoc) { - archiveClassifier.set('javadoc') - from dokkaJavadoc.outputDirectory -} - -artifacts { - archives androidSourcesJar - archives javadocJar -} - -group = PUBLISH_GROUP_ID -version = PUBLISH_VERSION - -afterEvaluate { - publishing { - publications { - release(MavenPublication) { - tasks.named("generateMetadataFileForReleasePublication").configure { dependsOn("androidSourcesJar") } - groupId PUBLISH_GROUP_ID - artifactId PUBLISH_ARTIFACT_ID - version PUBLISH_VERSION - if (project.plugins.findPlugin("com.android.library")) { - from components.release - } else { - from components.java - } - - artifact javadocJar - - pom { - name = PUBLISH_ARTIFACT_ID - description = 'Stream Chat official Android SDK' - url = 'https://github.com/getstream/stream-chat-android' - licenses { - license { - name = 'Stream License' - url = 'https://github.com/GetStream/stream-chat-android/blob/main/LICENSE' - } - } - developers { - developer { - id = 'tschellenbach' - name = 'Thierry Schellenbach' - email = 'thierry@getstream.io' - } - developer { - id = 'jcminarro' - name = 'Jc Miñarro' - email = 'josecarlos@getstream.io' - } - developer { - id = 'samiuelson' - name = 'Samuel Urbanowicz' - email = 'samuel@getstream.io' - } - developer { - id = 'adasiewiczr' - name = 'Rafal Adasiewicz' - email = 'rafal@getstream.io' - } - developer { - id = 'ogkuzmin' - name = 'Oleg Kuzmin' - email = 'oleg@getstream.io' - } - developer { - id = 'zsmb13' - name = 'Márton Braun' - email = 'marton@getstream.io' - } - developer { - id = 'leandroBorgesFerreira' - name = 'Leandro Borges Ferreira' - email = 'leandro@getstream.io' - } - developer { - id = 'bychkovdmitry' - name = 'Dmitrii Bychkov' - email = 'dmitrii@getstream.io' - } - } - scm { - connection = 'scm:git:github.com/getstream/stream-chat-android.git' - developerConnection = 'scm:git:ssh://github.com/getstream/stream-chat-android.git' - url = 'https://github.com/getstream/stream-chat-android/tree/main' - } - } - } - } - } -} - -signing { - useInMemoryPgpKeys( - rootProject.ext["signing.keyId"], - rootProject.ext["signing.key"], - rootProject.ext["signing.password"], - ) - sign publishing.publications -} diff --git a/scripts/publish-root.gradle b/scripts/publish-root.gradle deleted file mode 100644 index eb30e34f075..00000000000 --- a/scripts/publish-root.gradle +++ /dev/null @@ -1,71 +0,0 @@ -import io.getstream.chat.android.Configuration - -// Create variables with empty default values -ext["ossrhUsername"] = '' -ext["ossrhPassword"] = '' -ext["sonatypeStagingProfileId"] = '' -ext["signing.keyId"] = '' -ext["signing.password"] = '' -ext["signing.key"] = '' -ext["snapshot"] = '' - -File secretPropsFile = project.rootProject.file('local.properties') -if (secretPropsFile.exists()) { - // Read local.properties file first if it exists - Properties p = new Properties() - new FileInputStream(secretPropsFile).withCloseable { is -> p.load(is) } - p.each { name, value -> ext[name] = value } -} else { - // Use system environment variables - ext["ossrhUsername"] = System.getenv('OSSRH_USERNAME') - ext["ossrhPassword"] = System.getenv('OSSRH_PASSWORD') - ext["sonatypeStagingProfileId"] = System.getenv('SONATYPE_STAGING_PROFILE_ID') - ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID') - ext["signing.password"] = System.getenv('SIGNING_PASSWORD') - ext["signing.key"] = System.getenv('SIGNING_KEY') - ext["snapshot"] = System.getenv('SNAPSHOT') -} - -if (snapshot) { - ext["rootVersionName"] = Configuration.snapshotVersionName -} else { - ext["rootVersionName"] = Configuration.versionName -} - -// Set up Sonatype repository -nexusPublishing { - repositories { - sonatype { - nexusUrl = uri("https://ossrh-staging-api.central.sonatype.com/service/local/") - snapshotRepositoryUrl = uri("https://central.sonatype.com/repository/maven-snapshots/") - stagingProfileId = sonatypeStagingProfileId - username = ossrhUsername - password = ossrhPassword - version = rootVersionName - } - } -} - -tasks.withType(dokkaHtmlMultiModule.getClass()) { - includes.from("DokkaRoot.md") -} - -tasks.register("printAllArtifacts") { - group = "publishing" - - doLast { - subprojects.each { subproject -> - subproject.plugins.withId("maven-publish") { - def publishingExtension = subproject.extensions.findByType(PublishingExtension) - publishingExtension?.publications?.all { publication -> - if (publication instanceof MavenPublication) { - def groupId = publication.groupId - def artifactId = publication.artifactId - def version = publication.version - println("$groupId:$artifactId:$version") - } - } - } - } - } -} \ No newline at end of file diff --git a/stream-chat-android-ai-assistant/build.gradle.kts b/stream-chat-android-ai-assistant/build.gradle.kts index bfec7d74c77..560dca37818 100644 --- a/stream-chat-android-ai-assistant/build.gradle.kts +++ b/stream-chat-android-ai-assistant/build.gradle.kts @@ -1,3 +1,4 @@ +import com.vanniktech.maven.publish.AndroidSingleVariantLibrary import io.getstream.chat.android.Configuration import org.jetbrains.kotlin.gradle.tasks.KotlinCompile @@ -5,15 +6,9 @@ plugins { alias(libs.plugins.stream.android.library) alias(libs.plugins.kotlin.android) alias(libs.plugins.kotlin.compose) + alias(libs.plugins.maven.publish) } -rootProject.extra.apply { - set("PUBLISH_GROUP_ID", Configuration.artifactGroup) - set("PUBLISH_ARTIFACT_ID", "stream-chat-android-ai-assistant") - set("PUBLISH_VERSION", rootProject.extra.get("rootVersionName")) -} - -apply(from = "$rootDir/scripts/publish-module.gradle") apply(from = "$rootDir/scripts/detekt-compose.gradle") android { @@ -53,3 +48,18 @@ dependencies { detektPlugins(libs.detekt.formatting) } + +mavenPublishing { + coordinates( + groupId = Configuration.artifactGroup, + artifactId = "stream-chat-android-ai-assistant", + version = rootProject.version.toString(), + ) + configure( + AndroidSingleVariantLibrary( + variant = "release", + sourcesJar = true, + publishJavadocJar = true, + ), + ) +} diff --git a/stream-chat-android-client/build.gradle.kts b/stream-chat-android-client/build.gradle.kts index 1001e82abaa..d1126634434 100644 --- a/stream-chat-android-client/build.gradle.kts +++ b/stream-chat-android-client/build.gradle.kts @@ -1,3 +1,4 @@ +import com.vanniktech.maven.publish.AndroidSingleVariantLibrary import io.getstream.chat.android.Configuration import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.tasks.KotlinCompile @@ -8,16 +9,9 @@ plugins { alias(libs.plugins.ksp) alias(libs.plugins.android.junit5) alias(libs.plugins.androidx.baseline.profile) + alias(libs.plugins.maven.publish) } -rootProject.extra.apply { - set("PUBLISH_GROUP_ID", Configuration.artifactGroup) - set("PUBLISH_ARTIFACT_ID", "stream-chat-android-client") - set("PUBLISH_VERSION", rootProject.extra.get("rootVersionName")) -} - -apply(from = "$rootDir/scripts/publish-module.gradle") - android { namespace = "io.getstream.chat.android.client" defaultConfig { @@ -134,13 +128,17 @@ dependencies { baselineProfile(project(":stream-chat-android-benchmark")) } -/* Uncomment if the Dokka page per module is required -tasks.withType(dokkaHtmlPartial.getClass()) { - dokkaSourceSets { - named("main") { - moduleName.set("LLC") - includes.from("DokkaModule.md") - } - } +mavenPublishing { + coordinates( + groupId = Configuration.artifactGroup, + artifactId = "stream-chat-android-client", + version = rootProject.version.toString(), + ) + configure( + AndroidSingleVariantLibrary( + variant = "release", + sourcesJar = true, + publishJavadocJar = true, + ), + ) } -*/ diff --git a/stream-chat-android-compose/build.gradle.kts b/stream-chat-android-compose/build.gradle.kts index fcd028234f3..ad068d5922a 100644 --- a/stream-chat-android-compose/build.gradle.kts +++ b/stream-chat-android-compose/build.gradle.kts @@ -1,3 +1,4 @@ +import com.vanniktech.maven.publish.AndroidSingleVariantLibrary import io.getstream.chat.android.Configuration import org.jetbrains.kotlin.gradle.tasks.KotlinCompile @@ -9,15 +10,9 @@ plugins { alias(libs.plugins.android.junit5) alias(libs.plugins.androidx.baseline.profile) alias(libs.plugins.paparazzi) + alias(libs.plugins.maven.publish) } -rootProject.extra.apply { - set("PUBLISH_GROUP_ID", Configuration.artifactGroup) - set("PUBLISH_ARTIFACT_ID", "stream-chat-android-compose") - set("PUBLISH_VERSION", rootProject.extra.get("rootVersionName")) -} - -apply(from = "$rootDir/scripts/publish-module.gradle") apply(from = "$rootDir/scripts/detekt-compose.gradle") android { @@ -126,3 +121,18 @@ dependencies { baselineProfile(project(":stream-chat-android-benchmark")) } + +mavenPublishing { + coordinates( + groupId = Configuration.artifactGroup, + artifactId = "stream-chat-android-compose", + version = rootProject.version.toString(), + ) + configure( + AndroidSingleVariantLibrary( + variant = "release", + sourcesJar = true, + publishJavadocJar = true, + ), + ) +} diff --git a/stream-chat-android-core/build.gradle.kts b/stream-chat-android-core/build.gradle.kts index 9bcb94a4ac6..5004e2abacf 100644 --- a/stream-chat-android-core/build.gradle.kts +++ b/stream-chat-android-core/build.gradle.kts @@ -1,3 +1,5 @@ +import com.vanniktech.maven.publish.JavadocJar +import com.vanniktech.maven.publish.KotlinJvm import io.getstream.chat.android.Configuration import org.jetbrains.kotlin.gradle.tasks.KotlinCompile @@ -5,17 +7,8 @@ plugins { alias(libs.plugins.stream.java.library) id("java-test-fixtures") id("kotlin") -} - -rootProject.extra.apply { - set("PUBLISH_GROUP_ID", Configuration.artifactGroup) - set("PUBLISH_ARTIFACT_ID", "stream-chat-android-core") - set("PUBLISH_VERSION", rootProject.extra.get("rootVersionName")) -} - -apply(from = "$rootDir/scripts/publish-module.gradle") -java { - withSourcesJar() + alias(libs.plugins.maven.publish) + alias(libs.plugins.dokka) } tasks.withType() { @@ -57,3 +50,17 @@ dependencies { testRuntimeOnly(libs.junit.jupiter.engine) testRuntimeOnly(libs.junit.vintage.engine) } + +mavenPublishing { + coordinates( + groupId = Configuration.artifactGroup, + artifactId = "stream-chat-android-core", + version = rootProject.version.toString(), + ) + configure( + KotlinJvm( + javadocJar = JavadocJar.Dokka("dokkaJavadoc"), + sourcesJar = true, + ), + ) +} diff --git a/stream-chat-android-markdown-transformer/build.gradle.kts b/stream-chat-android-markdown-transformer/build.gradle.kts index 07f0aa36d28..a901bdc430b 100644 --- a/stream-chat-android-markdown-transformer/build.gradle.kts +++ b/stream-chat-android-markdown-transformer/build.gradle.kts @@ -1,3 +1,4 @@ +import com.vanniktech.maven.publish.AndroidSingleVariantLibrary import io.getstream.chat.android.Configuration import org.jetbrains.kotlin.gradle.tasks.KotlinCompile @@ -5,16 +6,9 @@ plugins { alias(libs.plugins.stream.android.library) alias(libs.plugins.kotlin.android) alias(libs.plugins.android.junit5) + alias(libs.plugins.maven.publish) } -rootProject.extra.apply { - set("PUBLISH_GROUP_ID", Configuration.artifactGroup) - set("PUBLISH_ARTIFACT_ID", "stream-chat-android-markdown-transformer") - set("PUBLISH_VERSION", rootProject.extra.get("rootVersionName")) -} - -apply(from = "$rootDir/scripts/publish-module.gradle") - android { namespace = "io.getstream.chat.android.ui.markdown" sourceSets { @@ -50,3 +44,18 @@ dependencies { detektPlugins(libs.detekt.formatting) } + +mavenPublishing { + coordinates( + groupId = Configuration.artifactGroup, + artifactId = "stream-chat-android-markdown-transformer", + version = rootProject.version.toString(), + ) + configure( + AndroidSingleVariantLibrary( + variant = "release", + sourcesJar = true, + publishJavadocJar = true, + ), + ) +} diff --git a/stream-chat-android-offline/build.gradle.kts b/stream-chat-android-offline/build.gradle.kts index 84503b4fd9a..181271dc5ee 100644 --- a/stream-chat-android-offline/build.gradle.kts +++ b/stream-chat-android-offline/build.gradle.kts @@ -1,5 +1,5 @@ +import com.vanniktech.maven.publish.AndroidSingleVariantLibrary import io.getstream.chat.android.Configuration -import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { @@ -8,16 +8,9 @@ plugins { alias(libs.plugins.ksp) alias(libs.plugins.android.junit5) alias(libs.plugins.androidx.baseline.profile) + alias(libs.plugins.maven.publish) } -rootProject.extra.apply { - set("PUBLISH_GROUP_ID", Configuration.artifactGroup) - set("PUBLISH_ARTIFACT_ID", "stream-chat-android-offline") - set("PUBLISH_VERSION", rootProject.extra.get("rootVersionName")) -} - -apply(from = "$rootDir/scripts/publish-module.gradle") - android { namespace = "io.getstream.chat.android.offline" defaultConfig { @@ -52,7 +45,6 @@ tasks.withType().configureEach { "-opt-in=io.getstream.chat.android.core.internal.InternalStreamChatApi", ), ) - jvmTarget.set(JvmTarget.JVM_11) } } @@ -123,3 +115,18 @@ dependencies { baselineProfile(project(":stream-chat-android-benchmark")) } + +mavenPublishing { + coordinates( + groupId = Configuration.artifactGroup, + artifactId = "stream-chat-android-offline", + version = rootProject.version.toString(), + ) + configure( + AndroidSingleVariantLibrary( + variant = "release", + sourcesJar = true, + publishJavadocJar = true, + ), + ) +} diff --git a/stream-chat-android-previewdata/build.gradle.kts b/stream-chat-android-previewdata/build.gradle.kts index 6ed6304cb5f..a5112023bc2 100644 --- a/stream-chat-android-previewdata/build.gradle.kts +++ b/stream-chat-android-previewdata/build.gradle.kts @@ -1,18 +1,12 @@ +import com.vanniktech.maven.publish.AndroidSingleVariantLibrary import io.getstream.chat.android.Configuration plugins { alias(libs.plugins.stream.android.library) alias(libs.plugins.kotlin.android) + alias(libs.plugins.maven.publish) } -rootProject.extra.apply { - set("PUBLISH_GROUP_ID", Configuration.artifactGroup) - set("PUBLISH_ARTIFACT_ID", "stream-chat-android-previewdata") - set("PUBLISH_VERSION", rootProject.extra.get("rootVersionName")) -} - -apply(from = "$rootDir/scripts/publish-module.gradle") - android { namespace = "io.getstream.chat.android.previewdata" resourcePrefix = "stream_compose_previewdata" @@ -35,3 +29,18 @@ dependencies { detektPlugins(libs.detekt.formatting) } + +mavenPublishing { + coordinates( + groupId = Configuration.artifactGroup, + artifactId = "stream-chat-android-previewdata", + version = rootProject.version.toString(), + ) + configure( + AndroidSingleVariantLibrary( + variant = "release", + sourcesJar = true, + publishJavadocJar = true, + ), + ) +} diff --git a/stream-chat-android-state/build.gradle.kts b/stream-chat-android-state/build.gradle.kts index 79e57b0d36e..26785d32c8f 100644 --- a/stream-chat-android-state/build.gradle.kts +++ b/stream-chat-android-state/build.gradle.kts @@ -1,3 +1,4 @@ +import com.vanniktech.maven.publish.AndroidSingleVariantLibrary import io.getstream.chat.android.Configuration import org.jetbrains.kotlin.gradle.tasks.KotlinCompile @@ -6,16 +7,9 @@ plugins { alias(libs.plugins.kotlin.android) alias(libs.plugins.android.junit5) alias(libs.plugins.androidx.baseline.profile) + alias(libs.plugins.maven.publish) } -rootProject.extra.apply { - set("PUBLISH_GROUP_ID", Configuration.artifactGroup) - set("PUBLISH_ARTIFACT_ID", "stream-chat-android-state") - set("PUBLISH_VERSION", rootProject.extra.get("rootVersionName")) -} - -apply(from = "$rootDir/scripts/publish-module.gradle") - android { namespace = "io.getstream.chat.android.state" defaultConfig { @@ -99,3 +93,18 @@ dependencies { baselineProfile(project(":stream-chat-android-benchmark")) } + +mavenPublishing { + coordinates( + groupId = Configuration.artifactGroup, + artifactId = "stream-chat-android-state", + version = rootProject.version.toString(), + ) + configure( + AndroidSingleVariantLibrary( + variant = "release", + sourcesJar = true, + publishJavadocJar = true, + ), + ) +} diff --git a/stream-chat-android-ui-common/build.gradle.kts b/stream-chat-android-ui-common/build.gradle.kts index 140f489b362..c42e6885f82 100644 --- a/stream-chat-android-ui-common/build.gradle.kts +++ b/stream-chat-android-ui-common/build.gradle.kts @@ -1,3 +1,4 @@ +import com.vanniktech.maven.publish.AndroidSingleVariantLibrary import io.getstream.chat.android.Configuration import org.jetbrains.kotlin.gradle.tasks.KotlinCompile @@ -7,16 +8,9 @@ plugins { alias(libs.plugins.kotlin.compose) alias(libs.plugins.android.junit5) alias(libs.plugins.androidx.baseline.profile) + alias(libs.plugins.maven.publish) } -rootProject.extra.apply { - set("PUBLISH_GROUP_ID", Configuration.artifactGroup) - set("PUBLISH_ARTIFACT_ID", "stream-chat-android-ui-common") - set("PUBLISH_VERSION", rootProject.extra.get("rootVersionName")) -} - -apply(from = "$rootDir/scripts/publish-module.gradle") - android { namespace = "io.getstream.chat.android.ui.common" defaultConfig { @@ -101,3 +95,18 @@ dependencies { baselineProfile(project(":stream-chat-android-benchmark")) } + +mavenPublishing { + coordinates( + groupId = Configuration.artifactGroup, + artifactId = "stream-chat-android-ui-common", + version = rootProject.version.toString(), + ) + configure( + AndroidSingleVariantLibrary( + variant = "release", + sourcesJar = true, + publishJavadocJar = true, + ), + ) +} diff --git a/stream-chat-android-ui-components/build.gradle.kts b/stream-chat-android-ui-components/build.gradle.kts index 88c9d93b5e1..bdb91bd100a 100644 --- a/stream-chat-android-ui-components/build.gradle.kts +++ b/stream-chat-android-ui-components/build.gradle.kts @@ -1,3 +1,4 @@ +import com.vanniktech.maven.publish.AndroidSingleVariantLibrary import io.getstream.chat.android.Configuration import org.jetbrains.kotlin.gradle.tasks.KotlinCompile @@ -8,16 +9,9 @@ plugins { alias(libs.plugins.android.junit5) alias(libs.plugins.androidx.baseline.profile) alias(libs.plugins.paparazzi) + alias(libs.plugins.maven.publish) } -rootProject.extra.apply { - set("PUBLISH_GROUP_ID", Configuration.artifactGroup) - set("PUBLISH_ARTIFACT_ID", "stream-chat-android-ui-components") - set("PUBLISH_VERSION", rootProject.extra.get("rootVersionName")) -} - -apply(from = "$rootDir/scripts/publish-module.gradle") - android { namespace = "io.getstream.chat.android.ui" defaultConfig { @@ -99,3 +93,18 @@ dependencies { baselineProfile(project(":stream-chat-android-benchmark")) } + +mavenPublishing { + coordinates( + groupId = Configuration.artifactGroup, + artifactId = "stream-chat-android-ui-components", + version = rootProject.version.toString(), + ) + configure( + AndroidSingleVariantLibrary( + variant = "release", + sourcesJar = true, + publishJavadocJar = true, + ), + ) +} diff --git a/stream-chat-android-ui-utils/build.gradle.kts b/stream-chat-android-ui-utils/build.gradle.kts index 4fd1b64b781..bcfbdc28f5f 100644 --- a/stream-chat-android-ui-utils/build.gradle.kts +++ b/stream-chat-android-ui-utils/build.gradle.kts @@ -1,3 +1,4 @@ +import com.vanniktech.maven.publish.AndroidSingleVariantLibrary import io.getstream.chat.android.Configuration import org.jetbrains.kotlin.gradle.tasks.KotlinCompile @@ -5,16 +6,9 @@ plugins { alias(libs.plugins.stream.android.library) alias(libs.plugins.kotlin.android) alias(libs.plugins.android.junit5) + alias(libs.plugins.maven.publish) } -rootProject.extra.apply { - set("PUBLISH_GROUP_ID", Configuration.artifactGroup) - set("PUBLISH_ARTIFACT_ID", "stream-chat-android-ui-utils") - set("PUBLISH_VERSION", rootProject.extra.get("rootVersionName")) -} - -apply(from = "$rootDir/scripts/publish-module.gradle") - android { namespace = "io.getstream.chat.android.ui.utils" defaultConfig { @@ -64,3 +58,18 @@ dependencies { detektPlugins(libs.detekt.formatting) } + +mavenPublishing { + coordinates( + groupId = Configuration.artifactGroup, + artifactId = "stream-chat-android-ui-utils", + version = rootProject.version.toString(), + ) + configure( + AndroidSingleVariantLibrary( + variant = "release", + sourcesJar = true, + publishJavadocJar = true, + ), + ) +}