1+ import com.vanniktech.maven.publish.AndroidSingleVariantLibrary
2+ import com.vanniktech.maven.publish.MavenPublishBaseExtension
3+ import io.getstream.feeds.android.Configuration
14import java.io.FileNotFoundException
25import java.util.Calendar
36
4- apply (plugin = " io.github.gradle-nexus.publish-plugin" )
5- apply (plugin = " org.jetbrains.dokka" )
6-
77apply (from = " ${rootDir} /gradle/scripts/sonar.gradle" )
88
99// Top-level build file where you can add configuration options common to all sub-projects/modules.
@@ -18,8 +18,7 @@ plugins {
1818 alias(libs.plugins.arturbosch.detekt) apply true
1919 alias(libs.plugins.spotless) apply true
2020 id(" com.google.gms.google-services" ) version " 4.4.3" apply false
21- alias(libs.plugins.dokka) apply false
22- alias(libs.plugins.nexus) apply false
21+ alias(libs.plugins.maven.publish)
2322 alias(libs.plugins.sonarqube)
2423 alias(libs.plugins.kover)
2524}
@@ -64,8 +63,10 @@ subprojects {
6463 // Update detekt.yml
6564
6665 if (detektFile.exists()) {
67- val pattern = Regex (""" licenseTemplateFile:\s*['"]\.\./license/generated/license-\d{4}\.txt['"]""" )
68- val replacement = """ licenseTemplateFile: '../license/generated/license-$currentYear .txt'"""
66+ val pattern =
67+ Regex (""" licenseTemplateFile:\s*['"]\.\./license/generated/license-\d{4}\.txt['"]""" )
68+ val replacement =
69+ """ licenseTemplateFile: '../license/generated/license-$currentYear .txt'"""
6970 val detektContent = detektFile.readText().replace(pattern, replacement)
7071 detektFile.writeText(detektContent)
7172
@@ -80,4 +81,85 @@ subprojects {
8081 }
8182}
8283
83- apply (from = " ${rootDir} /scripts/publish-root.gradle" )
84+ private val isSnapshot = System .getenv(" SNAPSHOT" )?.toBoolean() == true
85+ version = if (isSnapshot) Configuration .snapshotVersionName else Configuration .versionName
86+
87+
88+ subprojects {
89+ plugins.withId(" com.vanniktech.maven.publish" ) {
90+ extensions.configure<MavenPublishBaseExtension > {
91+ publishToMavenCentral(automaticRelease = true )
92+
93+ configure(
94+ AndroidSingleVariantLibrary (
95+ variant = " release" ,
96+ sourcesJar = true ,
97+ publishJavadocJar = true ,
98+ )
99+ )
100+
101+ pom {
102+ name.set(" stream-feeds-android-client" )
103+ description.set(" Stream Feeds official Android SDK" )
104+ url.set(" https://github.com/getstream/stream-feeds-android" )
105+
106+ licenses {
107+ license {
108+ name.set(" Stream License" )
109+ url.set(" https://github.com/GetStream/stream-feeds-android/blob/main/LICENSE" )
110+ }
111+ }
112+
113+ developers {
114+ developer {
115+ id = " aleksandar-apostolov"
116+ name = " Aleksandar Apostolov"
117+ 118+ }
119+ developer {
120+ id = " VelikovPetar"
121+ name = " Petar Velikov"
122+ 123+ }
124+ developer {
125+ id = " andremion"
126+ name = " André Mion"
127+ 128+ }
129+ developer {
130+ id = " rahul-lohra"
131+ name = " Rahul Kumar Lohra"
132+ 133+ }
134+ developer {
135+ id = " gpunto"
136+ name = " Gianmarco David"
137+ 138+ }
139+ }
140+
141+ scm {
142+ connection.set(" scm:git:github.com/getstream/stream-feeds-android.git" )
143+ developerConnection.set(" scm:git:ssh://github.com/getstream/stream-feeds-android.git" )
144+ url.set(" https://github.com/getstream/stream-feeds-android/tree/main" )
145+ }
146+ }
147+ }
148+ }
149+ }
150+
151+ tasks.register(" printAllArtifacts" ) {
152+ group = " publishing"
153+ description = " Prints all artifacts that will be published"
154+
155+ doLast {
156+ subprojects.forEach { subproject ->
157+ subproject.plugins.withId(" com.vanniktech.maven.publish" ) {
158+ subproject.extensions.findByType(PublishingExtension ::class .java)
159+ ?.publications
160+ ?.filterIsInstance<MavenPublication >()
161+ ?.forEach { println (" ${it.groupId} :${it.artifactId} :${it.version} " ) }
162+ }
163+ }
164+ }
165+ }
0 commit comments