-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle.kts
174 lines (143 loc) · 5.84 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
169
170
171
172
173
174
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import dev.architectury.plugin.ArchitectPluginExtension
import net.fabricmc.loom.api.LoomGradleExtensionAPI
import net.fabricmc.loom.task.RemapJarTask
plugins {
java
id("maven-publish")
id("dev.architectury.loom") version "1.6-SNAPSHOT" apply false
id("architectury-plugin") version "3.4-SNAPSHOT"
id("com.github.johnrengelman.shadow") version "8.1.1" apply false
}
architectury {
val minecraftVersion: String by project
minecraft = minecraftVersion
}
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
subprojects {
apply(plugin = "maven-publish")
apply(plugin = "dev.architectury.loom")
apply(plugin = "architectury-plugin")
apply(plugin = "com.github.johnrengelman.shadow")
val isExtension = project.layout.projectDirectory.asFile.parentFile.name == "extensions"
val minecraftVersion: String by project
val modLoader = if (isExtension) "common" else project.name
val modId = rootProject.name
val isCommon = modLoader == rootProject.projects.common.name
base {
if (isExtension) {
archivesName.set("$modId-${project.name}-$minecraftVersion")
} else {
archivesName.set("$modId-$modLoader-$minecraftVersion")
}
}
configure<LoomGradleExtensionAPI> {
silentMojangMappingsLicense()
}
repositories {
mavenCentral()
maven(url = "https://maven.teamresourceful.com/repository/maven-public/")
maven(url = "https://maven.neoforged.net/releases/")
maven(url = "https://oss.sonatype.org/content/repositories/snapshots")
maven(url = "https://maven.dediamondpro.dev/releases")
mavenLocal()
}
val shade: Configuration by configurations.creating {
configurations.implementation.get().extendsFrom(this)
}
dependencies {
val resourcefulLibVersion: String by project
val mineMarkVersion: String by project
val commonMarkVersion: String by project
"minecraft"("::${minecraftVersion}")
@Suppress("UnstableApiUsage")
"mappings"(project.the<LoomGradleExtensionAPI>().layered {
val parchmentVersion: String by project
officialMojangMappings()
parchment(create(group = "org.parchmentmc.data", name = "parchment-$minecraftVersion", version = parchmentVersion))
})
"modApi"(group = "com.teamresourceful.resourcefullib", name = "resourcefullib-$modLoader-$minecraftVersion", version = resourcefulLibVersion)
implementation("org.commonmark:commonmark:$commonMarkVersion")
if (isCommon) {
implementation("dev.dediamondpro:minemark-core:$mineMarkVersion")
implementation("org.commonmark:commonmark-ext-gfm-strikethrough:$commonMarkVersion") { isTransitive = false }
implementation("org.commonmark:commonmark-ext-gfm-tables:$commonMarkVersion") { isTransitive = false }
} else {
shade("dev.dediamondpro:minemark-core:$mineMarkVersion")
shade("org.commonmark:commonmark-ext-gfm-strikethrough:$commonMarkVersion") { isTransitive = false }
shade("org.commonmark:commonmark-ext-gfm-tables:$commonMarkVersion") { isTransitive = false }
}
}
java {
withSourcesJar()
}
tasks.jar {
archiveClassifier.set("dev")
}
tasks.named<RemapJarTask>("remapJar") {
archiveClassifier.set(null as String?)
injectAccessWidener.set(true)
}
tasks.processResources {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
filesMatching(listOf("META-INF/neoforge.mods.toml", "fabric.mod.json")) {
expand("version" to project.version)
}
}
if (!isCommon) {
if (!isExtension) {
configure<ArchitectPluginExtension> {
platformSetupLoomIde()
}
}
val shadowCommon by configurations.creating {
isCanBeConsumed = false
isCanBeResolved = true
}
tasks {
"shadowJar"(ShadowJar::class) {
relocate("dev.dediamondpro.minemark", "earth.terrarium.hermes.libs.minemark")
relocate("org.commonmark", "earth.terrarium.hermes.libs.commonmark")
relocate("org.ccil.cowan.tagsoup", "earth.terrarium.hermes.libs.tagsoup")
archiveClassifier.set("dev-shadow")
configurations = listOf(shadowCommon, shade)
exclude("architectury.common.json")
}
"remapJar"(RemapJarTask::class) {
dependsOn("shadowJar")
inputFile.set(named<ShadowJar>("shadowJar").flatMap { it.archiveFile })
}
}
}
publishing {
publications {
create<MavenPublication>("maven") {
artifactId = "$modId-$modLoader-$minecraftVersion"
from(components["java"])
pom {
name.set("Hermes $modLoader")
url.set("https://github.com/terrarium-earth/Hermes")
scm {
connection.set("git:https://github.com/terrarium-earth/Hermes.git")
developerConnection.set("git:https://github.com/terrarium-earth/Hermes.git")
url.set("https://github.com/terrarium-earth/Hermes")
}
licenses {
license {
name.set("MIT")
}
}
}
}
}
repositories {
maven {
setUrl("https://maven.teamresourceful.com/repository/terrarium/")
credentials {
username = System.getenv("MAVEN_USER")
password = System.getenv("MAVEN_PASS")
}
}
}
}
}