-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild_publishing.gradle
143 lines (129 loc) · 3.53 KB
/
build_publishing.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
133
134
135
136
137
138
139
140
141
142
143
apply plugin: "maven-publish"
apply plugin: "signing"
def mavenCentralUsername =
project.findProperty('mavenCentralUsername') ?: ''
def mavenCentralPassword =
project.findProperty('mavenCentralPassword') ?: ''
def publishDirectory =
project.findProperty('org.librarysimplified.directory.publish') ?: ''
def noSigning =
project.hasProperty('org.librarysimplified.no_signing')
task javadocsJar(type: Jar) {
classifier = "javadoc"
}
task sourcesJar(type: Jar) {
classifier = "sources"
from "src/main/java", "src/main/resources"
}
afterEvaluate {
publishing {
publications {
binaryAndSources(MavenPublication) {
artifactId = POM_ARTIFACT_ID
switch (POM_PACKAGING) {
case "aar":
from components.release
break
case "apk":
from components.release_apk
break
case "jar":
from components.java
break
}
artifact sourcesJar
artifact javadocsJar
pom {
name = POM_NAME
packaging = POM_PACKAGING
description = POM_DESCRIPTION
url = POM_URL
scm {
connection = POM_SCM_CONNECTION
developerConnection = POM_SCM_DEV_CONNECTION
url = POM_SCM_URL
}
licenses {
license {
name = POM_LICENCE_NAME
url = POM_LICENCE_URL
}
}
developers {
developer {
id = "io7m"
name = "Mark Raynsford"
email = "[email protected]"
url = "https://www.io7m.com"
}
developer {
id = "winniequinn"
name = "Winnie Quinn"
url = "https://www.winniequinn.com/"
}
developer {
id = "gioneill"
name = "Greg O'Neill"
url = "https://github.com/gioneill"
}
developer {
id = "mattniehoff"
name = "Matt Niehoff"
url = "https://github.com/mattniehoff"
}
developer {
id = "MalcolmMcFly"
name = "Malcolm Woods"
url = "https://github.com/MalcolmMcFly"
}
developer {
id = "twaddington"
name = "Tristan Waddington"
url = "https://github.com/twaddington"
}
}
}
}
}
repositories {
maven {
name = "directory"
url = "file://${publishDirectory}"
}
maven {
name = "centralSnapshots"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
credentials(PasswordCredentials) {
username mavenCentralUsername
password mavenCentralPassword
}
}
}
}
if (!noSigning) {
apply plugin: "signing"
signing {
useGpgCmd()
sign publishing.publications.binaryAndSources
}
}
// This block controls what repositories will be pushed to
// when the base 'publish' task is executed.
//
tasks.withType(PublishToMavenRepository) {
def isSnapshot = version.endsWith('-SNAPSHOT')
def isRelease = !isSnapshot
onlyIf {
if (publishDirectory) {
repository == publishing.repositories.directory
} else {
switch (repository) {
case publishing.repositories.centralSnapshots:
isSnapshot && (mavenCentralUsername && mavenCentralPassword)
break
default: false
}
}
}
}
}