forked from Wesley1808/ServerCore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
132 lines (106 loc) · 3.78 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
import org.jetbrains.changelog.Changelog
plugins {
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.7-SNAPSHOT" apply false
id "me.modmuss50.mod-publish-plugin" version "0.+"
id 'org.jetbrains.changelog' version '2.+'
}
subprojects {
apply plugin: "dev.architectury.loom"
loom {
silentMojangMappingsLicense()
accessWidenerPath.set(project(":common").file("src/main/resources/servercore.accesswidener"))
}
repositories {
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
mavenCentral()
}
dependencies {
minecraft "com.mojang:minecraft:${project.minecraft}"
mappings loom.officialMojangMappings()
// Spark API
compileOnly "me.lucko:spark-api:${project.spark_api}"
// Configuration
compileOnly "org.yaml:snakeyaml:${project.snakeyaml}"
compileOnly "space.arim.dazzleconf:dazzleconf-core:${project.dazzleconf}"
compileOnly "space.arim.dazzleconf:dazzleconf-ext-snakeyaml:${project.dazzleconf}"
// Mixin Extras
compileOnly(annotationProcessor("io.github.llamalad7:mixinextras-common:${project.mixin_extras}"))
}
}
allprojects {
apply plugin: "java"
apply plugin: "architectury-plugin"
apply plugin: "maven-publish"
var formattedVersion = "${mod_version}+${minecraft}"
archivesBaseName = project.archives_base_name
version = formattedVersion
group = project.maven_group
tasks.withType(JavaCompile).configureEach {
options.encoding = "UTF-8"
options.release.set(21)
}
tasks.withType(org.gradle.jvm.tasks.Jar).configureEach {
archiveVersion.set(formattedVersion)
}
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
}
publishMods {
changelog = fetchChangelog()
type = STABLE
def nameFormat = "ServerCore %s ${version.get()}"
def fabric = findProject(':fabric')
def neoforge = findProject(':neoforge')
def curseforgeOpts = curseforgeOptions {
accessToken = providers.environmentVariable("CURSEFORGE_TOKEN")
minecraftVersions.add(project.minecraft)
projectId = "550579"
}
def modrinthOpts = modrinthOptions {
accessToken = providers.environmentVariable("MODRINTH_TOKEN")
minecraftVersions.add(project.minecraft)
projectId = "4WWQxlQP"
}
if (fabric != null) {
def fabricJar = fabric.remapJar.archiveFile
curseforge("CurseForge - Fabric") {
from curseforgeOpts
file = fabricJar
modLoaders.add("fabric")
displayName = nameFormat.formatted("Fabric")
}
modrinth("Modrinth - Fabric") {
from modrinthOpts
file = fabricJar
modLoaders.add("fabric")
displayName = nameFormat.formatted("Fabric")
}
}
if (neoforge != null) {
def neoforgeJar = neoforge.remapJar.archiveFile
curseforge("CurseForge - NeoForge") {
from curseforgeOpts
file = neoforgeJar
modLoaders.add("neoforge")
displayName = nameFormat.formatted("NeoForge")
}
modrinth("Modrinth - NeoForge") {
from modrinthOpts
file = neoforgeJar
modLoaders.add("neoforge")
displayName = nameFormat.formatted("NeoForge")
}
}
dryRun = curseforgeOpts.get().accessToken.getOrNull() == null || modrinthOpts.get().accessToken.getOrNull() == null
}
private String fetchChangelog() {
def log = getChangelog.changelog.get()
if (log.has(project.mod_version)) {
return log.renderItem(
log.get(project.mod_version).withHeader(false),
Changelog.OutputType.MARKDOWN
)
} else {
return ""
}
}