-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathbuild.gradle
132 lines (106 loc) · 3.2 KB
/
build.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
import java.time.Duration
plugins {
id 'java-library'
id 'maven-publish'
id 'signing'
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
}
group = 'club.minnced'
project.version = '1.1.1'
def getProjectProperty(String name) { return project.properties.getOrDefault(name, null) }
def generatePom(Object pom, String packaging) {
pom.packaging = packaging
pom.name.set(project.name)
pom.description.set("Modular java binding for opus natives.")
pom.url.set("https://github.com/discord-java/opus-java")
pom.scm {
url.set("https://github.com/discord-java/opus-java")
connection.set("scm:git:git://github.com/discord-java/opus-java")
developerConnection.set("scm:git:ssh:[email protected]:discord-java/opus-java")
}
pom.licenses {
license {
name.set("The Apache Software License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
distribution.set("repo")
}
}
pom.developers {
developer {
id.set("Minn")
name.set("Florian Spieß")
email.set("[email protected]")
}
}
}
allprojects {
repositories {
mavenCentral()
}
apply plugin: 'java-library'
apply plugin: 'maven-publish'
group = 'club.minnced'
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8
ext.canSign = "signing.keyId" in properties
task signModule(type: Sign) {
sign(file("${buildDir}/publications/Release/module.json"))
}
task signPom(type: Sign) {
sign(file("${buildDir}/publications/Release/pom-default.xml"))
}
}
dependencies {
api project(':api')
api project(':natives')
}
publishing {
publications {
Release(MavenPublication) {
from components.java
groupId project.group
artifactId project.name
version version
generatePom(pom, "jar")
}
}
}
if (canSign) {
signing {
sign publishing.publications.Release
}
}
nexusPublishing {
repositories.sonatype {
username.set(getProjectProperty("ossrhUser"))
password.set(getProjectProperty("ossrhPassword"))
stagingProfileId.set(getProjectProperty("stagingProfileId"))
}
// Sonatype is very slow :)
connectTimeout.set(Duration.ofMinutes(1))
clientTimeout.set(Duration.ofMinutes(10))
transitionCheckOptions {
maxRetries.set(100)
delayBetween.set(Duration.ofSeconds(5))
}
}
subprojects {
initializeSonatypeStagingRepository {
mustRunAfter(tasks.withType(Sign))
}
tasks.withType(Sign) {
enabled = canSign
}
}
// To publish run ./gradlew release
task release {
afterEvaluate {
// Collect all the publishing task which upload the archives to nexus staging
def publishingTasks = [
":", ":api:", ":natives:"
].collect { it + "publishAllPublicationsToSonatypeRepository" }
dependsOn(publishingTasks)
// Make sure the close and release happens after uploading
dependsOn(closeAndReleaseSonatypeStagingRepository)
closeAndReleaseSonatypeStagingRepository.mustRunAfter(publishingTasks)
}
}