11import com.android.build.api.dsl.ApplicationExtension
22import com.android.build.api.dsl.LibraryExtension
3+ import com.vanniktech.maven.publish.MavenPublishBaseExtension
4+ import io.getstream.core.Configuration
35import java.io.FileNotFoundException
46import java.util.Calendar
57
6- apply (plugin = " io.github.gradle-nexus.publish-plugin" )
7- apply (plugin = " org.jetbrains.dokka" )
8-
98apply (from = " ${rootDir} /gradle/scripts/sonar.gradle" )
109// Top-level build file where you can add configuration options common to all sub-projects/modules.
1110plugins {
@@ -18,8 +17,8 @@ plugins {
1817 alias(libs.plugins.android.library) apply false
1918 alias(libs.plugins.kotlin.compose) apply false
2019 alias(libs.plugins.ksp) apply false
20+ alias(libs.plugins.maven.publish)
2121 alias(libs.plugins.dokka) apply false
22- alias(libs.plugins.nexus) apply false
2322 alias(libs.plugins.arturbosch.detekt) apply true
2423 alias(libs.plugins.spotless) apply true
2524 alias(libs.plugins.sonarqube) apply true
@@ -43,6 +42,9 @@ detekt {
4342 buildUponDefaultConfig = true
4443}
4544
45+ private val isSnapshot = System .getenv(" SNAPSHOT" )?.toBoolean() == true
46+ version = if (isSnapshot) Configuration .snapshotVersionName else Configuration .versionName
47+
4648subprojects {
4749 // Configure Android projects with common SDK versions as soon as either plugin is applied
4850 pluginManager.withPlugin(" com.android.library" ) {
@@ -104,4 +106,74 @@ subprojects {
104106 }
105107}
106108
107- apply (from = " ${rootDir} /scripts/publish-root.gradle" )
109+ subprojects {
110+ plugins.withId(" com.vanniktech.maven.publish" ) {
111+ extensions.configure<MavenPublishBaseExtension > {
112+ publishToMavenCentral(automaticRelease = true )
113+ signAllPublications()
114+
115+ pom {
116+ name.set(" Stream Android Core" )
117+ description.set(" Stream Core official Android SDK" )
118+ url.set(" https://github.com/getstream/stream-core-android" )
119+
120+ licenses {
121+ license {
122+ name.set(" Stream License" )
123+ url.set(" https://github.com/GetStream/stream-core-android/blob/main/LICENSE" )
124+ }
125+ }
126+
127+ developers {
128+ developer {
129+ id = " aleksandar-apostolov"
130+ name = " Aleksandar Apostolov"
131+ 132+ }
133+ developer {
134+ id = " VelikovPetar"
135+ name = " Petar Velikov"
136+ 137+ }
138+ developer {
139+ id = " andremion"
140+ name = " André Mion"
141+ 142+ }
143+ developer {
144+ id = " rahul-lohra"
145+ name = " Rahul Kumar Lohra"
146+ 147+ }
148+ developer {
149+ id = " gpunto"
150+ name = " Gianmarco David"
151+ 152+ }
153+ }
154+
155+ scm {
156+ connection.set(" scm:git:github.com/getstream/stream-core-android.git" )
157+ developerConnection.set(" scm:git:ssh://github.com/getstream/stream-core-android.git" )
158+ url.set(" https://github.com/getstream/stream-core-android/tree/main" )
159+ }
160+ }
161+ }
162+ }
163+ }
164+
165+ tasks.register(" printAllArtifacts" ) {
166+ group = " publishing"
167+ description = " Prints all artifacts that will be published"
168+
169+ doLast {
170+ subprojects.forEach { subproject ->
171+ subproject.plugins.withId(" com.vanniktech.maven.publish" ) {
172+ subproject.extensions.findByType(PublishingExtension ::class .java)
173+ ?.publications
174+ ?.filterIsInstance<MavenPublication >()
175+ ?.forEach { println (" ${it.groupId} :${it.artifactId} :${it.version} " ) }
176+ }
177+ }
178+ }
179+ }
0 commit comments