-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
156 lines (131 loc) · 4.11 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
plugins {
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'kr.entree.spigradle' version '2.4.2'
id 'java'
id "com.modrinth.minotaur" version "2.+"
id 'maven-publish'
}
import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation
group = 'io.github.brawaru'
repositories {
mavenCentral()
spigot()
maven {
name = 'sonatype'
url = 'https://oss.sonatype.org/content/groups/public/'
}
maven {
name "essentialsx-releases"
url "https://repo.essentialsx.net/releases/"
}
}
dependencies {
compileOnly spigot('1.19.2')
compileOnly 'net.essentialsx:EssentialsX:2.19.4'
compileOnly 'org.jetbrains:annotations:23.0.0'
implementation 'net.kyori:adventure-api:4.11.0'
implementation 'net.kyori:adventure-platform-bukkit:4.1.2'
implementation 'net.kyori:adventure-text-minimessage:4.11.0'
}
spigot {
authors 'Brawaru'
apiVersion '1.19'
depends 'Essentials'
description 'Addon for EssentialsX that adds a configurable delay before activating the AFK status.'
excludeLibraries '*'
permissions {
'essentials.afk.immediate' {
description = 'Whether the player can switch to AFK without the waiting.'
defaults = true
}
}
}
def getMrReadme() {
def readmeLines = rootProject.file('README.md').getText('UTF-8').readLines()
def readmeContent = ''
def ignoresContent = false
for (def line : readmeLines) {
if (line.startsWith( '<!-- MR-SKIP-START -->')) {
if (ignoresContent) {
throw new GradleException('Illegal formatting: unexpected open of skip block')
}
ignoresContent = true;
continue;
} else if (line.trim() == '<!-- MR-SKIP-END -->') {
if (!ignoresContent) {
throw new GradleException('Illegal formatting: unexpected close of skip block')
}
ignoresContent = false;
continue;
}
if (!ignoresContent) {
readmeContent += line + '\n'
}
}
if (ignoresContent) {
throw new GradleException('Illegal formatting: unclosed skip block')
}
return readmeContent
}
task printModrinthReadme {
description = 'Prints README that will be used on Modrinth'
doLast {
print(getMrReadme())
}
}
modrinth {
token = System.getenv("MODRINTH_TOKEN")
projectId = "aessentialsxafkdelay"
versionType = "release"
uploadFile = shadowJar
gameVersions = ["1.19", "1.19.1", "1.19.2"]
loaders = ["spigot", "paper", "purpur"]
dependencies {
required.project "essentialsx"
}
syncBodyFrom = getMrReadme()
def changeLogFile = rootProject.file('$RELEASE-NOTES.md')
if (changeLogFile.exists()) {
changelog = changeLogFile.getText('UTF-8')
}
}
publishing {
publications {
shadow(MavenPublication) { publication ->
project.shadow.component(publication)
}
}
repositories.clear()
}
tasks.publish.finalizedBy(tasks.modrinth)
def targetJavaVersion = 17
java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
}
compileJava {
options.encoding = 'UTF-8'
}
tasks.withType(JavaCompile).configureEach {
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
options.release.set(targetJavaVersion)
}
}
// Always build shaded JAR instead of a normal JAR
jar {
enabled = false
}
shadowJar {
archiveClassifier.set(null)
}
tasks.assemble.dependsOn tasks.shadowJar
// Always re-locate dependencies except for those that excluded
task relocateShadowJar(type: ConfigureShadowRelocation) {
target = tasks.shadowJar
prefix = "OrsVaz9Pgn0FWmc8"
}
tasks.shadowJar.dependsOn tasks.relocateShadowJar