-
Notifications
You must be signed in to change notification settings - Fork 88
/
build.gradle.kts
168 lines (138 loc) · 4.08 KB
/
build.gradle.kts
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
import org.embeddedt.embeddium.gradle.VerifyAPICompat
import org.embeddedt.embeddium.gradle.versioning.ProjectVersioner
evaluationDependsOnChildren()
plugins {
id("idea")
id("java-library")
id("maven-publish")
id("me.modmuss50.mod-publish-plugin") version("0.3.4")
id("embeddium-platform-selector")
}
operator fun String.invoke(): String {
return (rootProject.properties[this] as String?)!!
}
tasks.withType<JavaCompile> {
sourceCompatibility = JavaVersion.VERSION_21.majorVersion
targetCompatibility = JavaVersion.VERSION_21.majorVersion
options.encoding = "UTF-8"
}
version = getModVersion()
group = "maven_group"()
println("Embeddium: $version")
base {
archivesName = "archives_base_name"()
}
repositories {
maven("https://libraries.minecraft.net")
mavenCentral()
maven("https://maven.fabricmc.net")
maven("https://maven.tterrag.com/")
maven("https://maven.blamejared.com")
maven("https://api.modrinth.com/maven") {
content {
includeGroup("maven.modrinth")
}
}
maven("https://cursemaven.com") {
content {
includeGroup("curse.maven")
}
}
maven("https://maven.covers1624.net/")
}
configurations {
val runtimeOnlyNonPublishable = create("runtimeOnlyNonPublishable") {
description = "Runtime only dependencies that are not published alongside the jar"
isCanBeConsumed = false
isCanBeResolved = false
}
runtimeClasspath.get().extendsFrom(runtimeOnlyNonPublishable)
}
fun DependencyHandlerScope.compatCompileOnly(dependency: String) {
"compatCompileOnly"(dependency)
}
dependencies {
// FIXME remove when NG not loading this from NF itself is fixed
implementation("io.github.llamalad7:mixinextras-neoforge:0.3.5")
// Mods
compatCompileOnly("curse.maven:codechickenlib-242818:${"codechicken_fileid"()}")
compileOnly("org.projectlombok:lombok:1.18.30")
annotationProcessor("org.projectlombok:lombok:1.18.30")
}
tasks.processResources {
inputs.property("version", "version"())
filesMatching(listOf("META-INF/neoforge.mods.toml", "fabric.mod.json")) {
expand("version" to "version"())
}
}
tasks.withType<JavaCompile> {
options.release = 21
}
java {
withSourcesJar()
}
// Make a JAR that has impl stripped
tasks.create<Jar>("apiJar") {
archiveClassifier = "api"
from(sourceSets["main"].output) {
exclude("org/embeddedt/embeddium/impl/**")
exclude("assets/**")
}
}
publishing {
tasks.publish {
dependsOn(tasks.build)
}
publications {
this.create<MavenPublication>("mavenJava") {
from(components["java"])
artifact(tasks.named("apiJar"))
}
}
repositories {
maven("file://${System.getenv("local_maven")}")
}
}
tasks.register<VerifyAPICompat>("verifyAPICompat") {
group = "verification"
binary = tasks.getByName<Jar>("jar").archiveFile
}
publishMods {
file = tasks.jar.get().archiveFile
changelog = "https://github.com/embeddedt/embeddium/wiki/Changelog"
val modVer = "mod_version"()
if(modVer.contains("beta")) {
type = BETA
} else if(modVer.contains("alpha")) {
type = ALPHA
} else {
type = STABLE
}
modLoaders.add("neoforge")
curseforge {
projectId = "908741"
accessToken = providers.environmentVariable("CURSEFORGE_TOKEN")
minecraftVersions.add("minecraft_version"())
incompatible {
slug = "rubidium"
}
incompatible {
slug = "textrues-embeddium-options"
}
}
modrinth {
projectId = "sk9rgfiA"
accessToken = providers.environmentVariable("MODRINTH_TOKEN")
minecraftVersions.add("minecraft_version"())
incompatible {
slug = "rubidium"
}
incompatible {
slug = "textrues-embeddium-options"
}
}
displayName = "[${"minecraft_version"()}] Embeddium ${"mod_version"()}"
}
fun getModVersion(): String {
return ProjectVersioner.computeVersion(project.projectDir, project.properties)
}