-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
224 lines (204 loc) · 9.95 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
223
224
plugins {
id 'java'
id 'maven-publish'
id 'com.gradleup.shadow' version '8.3.0'
id "net.neoforged.gradleutils" version "3.0.0"
id "org.jetbrains.gradle.plugin.idea-ext" version "1.1.8"
}
group = 'net.neoforged'
base {
archivesName = "neoform-runtime"
}
gradleutils.version {
branches.suffixBranch()
}
project.version = gradleutils.version
changelog {
from '0.1'
// For fine-grained changelog publication control
disableAutomaticPublicationRegistration()
}
repositories {
mavenCentral()
exclusiveContent {
forRepository {
maven {
name = "Fabric"
url = "https://maven.fabricmc.net/"
}
}
filter {
includeModule("net.fabricmc", "fabric-loom-native")
}
}
}
java {
withSourcesJar()
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
tasks.withType(JavaCompile).configureEach() {
options.encoding = "UTF-8"
}
def mainClassName = 'net.neoforged.neoform.runtime.cli.Main'
jar {
manifest {
attributes 'Main-Class': mainClassName
}
}
AdhocComponentWithVariants javaComponent = (AdhocComponentWithVariants) project.components.getByName("java")
configurations {
changelog {
canBeResolved = false
canBeConsumed = true
attributes {
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category, Category.DOCUMENTATION))
attribute(DocsType.DOCS_TYPE_ATTRIBUTE, objects.named(DocsType, "changelog"))
}
javaComponent.addVariantsFromConfiguration(it) {}
}
externalTools {
canBeConsumed = true
canBeResolved = false
// NFRT generally ignores transitive dependencies when downloading tools, so we should too
transitive = false
attributes {
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category, Category.LIBRARY))
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage, Usage.JAVA_RUNTIME))
}
outgoing {
capability "net.neoforged:neoform-runtime-external-tools:${project.version}"
}
components.java.addVariantsFromConfiguration(it) {}
}
}
dependencies {
compileOnly 'org.jetbrains:annotations:24.1.0'
implementation 'info.picocli:picocli:4.7.6'
implementation 'com.google.code.gson:gson:2.10.1'
implementation 'org.eclipse.jdt:ecj:3.38.0'
implementation 'net.fabricmc:fabric-loom-native:0.2.1'
implementation 'net.neoforged:srgutils:1.0.9'
annotationProcessor 'info.picocli:picocli-codegen:4.7.6'
testImplementation platform('org.junit:junit-bom:5.10.0')
testImplementation platform('org.mockito:mockito-bom:5.12.0')
testImplementation platform('org.assertj:assertj-bom:3.26.3')
testImplementation 'org.junit.jupiter:junit-jupiter'
testImplementation 'org.junit.jupiter:junit-jupiter-params'
testImplementation 'org.mockito:mockito-junit-jupiter'
testImplementation 'org.assertj:assertj-core'
}
// Add dependencies to external tools
var toolVersions = new java.util.Properties()
file("src/main/resources/tools.properties").withInputStream {
toolVersions.load(it)
}
for (var toolDependency : toolVersions.values()) {
dependencies {
externalTools(toolDependency)
}
}
artifacts {
// Only publish a changelog for releases
changelog(createChangelog.outputFile) {
builtBy(createChangelog)
setClassifier("changelog")
setExtension("txt")
}
}
test {
useJUnitPlatform()
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
repositories {
maven gradleutils.publishingMaven
}
}
/**
* Convenience IDE runs for IntelliJ for testing purposes.
*/
import org.jetbrains.gradle.ext.Application;
idea {
project {
settings {
runConfigurations {
"Show Help"(Application) {
mainClass = mainClassName
programParameters = "--help"
moduleRef(project, sourceSets.main)
}
"Run Neoforge 1.21 (joined) + Parchment"(Application) {
mainClass = mainClassName
programParameters = "run --dist joined --neoforge net.neoforged:neoforge:21.0.0-beta:userdev --add-repository=https://maven.parchmentmc.org --parchment-data=org.parchmentmc.data:parchment-1.21:2024.06.23@zip --parchment-conflict-prefix=p_ --write-result=compiled:build/minecraft-1.21.jar --write-result=clientResources:build/client-extra-1.21.jar --write-result=sources:build/minecraft-sources-1.21.jar"
moduleRef(project, sourceSets.main)
}
"Run Neoforge 1.21 (joined)"(Application) {
mainClass = mainClassName
programParameters = "run --dist joined --neoforge net.neoforged:neoforge:21.0.0-beta:userdev --write-result=compiled:build/minecraft.jar --write-result=clientResources:build/client-extra.jar --write-result=sources:build/minecraft-sources.jar"
moduleRef(project, sourceSets.main)
}
"Run Neoform 1.21 (joined)"(Application) {
mainClass = mainClassName
programParameters = "run --dist joined --neoform net.neoforged:neoform:1.21-20240613.152323@zip --write-result=compiled:build/minecraft.jar --write-result=clientResources:build/client-extra.jar --write-result=sources:build/minecraft-sources.jar"
moduleRef(project, sourceSets.main)
}
"Run Neoforge 1.20.6 (joined) + Parchment"(Application) {
mainClass = mainClassName
programParameters = "run --dist joined --neoforge net.neoforged:neoforge:20.6.72-beta:userdev --add-repository=https://maven.parchmentmc.org --parchment-data=org.parchmentmc.data:parchment-1.20.6:2024.05.01:checked@zip --write-result=compiled:build/minecraft.jar --write-result=clientResources:build/client-extra.jar --write-result=sources:build/minecraft-sources.jar"
moduleRef(project, sourceSets.main)
}
"Run Neoforge 1.20.6 (joined)"(Application) {
mainClass = mainClassName
programParameters = "run --dist joined --neoforge net.neoforged:neoforge:20.6.72-beta:userdev --write-result=compiled:build/minecraft.jar --write-result=clientResources:build/client-extra.jar --write-result=sources:build/minecraft-sources.jar"
moduleRef(project, sourceSets.main)
}
"Run Neoform 1.20.6 (joined)"(Application) {
mainClass = mainClassName
programParameters = "run --dist joined --neoform net.neoforged:neoform:1.20.6-20240429.153634@zip --write-result=compiled:build/minecraft.jar --write-result=clientResources:build/client-extra.jar --write-result=sources:build/minecraft-sources.jar"
moduleRef(project, sourceSets.main)
}
"Run NeoForge 1.20.1 (joined)"(Application) {
mainClass = mainClassName
programParameters = "run --dist joined --neoforge net.neoforged:forge:1.20.1-47.1.54:userdev --parchment-data=org.parchmentmc.data:parchment-1.20.1:2023.09.03@zip --parchment-conflict-prefix=p_ --write-result=namedToIntermediaryMapping:build/1.20.1.tsrg --write-result=compiledWithNeoForge:build/1.20.1-minecraft.jar --write-result=clientResources:build/1.20.1-client-extra.jar --write-result=sourcesWithNeoForge:build/1.20.1-minecraft-sources.jar"
moduleRef(project, sourceSets.main)
}
"Run Forge 1.12.2 (joined)"(Application) {
mainClass = mainClassName
programParameters = "run --dist joined --add-repository https://maven.minecraftforge.net --neoforge net.minecraftforge:forge:1.12.2-14.23.5.2860:userdev3 --write-result=compiledWithNeoForge:build/1.12.2-minecraft.jar --write-result=clientResources:build/1.12.2-client-extra.jar --write-result=sourcesWithNeoForge:build/1.12.2-minecraft-sources.jar"
moduleRef(project, sourceSets.main)
}
"Run Forge 1.17.1 (joined)"(Application) {
mainClass = mainClassName
programParameters = "run --dist joined --add-repository https://maven.minecraftforge.net --neoforge net.minecraftforge:forge:1.17.1-37.1.1:userdev --write-result=compiledWithNeoForge:build/1.17.1-minecraft.jar --write-result=clientResources:build/1.17.1-client-extra.jar --write-result=sourcesWithNeoForge:build/1.17.1-minecraft-sources.jar"
moduleRef(project, sourceSets.main)
}
"Run Neoform 1.19.2 (joined)"(Application) {
mainClass = mainClassName
programParameters = "run --dist joined --neoform de.oceanlabs.mcp:mcp_config:1.19.2@zip --write-result=compiled:build/minecraft.jar --write-result=clientResources:build/client-extra.jar --write-result=sources:build/minecraft-sources.jar"
moduleRef(project, sourceSets.main)
}
"Run clean-cache"(Application) {
mainClass = mainClassName
programParameters = "clean-cache --verbose"
moduleRef(project, sourceSets.main)
}
"Run cache-maintenance"(Application) {
mainClass = mainClassName
programParameters = "cache-maintenance --verbose"
moduleRef(project, sourceSets.main)
}
"Download assets 1.20.6"(Application) {
mainClass = mainClassName
programParameters = "download-assets --neoforge net.neoforged:neoforge:20.6.72-beta:userdev --write-properties build/assets.properties --write-json build/assets.json"
moduleRef(project, sourceSets.main)
}
}
}
}
}