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,73 @@ 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+
114+ pom {
115+ name.set(" Stream Android Core" )
116+ description.set(" Stream Core official Android SDK" )
117+ url.set(" https://github.com/getstream/stream-core-android" )
118+
119+ licenses {
120+ license {
121+ name.set(" Stream License" )
122+ url.set(" https://github.com/GetStream/stream-core-android/blob/main/LICENSE" )
123+ }
124+ }
125+
126+ developers {
127+ developer {
128+ id = " aleksandar-apostolov"
129+ name = " Aleksandar Apostolov"
130+ 131+ }
132+ developer {
133+ id = " VelikovPetar"
134+ name = " Petar Velikov"
135+ 136+ }
137+ developer {
138+ id = " andremion"
139+ name = " André Mion"
140+ 141+ }
142+ developer {
143+ id = " rahul-lohra"
144+ name = " Rahul Kumar Lohra"
145+ 146+ }
147+ developer {
148+ id = " gpunto"
149+ name = " Gianmarco David"
150+ 151+ }
152+ }
153+
154+ scm {
155+ connection.set(" scm:git:github.com/getstream/stream-core-android.git" )
156+ developerConnection.set(" scm:git:ssh://github.com/getstream/stream-core-android.git" )
157+ url.set(" https://github.com/getstream/stream-core-android/tree/main" )
158+ }
159+ }
160+ }
161+ }
162+ }
163+
164+ tasks.register(" printAllArtifacts" ) {
165+ group = " publishing"
166+ description = " Prints all artifacts that will be published"
167+
168+ doLast {
169+ subprojects.forEach { subproject ->
170+ subproject.plugins.withId(" com.vanniktech.maven.publish" ) {
171+ subproject.extensions.findByType(PublishingExtension ::class .java)
172+ ?.publications
173+ ?.filterIsInstance<MavenPublication >()
174+ ?.forEach { println (" ${it.groupId} :${it.artifactId} :${it.version} " ) }
175+ }
176+ }
177+ }
178+ }
0 commit comments