-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
159 lines (145 loc) · 5.34 KB
/
Copy pathbuild.gradle
File metadata and controls
159 lines (145 loc) · 5.34 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
plugins {
id 'java'
id 'maven-publish'
id("xyz.jpenilla.run-paper") version "2.3.1"
id("com.gradleup.shadow") version "9.0.0-beta13"
id("com.modrinth.minotaur") version "2.9.0"
}
group = 'me.f0reach.vshop'
// `version` comes from gradle.properties, which release-please keeps up to date.
repositories {
mavenCentral()
maven {
name = "papermc-repo"
url = "https://repo.papermc.io/repository/maven-public/"
}
maven {
name = "jitpack"
url = "https://jitpack.io"
}
maven {
name = "placeholderapi"
url = "https://repo.extendedclip.com/content/repositories/placeholderapi/"
}
maven {
name = "fancyinnovations"
url = "https://repo.fancyinnovations.com/releases"
}
exclusiveContent {
forRepository {
maven {
name = "modrinth"
url = "https://api.modrinth.com/maven"
}
}
filter { includeGroup("maven.modrinth") }
}
}
dependencies {
compileOnly("io.papermc.paper:paper-api:1.21.8-R0.1-SNAPSHOT")
compileOnly("com.github.MilkBowl:VaultAPI:1.7.1")
compileOnly("me.clip:placeholderapi:2.11.6")
// BedrockDialog (Modrinth Maven). Version slug pinned to the latest available 1.21.8+ compatible build.
compileOnly("maven.modrinth:bedrockdialog:1.0.3")
// FancyNpcs API. Pinned to 2.9.2 — the last release whose API jar is a Java 17
// class file (2.10.0+ ship Java 25 bytecode, unreadable by our JDK 21 toolchain).
// 2.9.2's full public API is present unchanged in 2.10.x / 2.11.x, so binaries
// compiled here run against the current plugin releases.
compileOnly("de.oliver:FancyNpcs:2.9.2")
implementation("com.zaxxer:HikariCP:5.1.0")
runtimeOnly("org.xerial:sqlite-jdbc:3.49.1.0")
runtimeOnly("com.mysql:mysql-connector-j:9.1.0")
testImplementation("io.papermc.paper:paper-api:1.21.8-R0.1-SNAPSHOT")
testImplementation("org.junit.jupiter:junit-jupiter:5.12.1")
testImplementation("org.junit.jupiter:junit-jupiter-params:5.12.1")
testImplementation("org.xerial:sqlite-jdbc:3.49.1.0")
testImplementation("com.mysql:mysql-connector-j:9.1.0")
testImplementation("com.zaxxer:HikariCP:5.1.0")
testImplementation("org.mockbukkit.mockbukkit:mockbukkit-v1.21:4.89.0")
testRuntimeOnly("org.junit.platform:junit-platform-launcher:1.12.1")
}
tasks {
runServer {
minecraftVersion("1.21.11")
}
test {
useJUnitPlatform()
}
shadowJar {
archiveClassifier.set("")
relocate("com.zaxxer.hikari", "me.f0reach.vshop.lib.hikari")
}
build {
dependsOn(shadowJar)
}
}
def targetJavaVersion = 21
java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
options.release.set(targetJavaVersion)
}
}
processResources {
def props = [version: version]
inputs.properties props
filteringCharset 'UTF-8'
filesMatching('paper-plugin.yml') {
expand props
}
}
// Written by the release workflow from the GitHub Release body. When it is
// absent (a hand-run publish), fall back to a link to the release page.
def modrinthChangelogFile = layout.buildDirectory.file("modrinth-changelog.md")
modrinth {
token = providers.environmentVariable("MODRINTH_TOKEN")
projectId = "modernvillagershop"
versionNumber = project.version.toString()
versionName = "ModernVillagerShop ${project.version}"
versionType = project.version.toString().contains("-") ? "beta" : "release"
uploadFile = tasks.shadowJar
gameVersions = providers.gradleProperty("modrinth.gameVersions")
.map { spec -> spec.split(",").collect { it.trim() }.findAll { !it.isEmpty() } }
loaders = ["paper"]
detectLoaders = false
changelog = providers.provider {
def file = modrinthChangelogFile.get().asFile
file.exists() && !file.text.trim().isEmpty()
? file.text
: "See https://github.com/f0reachARR/ModernVillagerShop/releases/tag/v${project.version}".toString()
}
// README.md doubles as the Modrinth project description; `modrinthSyncBody`
// pushes it. Every link in it must stay absolute for that reason.
syncBodyFrom = providers.fileContents(layout.projectDirectory.file("README.md")).asText
dependencies {
required.project "bedrockdialog"
optional.project "placeholderapi"
// Vault has no Modrinth project, so it can only be documented in the body.
}
}
publishing {
publications {
shadow(MavenPublication) {
from components.shadow
artifactId = 'modernvillagershop'
}
}
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/f0reachARR/ModernVillagerShop")
credentials {
username = System.getenv("GITHUB_ACTOR") ?: project.findProperty("gpr.user")
password = System.getenv("GITHUB_TOKEN") ?: project.findProperty("gpr.key")
}
}
}
}