-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
139 lines (122 loc) · 5.09 KB
/
build.gradle.kts
File metadata and controls
139 lines (122 loc) · 5.09 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
/*
* ____ _ _ ____ ___ ____ _ _ ____ ____ ____ ____ ___ _ _ _ ____
* | | | [__ | | | |\/| | |__/ |__| |___ | | |\ | | __
* |___ |__| ___] | |__| | | |___ | \ | | | | | | \| |__]
*
* CustomCrafting Recipe creation and management tool for Minecraft
* Copyright (C) 2021 WolfyScript
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
plugins {
`java-library`
`maven-publish`
alias(libs.plugins.goooler.shadow)
alias(libs.plugins.devtools.docker.minecraft)
alias(libs.plugins.modrinth.minotaur)
alias(libs.plugins.jfrog.artifactory)
}
repositories {
mavenLocal()
maven (url = "https://repo.codemc.io/repository/maven-public/")
maven(url = "https://repo.papermc.io/repository/maven-public/")
maven(url = "https://artifacts.wolfyscript.com/artifactory/gradle-dev")
maven(url = "https://repo.dmulloy2.net/repository/public/")
maven(url = "https://repo.maven.apache.org/maven2/")
maven(url = "https://mvn.lumine.io/repository/maven-public/")
maven(url = "https://repo.oraxen.com/releases")
}
dependencies {
compileOnly(project(":spigot"))
}
java.sourceCompatibility = JavaVersion.VERSION_21
tasks.named<ShadowJar>("shadowJar") {
archiveClassifier.set("")
from(project(":spigot").tasks.shadowJar.get().archiveFile)
}
publishing {
publications.create<MavenPublication>("maven") {
from(components["java"])
artifact(file("$rootDir/gradle.properties"))
}
}
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
}
tasks.withType<Javadoc> {
options.encoding = "UTF-8"
}
val debugPort: String = "5006"
minecraftDockerRun {
val customEnv = env.get().toMutableMap()
customEnv["MEMORY"] = "2G"
customEnv["JVM_OPTS"] = "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:${debugPort}"
env.set(customEnv)
arguments("--cpus", "2", "-it") // Constrain to only use 2 cpus, and allow for console interactivity with 'docker attach'
}
minecraftServers {
serversDir.set(file("${System.getProperty("user.home")}${File.separator}minecraft${File.separator}test_servers_v4"))
libName.set("${project.name}-${version}.jar")
val debugPortMapping = "${debugPort}:${debugPort}"
servers {
register("spigot_1_21") {
version.set("1.21.8")
type.set("SPIGOT")
extraEnv.put("BUILD_FROM_SOURCE", "true")
imageVersion.set("java21-graalvm") // graalvm contains the jdk required to build from source
ports.set(setOf(debugPortMapping, "25569:25565"))
}
register("paper_1_21") {
version.set("1.21.8")
type.set("PAPER")
imageVersion.set("java21")
ports.set(setOf("5007:5007", "25570:25565"))
}
}
}
artifactory {
publish {
contextUrl = "https://artifacts.wolfyscript.com/artifactory"
repository {
repoKey = "gradle-dev-local"
username = System.getenv("ARTIFACTORY_USERNAME")
password = System.getenv("ARTIFACTORY_TOKEN")
}
defaults {
publications("maven")
setPublishArtifacts(true)
setPublishPom(true)
isPublishBuildInfo = false
}
}
}
// build.gradle.kts
modrinth {
token.set(System.getenv("MODRINTH_TOKEN")) // Remember to have the MODRINTH_TOKEN environment variable set or else this will fail - just make sure it stays private!
projectId.set("customcrafting") // This can be the project ID or the slug. Either will work!
versionNumber.set(project.version.toString()) // You don't need to set this manually. Will fail if Modrinth has this version already
versionType.set("release") // TODO: Automatically determine this from the version
uploadFile.set(tasks.shadowJar) // Use the shadowed jar !!
changelog.set(System.getenv("CHANGELOG"))
gameVersions.addAll("1.21.4", "1.21.5", "1.21.6", "1.21.7", "1.21.8") // Must be an array, even with only one version
loaders.addAll("bukkit", "spigot", "paper", "purpur") // Must also be an array - no need to specify this if you're using Loom or ForgeGradle
dependencies { // A special DSL for creating dependencies
// scope.type
// The scope can be `required`, `optional`, `incompatible`, or `embedded`
// The type can either be `project` or `version`
required.project("wolfyutils")
required.project("nbtapi")
}
}