-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
173 lines (148 loc) · 4.03 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
import dev.triphora.gradle.ConfigurationExtension
import dev.triphora.gradle.Constants
import dev.triphora.gradle.MixinsJsonGenerator
import dev.triphora.gradle.QuiltModJsonGenerator
plugins {
alias libs.plugins.quilt.loom apply false
alias libs.plugins.minotaur apply false
alias libs.plugins.machete apply false
alias libs.plugins.outlet apply false
}
subprojects {
apply plugin: 'java'
//apply plugin: 'maven-publish'
apply plugin: 'org.quiltmc.loom'
apply plugin: 'com.modrinth.minotaur'
apply plugin: 'io.github.p03w.machete'
apply plugin: 'io.github.dexman545.outlet'
group = Constants.GROUP
archivesBaseName = project.name
[
['Modrinth', 'api.modrinth.com/maven', ['maven.modrinth']],
].forEach { var mavenInfo ->
repositories {
exclusiveContent {
forRepository {
maven {
name = mavenInfo[0]
url = 'https://' + mavenInfo[1]
}
}
filter {
mavenInfo[2].forEach { String group ->
includeGroup group
}
}
}
}
}
loom {
runtimeOnlyLog4j = project.name != 'clean_logs'
runs {
configureEach {
vmArg '-Dmixin.debug.export=true'
}
}
}
java.withSourcesJar()
dependencies {
minecraft libs.minecraft
mappings(variantOf(libs.quilt.mappings) { classifier 'intermediary-v2' })
modApi libs.quilt.loader
modLocalRuntime(libs.bundles.runtime) {
transitive = false
}
}
extensions.create('emmod', ConfigurationExtension.class, project)
task generateResources {
doLast {
new MixinsJsonGenerator().create(project)
new QuiltModJsonGenerator().create(project)
}
outputs.dir('build/generated/resources')
}
sourcesJar.dependsOn generateResources
remapJar.dependsOn generateResources
sourceSets {
main {
resources {
srcDir generateResources
}
}
}
if (emmod.qsl || emmod.midnightlib) {
dependencies {
modApi libs.quilted.fabric.api
}
}
if (emmod.midnightlib) {
dependencies {
modApi libs.midnightlib
include libs.midnightlib
}
}
int javaVersion = emmod.javaVersion.orNull ?: 17
tasks.withType(JavaCompile).configureEach {
it.options.encoding = 'UTF-8'
it.options.release = javaVersion
it.sourceCompatibility = javaVersion
}
jar.from project.file('LICENSE').exists() ? project.file('LICENSE') : rootProject.file('LICENSE')
def projectBody = project.file('README.md').text
def devinsBadges = 'https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy'
if (emmod.qsl || emmod.midnightlib) {
projectBody += "\n[![Requires Quilt Standard Libraries]($devinsBadges/requires/quilt-standard-libraries_64h.png)]" +
'(https://modrinth.com/mod/qsl)'
}
projectBody += "\n---\n[![Support us through GitHub Sponsors]($devinsBadges/donate/ghsponsors-plural_64h.png)]" +
"($Constants.DONATE_LINK)\\\n[![Chat with us on Discord]($devinsBadges/social/discord-plural_64h.png)]" +
"($Constants.DISCORD_LINK)"
modrinth {
projectId = emmod.modrinthSlug.orElse project.name
gameVersions = [libs.versions.minecraft.get()]
versionName = System.getenv().VERSION_NAME ?: versionNumber
changelog = System.getenv().CHANGELOG ?: DEFAULT_CHANGELOG
versionType = System.getenv().VERSION_TYPE ?: DEFAULT_VERSION_TYPE
uploadFile = remapJar
additionalFiles = [sourcesJar]
syncBodyFrom = projectBody
}
tasks.modrinth.doFirst {
if (emmod.gameVersions) {
modrinth.gameVersions = emmod.gameVersions
}
if (emmod.qsl || emmod.midnightlib) {
modrinth {
dependencies {
required.project 'qsl'
}
}
}
if (emmod.midnightlib) {
modrinth {
dependencies {
embedded.project 'midnightlib'
optional.project 'modmenu'
}
}
}
}
tasks.modrinth.dependsOn tasks.modrinthSyncBody
tasks.modrinth.dependsOn { tasks.named('optimizeOutputsOfRemapJar') }
//publishing {
// publications {
// mavenJava(MavenPublication) {
// from components.java
// }
// }
// repositories {
// maven {
// url = 's3://maven'
// credentials(AwsCredentials) {
// accessKey = findProperty('dev.triphora.maven.access')
// secretKey = findProperty('dev.triphora.maven.secret')
// }
// }
// }
//}
}