-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathgradle-mavenizer.gradle
72 lines (63 loc) · 2.54 KB
/
gradle-mavenizer.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
apply plugin: 'maven-publish'
apply plugin: 'signing'
def gradlePluginVersion = project.hasProperty('mavPluginVersion') ? project.mavPluginVersion : 'master'
apply from: "https://raw.githubusercontent.com/sky-uk/gradle-maven-plugin/${gradlePluginVersion}/utils.gradle"
apply from: "https://raw.githubusercontent.com/sky-uk/gradle-maven-plugin/${gradlePluginVersion}/artifact-javadoc-handler.gradle"
apply from: "https://raw.githubusercontent.com/sky-uk/gradle-maven-plugin/${gradlePluginVersion}/artifact-pom-manager.gradle"
File secretPropsFile = project.rootProject.file('local.properties')
if (secretPropsFile.exists()) {
Properties p = new Properties()
p.load(new FileInputStream(secretPropsFile))
p.each { name, value ->
project.ext[name] = value
}
} else {
project.ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID')
project.ext["signing.password"] = System.getenv('SIGNING_PASSWORD')
project.ext["signing.secretKeyRingFile"] = System.getenv('SIGNING_SECRET_KEY_RING_FILE')
}
project.afterEvaluate {
publishing {
publications {
mavenPublish(MavenPublication) {
if (project.plugins.findPlugin("com.android.library")) {
artifact bundleReleaseAar
artifact androidJavadocsJar
artifact androidSourcesJar
} else {
artifact jar
artifact sourcesJar
artifact javadocJar
}
decoratePom(pom)
}
}
repositories {
def isToRemoteRepo = getBooleanProperty("mavPublishToRemoteRepo")
def isToInternalRepo = getBooleanProperty("mavPublishToInternalRepo")
def isToMavenLocal = getBooleanProperty("mavPublishToMavenLocal")
if (isToRemoteRepo) {
maven {
credentials {
username getStringProperty("mavRemoteRepoUser")
password getStringProperty("mavRemoteRepoPassword")
}
url = getStringProperty("mavRepoRemoteUrl")
}
}
if (isToInternalRepo) {
maven {
url = getStringProperty("mavRepoInternalUrl")
}
}
if (isToMavenLocal || (!isToInternalRepo && !isToRemoteRepo)) {
mavenLocal()
}
}
}
if (getBooleanProperty("mavSigning")) {
signing {
sign publishing.publications
}
}
}