-
Notifications
You must be signed in to change notification settings - Fork 16
/
build.gradle
222 lines (189 loc) · 6.25 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
plugins {
id 'java-library'
id 'idea'
id 'maven-publish'
id 'net.neoforged.moddev' version '1.0.23'
id "me.modmuss50.mod-publish-plugin" version "0.7.4"
}
tasks.named('wrapper', Wrapper).configure {
distributionType = Wrapper.DistributionType.BIN
}
def ENV = System.getenv()
version = "${mod_version}+${minecraft_version}-b${ENV.GITHUB_RUN_NUMBER ?: 9999}"
group = "com.flanks255"
base {
archivesName = "simplylight"
}
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
neoForge {
version = project.neo_version
parchment {
mappingsVersion = project.parchment_mappings_version
minecraftVersion = project.hasProperty("parchment_minecraft_version") ? project.parchment_minecraft_version : project.minecraft_version
}
runs {
client {
client()
systemProperty 'neoforge.enabledGameTestNamespaces', "simplylight"
programArguments.addAll('--width', '1280', '--height', '720')
if (ENV.MCDEVUSER) {
programArguments.addAll('--username', ENV.MCDEVUSER)
}
if (ENV.MCDEVUUID) {
programArguments.addAll('--uuid', ENV.MCDEVUUID)
}
}
server {
server()
systemProperty 'neoforge.enabledGameTestNamespaces', "simplylight"
programArgument '--nogui'
}
gameTestServer {
type = "gameTestServer"
systemProperty 'forge.enabledGameTestNamespaces', "simplylight"
}
data {
data()
programArguments.addAll '--mod', "simplylight", '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
}
configureEach { run ->
jvmArgument '-Xmx8G'
if (run.project.javaToolchains.launcherFor(java.toolchain).map { it.metadata.vendor }.getOrElse("").contains("JetBrains")) {
run.jvmArgument("-XX:+AllowEnhancedClassRedefinition")
}
}
}
mods {
"simplylight" {
sourceSet(sourceSets.main)
}
}
}
sourceSets.main.resources { srcDir 'src/generated/resources' }
repositories {
maven { url = 'https://maven.creeperhost.net/' }
maven { url = 'https://www.cursemaven.com' }
maven { url = 'https://maven.saps.dev/releases' }
}
dependencies {
compileOnly "mezz.jei:jei-${jei_mc_version}-common-api:${jei_version}"//new
compileOnly "mezz.jei:jei-${jei_mc_version}-neoforge-api:${jei_version}"
runtimeOnly "mezz.jei:jei-${jei_mc_version}-neoforge:${jei_version}"
// compileOnly fg.deobf("curse.maven:TOP-245211:4159743")
runtimeOnly "curse.maven:JADE-324717:5493270"
runtimeOnly "curse.maven:ATLAS-633577:5490697"
runtimeOnly "curse.maven:CTM-267602:5587515"
//compileOnly fg.deobf("curse.maven:BUILDINGGADGETS-298187:4423592")
}
jar {
manifest {
attributes([
"Specification-Title": "simplylight",
"Specification-Vendor": "Flanks255",
"Specification-Version": "1",
"Implementation-Title": project.name,
"Implementation-Version": "${version}",
"Implementation-Vendor" :"Flanks255",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
from sourceSets.main.output
}
var generateModMetadata = tasks.register("generateModMetadata", ProcessResources) {
var replaceProperties = [
loader_version:loader_version,
mod_version:mod_version
]
inputs.properties replaceProperties
expand replaceProperties
from "src/main/templates"
into "build/generated/sources/modMetadata"
}
sourceSets.main.resources.srcDir generateModMetadata
neoForge.ideSyncTask generateModMetadata
tasks.register('sourcesJar', Jar) {
from sourceSets.main.java
archiveClassifier.set('sources')
}
artifacts {
archives sourcesJar
}
publishing {
publications {
register('mavenJava', MavenPublication) {
from components.java
artifact sourcesJar
}
}
repositories {
def saps_token = providers.environmentVariable("SAPS_TOKEN")
if (saps_token.isPresent()) {
maven {
url "https://maven.saps.dev/releases"
credentials {
username = "flanks"
password = saps_token.get()
}
}
}
}
}
// From Mikey
/**
* Seek out the changelog for the current version and return it as a string.
*/
def createChangelog = () -> {
def changelogText = new File("CHANGELOG.md").text
def changelog = ""
def lines = changelogText.split("\n")
def inChangelog = false
for (int i = 0; i < lines.size(); i++) {
def line = lines[i]
if (line.startsWith("# ")) {
if (inChangelog) {
break
} else {
if (line.contains(mod_version)) {
inChangelog = true
}
}
}
if (inChangelog) {
changelog += line + "\n"
}
}
def output = changelog.trim()
return output.empty ? "No changelog found" : output
}
def cfToken = providers.environmentVariable("CURSEFORGE_KEY")
def ghToken = providers.environmentVariable("GITHUB_TOKEN")
//https://modmuss50.github.io/mod-publish-plugin/
publishMods {
dryRun = !cfToken.isPresent() || !ghToken.isPresent()
file = jar.archiveFile
changelog = createChangelog().trim()
modLoaders.add("NeoForge")
type = BETA
additionalFiles.from sourcesJar.archiveFile
curseforge {
accessToken = cfToken
projectId = curseforge_id
minecraftVersions.add(minecraft_version)
javaVersions.add(JavaVersion.VERSION_21)
}
github {
repository = "Flanks255/simplylight"
accessToken = ghToken
commitish = providers.environmentVariable("GITHUB_SHA").orElse("dryRun")
tagName = providers.environmentVariable("GITHUB_REF_NAME").orElse("dryRun")
}
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
}
idea {
module {
downloadSources = true
downloadJavadoc = true
}
}