-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
181 lines (154 loc) · 5.69 KB
/
build.gradle
File metadata and controls
181 lines (154 loc) · 5.69 KB
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
plugins {
id 'java'
id 'maven-publish'
id("xyz.jpenilla.run-paper") version "2.3.1"
id("com.gradleup.shadow") version "9.1.0"
id("com.modrinth.minotaur") version "2.8.7"
}
def getLatestGitTag() {
try {
providers.exec {
commandLine("git", "describe", "--tags", "--abbrev=0")
}.standardOutput.asText.get().trim()
} catch (Exception ignore) {
"unknown"
}
}
def tag = System.getenv("TAG") ?: getLatestGitTag()
def isSnapshot = System.getenv('SNAPSHOT')?.toBoolean() ?: false
def gitHash = System.getenv("GIT_HASH") ?: "local"
group = 'me.axeno'
version = isSnapshot ? "${tag}-${gitHash.take(7)}" : (System.getenv("TAG") ? tag : "$tag-local")
repositories {
mavenCentral()
maven {
name = "papermc-repo"
url = "https://repo.papermc.io/repository/maven-public/"
}
maven {
name = "jitpack.io"
url = "https://jitpack.io"
}
}
dependencies {
compileOnly("io.papermc.paper:paper-api:${minecraft_version}-R0.1-SNAPSHOT")
implementation("io.github.revxrsal:lamp.common:${revxrsal_lamp_version}")
implementation("io.github.revxrsal:lamp.brigadier:${revxrsal_lamp_version}")
implementation("io.github.revxrsal:lamp.bukkit:${revxrsal_lamp_version}")
implementation("org.bstats:bstats-bukkit:${bstats_version}")
implementation("com.j256.ormlite:ormlite-jdbc:${ormlite_version}")
implementation("org.xerial:sqlite-jdbc:${sqlite_jdbc_version}")
implementation("com.mysql:mysql-connector-j:${mysql_connector_version}")
compileOnly("org.projectlombok:lombok:${lombok_version}")
annotationProcessor("org.projectlombok:lombok:${lombok_version}")
testImplementation("org.junit.jupiter:junit-jupiter-api:${junit_version}")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${junit_version}")
testRuntimeOnly("org.junit.platform:junit-platform-launcher:${junit_version}")
testImplementation("org.mockito:mockito-core:${mockito_version}")
testImplementation("org.mockito:mockito-junit-jupiter:${mockito_version}")
testImplementation("io.papermc.paper:paper-api:${minecraft_version}-R0.1-SNAPSHOT")
testImplementation("com.j256.ormlite:ormlite-jdbc:${ormlite_version}")
testImplementation("org.xerial:sqlite-jdbc:${sqlite_jdbc_version}")
testCompileOnly("org.projectlombok:lombok:${lombok_version}")
testAnnotationProcessor("org.projectlombok:lombok:${lombok_version}")
}
tasks {
runServer {
// Configure the Minecraft version for our task.
// This is the only required configuration besides applying the plugin.
// Your plugin's jar (or shadowJar if present) will be used automatically.
minecraftVersion("${minecraft_version}")
}
test {
useJUnitPlatform()
testLogging {
events("passed", "skipped", "failed")
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
showStandardStreams = false
}
}
}
def targetJavaVersion = 21
java {
withSourcesJar()
withJavadocJar()
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
}
processResources {
def props = [version: version, minecraft_version: minecraft_version]
inputs.properties props
filteringCharset 'UTF-8'
filesMatching('paper-plugin.yml') {
expand props
}
}
shadowJar {
relocate("org.bstats", "${project.group}.lib.bstats")
}
modrinth {
token = System.getenv("MODRINTH_TOKEN")
projectId = "hommr"
versionNumber = version
versionName = "Hommr ${version}"
versionType = version.toString().contains("beta") ? "beta" : (version.toString().contains("alpha") ? "alpha" : "release")
uploadFile = tasks.shadowJar
gameVersions = ["${minecraft_version}"]
loaders = ["paper", "purpur"]
syncBodyFrom = file("README.md").text
}
publishing {
publications {
maven(MavenPublication) {
from components.java
artifactId = 'hommr'
pom {
name = 'Hommr'
description = 'Easily set, teleport, and manage your homes.'
url = 'https://github.com/AxenoDev/Hommr'
licenses {
license {
name = 'GNU General Public License v3.0'
url = 'https://opensource.org/licenses/GPL-3.0'
}
}
developers {
developer {
id = 'AxenoDev'
name = 'AxenoDev'
url = 'https://axeno.me'
}
}
scm {
connection = 'scm:git:git://github.com/AxenoDev/Hommr.git'
developerConnection = 'scm:git:ssh://github.com:AxenoDev/Hommr.git'
url = 'https://github.com/AxenoDev/Hommr'
}
}
}
}
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/AxenoDev/Hommr")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
options.release.set(targetJavaVersion)
}
}
tasks.withType(Javadoc).configureEach {
options.encoding = 'UTF-8'
options.addStringOption('Xdoclint:none', '-quiet')
}