123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- apply plugin: 'maven-publish'
- apply plugin: 'signing'
- def PUBLISH_VERSION = '1.9.1-SNAPSHOT'
- def PUBLISH_GROUP_ID = 'com.compdf'
- def PUBLISH_ARTIFACT_ID = 'compdfkit-ui'
- ext["signing.keyId"] = ''
- ext["signing.password"] = ''
- ext["signing.secretKeyRingFile"] = ''
- ext["ossrhUsername"] = ''
- ext["ossrhPassword"] = ''
- task sourceJar(type: Jar) {
- from android.sourceSets.main.java.srcDirs
- classifier "source"
- }
- File secretPropsFile = project.rootProject.file('local.properties')
- if (secretPropsFile.exists()) {
- println "Found secret props file, loading props"
- Properties p = new Properties()
- p.load(new FileInputStream(secretPropsFile))
- p.each { name, value ->
- ext[name] = value
- }
- } else {
- println "No props file, loading env vars"
- }
- afterEvaluate {
- publishing {
- publications {
- release(MavenPublication) {
- println("publish-maven Log-------> PUBLISH_GROUP_ID: $PUBLISH_GROUP_ID; PUBLISH_ARTIFACT_ID: $PUBLISH_ARTIFACT_ID; PUBLISH_VERSION: $PUBLISH_VERSION")
- groupId PUBLISH_GROUP_ID
- artifactId PUBLISH_ARTIFACT_ID
- version = PUBLISH_VERSION
- artifact("$buildDir/outputs/aar/ComPDFKit-UI.aar")
- pom {
- name = PUBLISH_ARTIFACT_ID
- url = 'https://www.compdf.com/'
- developers {
- developer {
- id = 'compdfkit'
- name = 'compdfkit'
- email = 'youna@compdf.com'
- }
- }
- withXml{
- def dependenciesNode = asNode().appendNode('dependencies')
-
- configurations.implementation.allDependencies.each {
- if(it.group != null && (it.name != null || "unspecified".equals(it.name)) && it.version != null)
- {
- def dependencyNode = dependenciesNode.appendNode('dependency')
- dependencyNode.appendNode('groupId', it.group)
- dependencyNode.appendNode('artifactId', it.name)
- dependencyNode.appendNode('version', it.version)
- }
- }
- }
- }
- }
- }
- repositories {
- maven {
- name = PUBLISH_ARTIFACT_ID
- def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
- def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
- println("publish version:${PUBLISH_VERSION}")
- url = PUBLISH_VERSION.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
- credentials {
- username ossrhUsername
- password ossrhPassword
- }
- }
- }
- }
- }
- signing {
- sign publishing.publications
- }
|