Skip to content

Commit

Permalink
Fix gradle publish config to match Google docs. (#279)
Browse files Browse the repository at this point in the history
  • Loading branch information
sshropshire authored Oct 29, 2024
1 parent a0c65d0 commit 1e2e3c2
Showing 1 changed file with 37 additions and 41 deletions.
78 changes: 37 additions & 41 deletions gradle/gradle-publish.gradle
Original file line number Diff line number Diff line change
@@ -1,61 +1,57 @@
apply plugin: 'maven-publish'
apply plugin: 'signing'


ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID') ?: ''
ext["signing.password"] = System.getenv('SIGNING_KEY_PASSWORD') ?: ''
ext["signing.secretKeyRingFile"] = System.getenv('SIGNING_KEY_FILE') ?: ''

afterEvaluate {
android {
publishing {
publications {
release(MavenPublication) {
groupId group
version project.ext.version
artifactId project.ext.name
singleVariant('release') {
withSourcesJar()
}
}
}

publishing {
publications {
release(MavenPublication) {
groupId group
version project.ext.version
artifactId project.ext.name

afterEvaluate {
from components.release
artifact androidSourcesJar //TODO: add javadocs
}

pom {
name = project.ext.pom_name ?: ''
packaging = POM_PACKAGING
description = project.ext.pom_desc ?: ''
url = POM_URL
licenses {
license {
name = POM_LICENCE_NAME
url = POM_LICENCE_URL
}
pom {
name = project.ext.pom_name ?: ''
packaging = POM_PACKAGING
description = project.ext.pom_desc ?: ''
url = POM_URL
licenses {
license {
name = POM_LICENCE_NAME
url = POM_LICENCE_URL
}
developers {
developer {
id = POM_DEVELOPER_ID
name = POM_DEVELOPER_NAME
email = POM_DEVELOPER_EMAIL
}
}
scm {
connection = POM_SCM_CONNECTION
developerConnection = POM_SCM_DEV_CONNECTION
url = POM_SCM_URL
}
developers {
developer {
id = POM_DEVELOPER_ID
name = POM_DEVELOPER_NAME
email = POM_DEVELOPER_EMAIL
}
}
scm {
connection = POM_SCM_CONNECTION
developerConnection = POM_SCM_DEV_CONNECTION
url = POM_SCM_URL
}
}
}
}

signing {
sign publishing.publications
sign configurations.archives
sign publishing.publications.release
}
}

task androidSourcesJar(type: Jar) {
archiveClassifier.set('sources')
from android.sourceSets.main.java.srcDirs
from android.sourceSets.main.kotlin.srcDirs
}

artifacts {
archives androidSourcesJar
}

0 comments on commit 1e2e3c2

Please sign in to comment.