-
Notifications
You must be signed in to change notification settings - Fork 12
/
publish-module.gradle
132 lines (122 loc) · 5.5 KB
/
publish-module.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
130
131
132
apply plugin: "maven-publish"
apply plugin: "signing"
apply plugin: "org.jetbrains.dokka"
apply from: "${rootDir}/gradle/scripts/publish-base.gradle"
tasks.register('androidSourcesJar', Jar) {
archiveClassifier.set('sources')
if (project.plugins.findPlugin("com.android.library")) {
from android.sourceSets.main.java.srcDirs
} else {
from sourceSets.main.java.srcDirs
}
}
tasks.register('javadocJar', Jar) {
dependsOn dokkaJavadoc
archiveClassifier.set('javadoc')
from dokkaJavadoc.outputDirectory
}
artifacts {
archives androidSourcesJar
archives javadocJar
}
// Unlike the publishing for the fingerprinting modules,
// afterEvaluate is necessary as we need the bundleReleaseAar artifact.
project.afterEvaluate {
publishing {
publications {
release(MavenPublication) {
groupId airwallexGroupId
artifactId airwallexArtifactId
version rootProject.version
artifact androidSourcesJar
artifact javadocJar
artifact bundleReleaseAar
pom {
name = airwallexName
description = airwallexDescription
url = airwallexUrl
licenses {
license {
name = airwallexLicenseName
url = airwallexLicenseUrl
}
}
organization {
name = airwallexOrganizationName
url = airwallexOrganizationUrl
}
developers {
developer {
organization = airwallexOrganizationName
organizationUrl = airwallexOrganizationUrl
}
}
scm {
connection = airwallexScmConnection
developerConnection = airwallexScmConnection
url = airwallexScmUrl
}
}
pom.withXml {
def dependenciesNode = asNode().appendNode('dependencies')
configurations.api.dependencies.each {
if (it.name != 'unspecified') {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group != rootProject.name ? it.group : airwallexGroupId)
if (it.group == rootProject.name) {
switch (it.name) {
case 'airwallex':
dependencyNode.appendNode('artifactId', 'payment')
break
case 'card':
dependencyNode.appendNode('artifactId', 'payment-card')
break
case 'wechat':
dependencyNode.appendNode('artifactId', 'payment-wechat')
break
case 'redirect':
dependencyNode.appendNode('artifactId', 'payment-redirect')
break
case 'googlepay':
dependencyNode.appendNode('artifactId', 'payment-googlepay')
break
case 'ui-core':
dependencyNode.appendNode('artifactId', "payment-ui-core")
break
case 'components-core':
dependencyNode.appendNode('artifactId', 'payment-components-core')
break
case 'security-3ds':
dependencyNode.appendNode('artifactId', 'payment-3ds')
break
default:
break
}
} else {
dependencyNode.appendNode('artifactId', it.name)
}
dependencyNode.appendNode('version', it.version != 'unspecified' ? it.version : rootProject.version)
dependencyNode.appendNode('scope', 'compile')
}
}
configurations.implementation.dependencies.each {
if (it.name != 'unspecified') {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
dependencyNode.appendNode('scope', 'compile')
}
}
}
}
}
}
signing {
useInMemoryPgpKeys(
rootProject.ext["signing.key"],
rootProject.ext["signing.password"]
)
sign publishing.publications
}
}