This repository has been archived by the owner on Jun 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
/
build.gradle
144 lines (113 loc) · 4.68 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
133
134
135
136
137
138
139
140
141
142
143
144
plugins {
id 'maven-publish'
id "net.minecrell.licenser" version "0.4.1" apply false
id "signing"
}
group 'com.labymedia'
apply from: 'version.gradle'
static String getSigningProperty(String name) {
return System.getenv("SIGNING_${name}")
}
String getAuthenticationProperty(String propName, String envName) {
return project.hasProperty(propName) ? project.properties.get(propName) : System.getenv(envName)
}
ext.commonPublish = { Project currentProject, Closure config ->
currentProject.publishing {
repositories {
def releaseRepo = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotRepo = "https://oss.sonatype.org/content/repositories/snapshots/"
if (!version.endsWith("-UNSTABLE")) {
maven {
url version.endsWith("-SNAPSHOT") ? snapshotRepo : releaseRepo
name "OSS${version.endsWith("-SNAPSHOT") ? "Snapshots" : "Release"}HostingRepository"
credentials {
username getAuthenticationProperty("osshrUser", "OSSHR_USER")
password getAuthenticationProperty("osshrPassword", "OSSHR_PASSWORD")
}
}
maven {
def distributorUrl = System.getenv("FLINT_DISTRIBUTOR_URL")
if (distributorUrl == null && project.hasProperty("net.flintmc.distributor.url")) {
distributorUrl = project.property("net.flintmc.distributor.url").toString()
}
setUrl(distributorUrl)
name = "Flint"
def publishToken = System.getenv("FLINT_DISTRIBUTOR_PUBLISH_TOKEN")
if (publishToken == null && project.hasProperty("net.flintmc.distributor.publish-token")) {
publishToken = project.property("net.flintmc.distributor.publish-token").toString()
}
if (publishToken != null) {
credentials(HttpHeaderCredentials.class) {
name = "Publish-Token"
value = publishToken
}
authentication {
create("header", HttpHeaderAuthentication.class)
}
}
}
}
}
publications {
mavenJava(MavenPublication) {
from currentProject.components.java
configure(it, config)
version = rootProject.version
pom {
url = "https://github.com/LabyMod/ultralight-java"
licenses {
license {
name = "LGPLv3"
url = "https://www.gnu.org/licenses/lgpl-3.0.txt"
distribution = "repo"
}
}
developers {
developer {
id = "LabyMedia"
email = "[email protected]"
}
}
scm {
connection = "scm:git:git://github.com/LabyMod/ultralight-java.git"
developerConnection = "scm:git:ssh://github.com/LabyMod/ultralight-java.git"
url = "https://github.com/LabyMod/ultralight-java"
}
}
}
}
}
if (rootProject.hasProperty("enableSigning")) {
currentProject.signing {
def signingKey = getSigningProperty("KEY")
def signingPassword = getSigningProperty("PASSWORD")
useInMemoryPgpKeys(signingKey, signingPassword)
sign currentProject.publishing.publications.mavenJava
}
}
}
subprojects {
tasks.withType(GenerateModuleMetadata) {
enabled = false
}
pluginManager.withPlugin("java") {
apply plugin: "net.minecrell.licenser"
apply plugin: "signing"
sourceCompatibility = 1.8
targetCompatibility = 1.8
license {
header = rootProject.file("LICENSE_HEADER")
ext {
author = "LabyMedia"
year = "2020 - " + Calendar.getInstance(TimeZone.getTimeZone("UTC")).get(Calendar.YEAR)
}
}
java {
withSourcesJar()
withJavadocJar()
}
}
}
subprojects {
version = rootProject.version
}