11plugins {
22 alias(libs. plugins. android. library)
33 alias(libs. plugins. androidx. room)
4- id " maven-publish"
4+ alias(libs. plugins. maven. publish)
5+ // id("io.syslogic.gpr.maintenance")
56}
67
78group = " io.syslogic"
89version = libs. versions. app. version. name. get()
910
1011base {
11- String versionName = libs. versions. app. version. name. get()
12- archivesName = " androidx_github_$versionName "
12+ archivesName = " androidx-github-api"
1313}
1414
1515android {
@@ -51,13 +51,6 @@ android {
5151 }
5252 }
5353
54- publishing {
55- singleVariant(" release" ) {
56- withSourcesJar()
57- withJavadocJar()
58- }
59- }
60-
6154 lint {
6255 lintConfig = project. file(" lint.xml" )
6356 checkAllWarnings = true
@@ -75,44 +68,47 @@ dependencies {
7568 // Annotations
7669 implementation(libs. androidx. annotation)
7770
78- // App Compat
71+ // AppCompat
7972 implementation(libs. androidx. appcompat)
8073
8174 // Data-Binding Runtime
8275 implementation(libs. androidx. databinding)
8376
84- // Room Runtime
77+ // Room
8578 annotationProcessor(libs. androidx. room. compiler)
86- testAnnotationProcessor (libs. androidx. room. compiler)
79+ androidTestAnnotationProcessor (libs. androidx. room. compiler)
8780 testImplementation(libs. androidx. room. testing)
8881 api(libs. androidx. room. runtime)
8982 api(libs. androidx. room. paging)
9083
9184 // Retrofit2
9285 implementation(libs. gson)
93- implementation(libs. retrofit)
94- implementation(libs. retrofit. gson. converter) {
86+ implementation(libs. bundles. retrofit) {
9587 exclude(group : " com.google.code.gson" , module : " gson" )
9688 }
9789
9890 testImplementation(libs. junit)
9991 androidTestImplementation(libs. androidx. test. junit)
10092}
10193
94+ // Gradle 9.0 deprecation fix
95+ Configuration implCls = configurations. create(" implCls" , {
96+ extendsFrom(configurations. implementation)
97+ canBeResolved = true
98+ })
10299
103-
104- tasks. register(' javadoc' , Javadoc ) {
100+ tasks. register(" javadoc" , Javadoc ) {
105101
106102 title = " GitHub API Client ${ android.defaultConfig.versionName} "
107103 source = android. sourceSets. main. java. srcDirs
108104 destinationDir = project. file(" build/outputs/javadoc" )
109- configurations. implementation. setCanBeResolved(true )
110105
111106 classpath = files(new File (" ${ android.sdkDirectory} /platforms/${ android.compileSdkVersion} /android.jar" ))
112107 android. getBootClasspath(). forEach{ classpath + = fileTree(it) }
113108 classpath + = fileTree(dir : project. file(" build/tmp/aarsToJars/" ). absolutePath)
114- classpath + = configurations . implementation
109+ classpath + = implCls
115110 exclude(" **/BuildConfig.java" , " **/R.java" , " **/*.kt" )
111+ exclude(" androidx.sqlite.db.SupportSQLiteDatabase" )
116112 failOnError = false
117113
118114 // options.verbose()
@@ -130,13 +126,13 @@ tasks.register('javadoc', Javadoc) {
130126 doFirst {
131127
132128 // extract AAR files
133- configurations. implementation
134- .filter { it. name. endsWith(' .aar' ) }
129+ configurations. implCls
130+ .filter { it. name. endsWith(" .aar" ) }
135131 .each { aar ->
136132 copy {
137133 from zipTree(aar)
138134 include " **/classes.jar"
139- into project. file(" build/tmp/aarsToJars/${ aar.name.replace(' .aar', '' )} /" )
135+ into project. file(" build/tmp/aarsToJars/${ aar.name.replace(" .aar", "" )} /" )
140136 }
141137 }
142138
@@ -174,23 +170,47 @@ artifacts {
174170
175171afterEvaluate {
176172 publishing {
173+
174+ repositories {
175+ maven {
176+ name = " GitHubPackages"
177+ url = uri(" https://maven.pkg.github.com/${ project.ext.get("github_handle")} /${ project.ext.get("artifact_id")} " )
178+ if (System . getenv(" GITHUB_ACTOR" ) != null && System . getenv(" GITHUB_ACTOR" ) != null ) {
179+ credentials {
180+ username = System . getenv(" GITHUB_ACTOR" )
181+ password = System . getenv(" GITHUB_TOKEN" )
182+ }
183+ }
184+ }
185+ }
186+
177187 publications {
178- release(MavenPublication ) {
179- groupId = group
180- artifactId = ' androidx-github'
188+ Default (MavenPublication ) {
189+ from(components. getByName(" release" ))
190+ groupId = " ${ project.ext.get("group_id")} "
191+ artifactId = " ${ project.ext.get("artifact_id")} "
181192 version = libs. versions. app. version. name. get()
182- from components. getByName(' release' )
183193 pom {
184- name = ' GitHub API Client '
185- description = ' A simple client library for Android '
186- url = " https://github.com/syslogic /${ artifactId } "
194+ name = " ${ project.ext.get("plugin_name") } "
195+ description = " ${ project.ext.get("plugin_desc") } "
196+ url = " https://github.com/${ project.ext.get("github_handle") } /${ project.ext.get("artifact_id") } "
187197 scm {
188- connection = " scm:git:git://github.com/syslogic /${ artifactId } .git"
189- developerConnection = " scm:git:ssh://github.com/syslogic /${ artifactId } .git"
190- url = " https://github.com/syslogic /${ artifactId } /"
198+ connection = " scm:git:git://github.com/${ project.ext.get("github_handle") } /${ project.ext.get("artifact_id") } .git"
199+ developerConnection = " scm:git:ssh://github.com/${ project.ext.get("github_handle") } /${ project.ext.get("artifact_id") } .git"
200+ url = " https://github.com/${ project.ext.get("github_handle") } /${ project.ext.get("artifact_id") } /"
191201 }
192202 }
193203 }
194204 }
195205 }
196206}
207+
208+ /* * GitHub Package Registry */
209+ if (pluginManager. hasPlugin(" io.syslogic.gpr.maintenance" )) {
210+ gpr {
211+ groupId = project. ext. get(" group_id" ) // group
212+ packageName = project. ext. get(" artifact_id" ) // repo
213+ listPackagesAfterPublish = true
214+ deleteLastVersion = true
215+ }
216+ }
0 commit comments