-
Notifications
You must be signed in to change notification settings - Fork 2
/
publish-mavencentral.gradle
129 lines (114 loc) · 4.56 KB
/
publish-mavencentral.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
task androidSourcesJar(type: Jar) {
archiveClassifier.set('sources')
if (project.plugins.findPlugin("com.android.library")) {
// For Android libraries
from android.sourceSets.main.java.srcDirs
from android.sourceSets.main.kotlin.srcDirs
} else {
// For pure Kotlin libraries, in case you have them
from sourceSets.main.java.srcDirs
from sourceSets.main.kotlin.srcDirs
}
}
tasks.withType(dokkaHtmlPartial.getClass()).configureEach {
pluginsMapConfiguration.set(
["org.jetbrains.dokka.base.DokkaBase": """{ "separateInheritedMembers": true}"""]
)
}
task javadocJar(type: Jar, dependsOn: dokkaJavadoc) {
archiveClassifier.set('javadoc')
from dokkaJavadoc.outputDirectory
}
artifacts {
archives androidSourcesJar
archives javadocJar
}
group = PUBLISH_GROUP_ID
version = PUBLISH_VERSION
File secretPropsFile = project.rootProject.file('local.properties')
if (secretPropsFile.exists()) {
Properties p = new Properties()
new FileInputStream(secretPropsFile).withCloseable { is ->
p.load(is)
}
p.each { name, value ->
ext[name] = value
}
} else {
ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID')
ext["signing.password"] = System.getenv('SIGNING_PASSWORD')
ext["signing.secretKeyRingFile"] = System.getenv('SIGNING_SECRET_KEY_RING_FILE')
ext["ossrhUsername"] = System.getenv('OSSRH_USERNAME')
ext["ossrhPassword"] = System.getenv('OSSRH_PASSWORD')
ext["sonatypeStagingProfileId"] = System.getenv('SONATYPE_STAGING_PROFILE_ID')
}
publishing {
publications {
release(MavenPublication) {
groupId PUBLISH_GROUP_ID
version PUBLISH_VERSION
if (project.plugins.findPlugin("com.android.library")) {
File aar = project.rootProject.file("$buildDir/outputs/aar/${aarName}.aar")
if(aar.exists()) {
artifactId PUBLISH_ARTIFACT_ID
artifact("$buildDir/outputs/aar/${aarName}.aar")
}
else {
artifactId STAGING_PUBLISH_ARTIFACT_ID
artifact("$buildDir/outputs/aar/$aarName-stg.aar")
}
} else {
throw new GradleException('Not a library - error occurred')
}
artifact androidSourcesJar
artifact javadocJar
pom {
name = PUBLISH_ARTIFACT_ID
description = 'SingpassWebViewClient is an extension of androidx.webViewClientCompat that handles opening of Singpass app upon clicking on a supported url.'
url = 'https://github.com/singpass/Singpass-app-webview-client'
licenses {
license {
name = 'License'
url = 'https://github.com/singpass/Singpass-app-webview-client/blob/main/LICENSE.txt'
}
}
developers {
developer {
id = 'kenneth-leong-gt'
name = 'Kenneth leong'
email = '[email protected]'
}
}
scm {
connection = 'scm:git:github.com/singpass/Singpass-app-webview-client.git'
developerConnection = 'scm:git:ssh://github.com/singpass/Singpass-app-webview-client.git'
url = 'https://github.com/singpass/Singpass-app-webview-client'
}
withXml {
def dependenciesNode = asNode().appendNode('dependencies')
project.configurations.implementation.allDependencies.each {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}
}
}
}
repositories {
maven {
name = "sonatype"
def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username ossrhUsername
password ossrhPassword
}
}
}
}
signing {
sign publishing.publications
}