This repository has been archived by the owner on May 27, 2024. It is now read-only.
forked from NyaaCat/RPGItems-reloaded
-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.gradle
233 lines (199 loc) · 7.62 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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
plugins {
id 'java-library'
id 'maven-publish'
id 'signing'
id 'io.github.gradle-nexus.publish-plugin' version '1.1.0'
id 'com.github.johnrengelman.shadow' version '5.1.0'
id 'org.ajoberstar.grgit' version '3.0.0'
}
import org.ajoberstar.grgit.Commit
import org.ajoberstar.grgit.Grgit
import org.apache.tools.ant.filters.ReplaceTokens
String majorVersion = 3
String minorVersion = 12
Grgit repo = Grgit.open(currentDir: project.projectDir)
Commit commit = repo.head()
String commitHash = commit.abbreviatedId
String branch = System.getenv("BRANCH_NAME") == null ? repo.branch.current().name : System.getenv("BRANCH_NAME")
boolean releasing = commit.shortMessage.contains("[release]")
String buildNumber = findProperty("BUILD_NUMBER") == null ? (releasing ? '0' : commitHash.substring(0,6)) : findProperty("BUILD_NUMBER")
String jdDirectory = System.getenv("JAVADOCS_DIR") == null ? null : System.getenv("JAVADOCS_DIR")
archivesBaseName = "RPGItems-reloaded"
version = "$majorVersion.$minorVersion.$buildNumber"
String mavenVersion = releasing ? version : "$majorVersion.$minorVersion-SNAPSHOT"
println("version: $version")
println("isReleasing: $releasing")
println("mavenVersion: $mavenVersion")
sourceCompatibility = 17
targetCompatibility = 17
configurations.configureEach {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
allprojects {
group = "top.mrxiaom"
version = rootProject.version
repositories {
jcenter()
mavenCentral()
maven { name "papermc"; url "https://papermc.io/repo/repository/maven-public/" }
maven { name 'enginehub'; url 'https://maven.enginehub.org/repo/' }
maven { name 'RoseWoodDev'; url "https://repo.rosewooddev.io/repository/public/" }
maven { name 'PlaceholderAPI'; url "https://repo.extendedclip.com/content/repositories/placeholderapi/" }
maven { name 'Spigot'; url 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' }
maven { name 'Mythic'; url 'https://mvn.lumine.io/repository/maven/' }
maven { name 'vault-repo'; url 'https://jitpack.io' }
}
tasks.withType(JavaCompile).configureEach {
options.encoding = "UTF-8"
sourceCompatibility = 17
targetCompatibility = 17
}
}
dependencies {
compileOnly "io.papermc.paper:paper-api:1.19.4-R0.1-SNAPSHOT"
compileOnly 'io.netty:netty-all:4.1.25.Final' // netty is shadowed inside spigot jar
compileOnly 'org.ow2.asm:asm:9.3'
compileOnly 'net.bytebuddy:byte-buddy:1.12.16'
compileOnly 'com.udojava:EvalEx:2.7'
compileOnly 'commons-lang:commons-lang:2.6'
compileOnly 'org.jetbrains:annotations:24.0.1'
compileOnly 'com.github.LoneDev6:api-itemsadder:3.6.1'
compileOnly 'io.lumine:Mythic-Dist:5.4.1-SNAPSHOT'
compileOnly 'me.clip:placeholderapi:2.11.5'
implementation("org.projectlombok:lombok:1.18.30")
annotationProcessor("org.projectlombok:lombok:1.18.30")
implementation('com.sk89q.worldguard:worldguard-core:7.0.4-SNAPSHOT')
implementation('com.sk89q.worldguard:worldguard-bukkit:7.0.4-SNAPSHOT') {
exclude group: 'io.papermc', module: 'paperlib'
exclude group: 'org.bstats', module: 'bstats-bukkit'
exclude group: 'org.bukkit', module: 'bukkit'
exclude group: 'org.spigotmc', module: 'spigot-api'
}
compileOnly('com.github.MilkBowl:VaultAPI:1.7') { transitive = false }
for (Project proj : project(":nms").subprojects) {
implementation(proj)
shadow(proj)
}
}
tasks.withType(ProcessResources).configureEach {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
from(sourceSets.main.resources.srcDirs) {
expand('version': project.version)
include 'plugin.yml'
}
from(sourceSets.main.resources.srcDirs) {
filter(ReplaceTokens, tokens: ['GIT_BRANCH': branch, 'GIT_HASH': commitHash], beginToken: '{', endToken: '}')
include 'lang/'
}
}
jar {
archiveClassifier.set('core')
}
shadowJar {
configurations = [project.configurations.shadow]
}
tasks.build.dependsOn(shadowJar)
task apiJar(type: Jar) {
includeEmptyDirs = false
from sourceSets.main.output.classesDirs
include('**/think/rpgitems/RPGItems.class')
include('**/think/rpgitems/Events.class')
include('**/think/rpgitems/api/')
include('**/think/rpgitems/item/')
include('**/think/rpgitems/power/')
include('**/think/rpgitems/event/')
include('**/think/rpgitems/utils/')
exclude('**/think/rpgitems/power/impl/')
}
task sourcesJar(type: Jar) {
archiveClassifier.set('sources')
from sourceSets.main.java.srcDirs
}
task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier.set('javadoc')
from javadoc.destinationDir
}
task checkRelease() {
doLast {
if (!releasing) {
throw new GradleException("This is a canary version, use with caution!")
}
}
}
// write javadocs to an external folder which can be served via nginx
if (jdDirectory != null) {
javadoc.destinationDir = file("${jdDirectory}/rpgitems-${mavenVersion}")
}
javadoc {
(options as StandardJavadocDocletOptions).with {
links 'https://docs.oracle.com/javase/17/docs/api/'
links 'https://hub.spigotmc.org/javadocs/spigot/'
links 'https://ci.md-5.net/job/BungeeCord/ws/chat/target/apidocs/'
links 'https://netty.io/4.1/api/'
locale 'en_US'
encoding 'UTF-8'
docEncoding 'UTF-8'
addBooleanOption('keywords', true)
addBooleanOption('Xdoclint:none', true)
def currentJavaVersion = JavaVersion.current()
if (currentJavaVersion > JavaVersion.VERSION_1_9) {
options.addBooleanOption('html5', true)
}
windowTitle = "RPGItems Javadoc"
docTitle = "<b>RPGItems</b> " + version
}
}
publishing {
publications {
mavenRelease(MavenPublication) {
from components.java
groupId "top.mrxiaom"
artifactId "rpgitems"
version "$mavenVersion"
artifact apiJar
artifact shadowJar
artifact sourcesJar
artifact javadocJar
pom {
name = 'RPGItems-reloaded'
description = 'The legacy RPGItems continues. (fork)'
url = 'https://github.com/MrXiaoM/RPGItems-reloaded'
licenses {
license {
name = 'MIT License'
url = 'https://mit-license.org/'
}
}
developers {
developer {
name = 'MrXiaoM'
email = 'mrxiaom@qq.com'
}
}
scm {
url = 'https://github.com/MrXiaoM/RPGItems-reloaded'
connection = 'scm:git:https://github.com/MrXiaoM/RPGItems-reloaded.git'
developerConnection = 'scm:git:https://github.com/MrXiaoM/RPGItems-reloaded.git'
}
}
}
}
}
signing {
def signingKey = findProperty("signingKey")
def signingPassword = findProperty("signingPassword")
if (signingKey != null && signingPassword != null) {
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.mavenRelease
}
}
nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
username = findProperty("MAVEN_USERNAME")
password = findProperty("MAVEN_PASSWORD")
}
}
}