-
-
Notifications
You must be signed in to change notification settings - Fork 57
/
build.gradle
201 lines (162 loc) · 7.64 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
import org.gradle.api.internal.artifacts.dependencies.DefaultExternalModuleDependency
import com.modrinth.minotaur.TaskModrinthUpload
import com.modrinth.minotaur.request.VersionType
plugins {
id 'fabric-loom' version '1.1-SNAPSHOT'
id 'maven-publish'
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'java-library'
id "com.peterabeles.gversion" version "1.10.2"
id "com.modrinth.minotaur" version "2+"
}
gversion {
srcDir = "src/main/java/"
classPackage = "com.javazilla.bukkitfabric"
className = "GitVersion"
}
project.compileJava.dependsOn(createVersionFile)
sourceCompatibility = JavaVersion.VERSION_16
targetCompatibility = JavaVersion.VERSION_16
archivesBaseName = project.archives_base_name
version = project.mod_version
group = project.maven_group
configurations {
extraLibs
removeLibs
metest
}
loom {
accessWidenerPath = file("src/main/resources/bukkitfabric.accesswidener")
}
repositories {
maven { url = 'https://jitpack.io' }
maven { url = 'https://repo.codemc.io/repository/maven-releases/' }
maven { url = 'https://repo.spongepowered.org/maven' }
maven { url = 'https://maven.izzel.io/releases' }
mavenCentral()
}
configurations.all {
// Check for updates every build
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
dependencies {
minecraft("com.mojang:minecraft:${project.minecraft_version}") {
exclude module: 'commons-logging'
}
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation("net.fabricmc:fabric-loader:${project.loader_version}")
// modImplementation("net.fabricmc.fabric-api:fabric-api:${project.fabric_version}")
// Make a collection of all api modules we wish to use
Set<String> apiModules = [
"fabric-api-base",
"fabric-networking-api-v1",
"fabric-screen-handler-api-v1"
]
DefaultExternalModuleDependency ic = new DefaultExternalModuleDependency("com.javazilla.mods", "icommon-fabric-1.20", "1.20", null)
ic.setChanging(true) // Make sure we get the latest version of iCommon
//include(modImplementation(ic))
modImplementation(ic)
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modImplementation fileTree(dir: 'libs', include: 'MohistRemapper-0.3-1.19.2.jar')
extraLibs fileTree(dir: 'libs', include: 'MohistRemapper-0.3-1.19.2.jar')
modImplementation "io.izzel:tools:1.3.0"
extraLibs "io.izzel:tools:1.3.0"
extraLibs fileTree(dir: 'libs', include: 'commons-lang-2.6.jar')
extraLibs fileTree(dir: 'libs', include: 'adventure.jar')
//extraLibs group: "org.jetbrains", name: "annotations", version: "20.1.0"
extraLibs group: "com.googlecode.json-simple", name: "json-simple", version: "1.1.1"
extraLibs("org.yaml:snakeyaml:1.33")
//
compileOnly fileTree(dir: 'libs', include: "${project.paper_jar}")
//extraLibs fileTree(dir: 'libs', include: "${project.paper_jar}")
compileOnly fileTree(dir: 'libs', include: 'commons-lang-2.6.jar')
//compileOnly fileTree(dir: 'libs', include: 'slf4j.jar')
compileOnly group: "org.jetbrains", name: "annotations", version: "18.0.0"
compileOnly group: "com.googlecode.json-simple", name: "json-simple", version: "1.1.1"
//compileOnly 'net.fabricmc:tiny-mappings-parser:0.2.2.14'
//compileOnly 'net.fabricmc:tiny-remapper:0.4.2'
//compileOnly 'net.fabricmc:access-widener:1.0.0'
// NMS Remapping
// srglib-0.1.2.jar
extraLibs fileTree(dir: 'libs', include: "srglib-0.1.2.jar")
include(modImplementation("com.github.IsaiahPatton:SpecialSource:master-SNAPSHOT"))
compileOnly fileTree(dir: 'libs', include: "srglib-0.1.2.jar")
// (Optional) Fabric Permissions API.
// modImplementation "com.javazilla.mods:permissions:1.1"
// Remove parts that are included with Minecraft or Downloaded
removeLibs group: "com.google.guava", name: "guava", version: "21.0"
removeLibs group: 'org.apache.commons', name: 'commons-lang3', version: '3.8.1'
removeLibs group: 'org.apache.commons', name: 'commons-collections4', version: '4.2'
removeLibs group: 'commons-collections', name: 'commons-collections', version: '3.2.2'
removeLibs group: 'commons-lang', name: 'commons-lang', version: '2.6'
removeLibs group: 'commons-logging', name: 'commons-logging', version: '1.2'
removeLibs group: 'com.google.code.gson', name: 'gson', version: '2.8.6'
removeLibs group: 'junit', name: 'junit', version: '4.10'
configurations.api.extendsFrom( (configurations.extraLibs) )
annotationProcessor 'com.github.bsideup.jabel:jabel-javac-plugin:0.4.1'
}
configurations.implementation {
exclude group: 'commons-logging', module: 'commons-logging'
}
configure([tasks.compileJava]) {
sourceCompatibility = 16 // for the IDE support
options.release = 16
javaCompiler = javaToolchains.compilerFor {
languageVersion = JavaLanguageVersion.of(17)
}
}
processResources {
inputs.property "version", project.version
duplicatesStrategy = DuplicatesStrategy.INCLUDE
from(sourceSets.main.resources.srcDirs) {
include "fabric.mod.json"
if(System.env.BUILD_NUMBER){
expand "version": System.env.BUILD_NUMBER
}
}
from(sourceSets.main.resources.srcDirs) {
exclude "fabric.mod.json"
}
}
tasks.withType(JavaCompile) { options.encoding = "UTF-8" }
jar {
duplicatesStrategy = DuplicatesStrategy.WARN
from "LICENSE"
from {
(configurations.extraLibs - configurations.removeLibs).filter{ it.exists() }.collect { it.isDirectory() ? it : zipTree(it) }
}
exclude("**/mojang-translations/")
// exclude("*.jar") // WHY GRADLE, WHY?
}
shadowJar {
configurations = [project.configurations.api]
dependencies {
exclude(dependency('com.mojang:minecraft:*'))
exclude(dependency('org.objectweb:asm:*'))
exclude(dependency('com.google.guava:guava:*'))
}
}
/*task publishModrinth (type: TaskModrinthUpload){ // Make sure it runs after build!
onlyIf {
System.getenv("MODRINTH") // Only attempt to run this task if the MODRINTH variable is set, otherwise SKIP it
}
token = System.getenv("MODRINTH") // An environment property called MODRINTH that is your token, set via Gradle CLI, GitHub Actions, Idea Run Configuration, or other
projectId = 'MLYQ9VGP'
versionType = VersionType.BETA
versionNumber = '1.17-' + System.env.BUILD_NUMBER // Will fail if Modrinth has this version already
versionName = '#' + System.env.BUILD_NUMBER + ' (1.19.2)'
// On fabric, use 'remapJar' instead of 'jar'
uploadFile = remapJar // This is the java jar task. If it can't find the jar, try 'jar.outputs.getFiles().asPath' in place of 'jar'
addGameVersion('1.19.2') // Call this multiple times to add multiple game versions. There are tools that can help you generate the list of versions
// addGameVersion('1.18')
addLoader('fabric')
}*/
modrinth {
token = System.getenv("MODRINTH") // This is the default. Remember to have the MODRINTH_TOKEN environment variable set or else this will fail, or set it to whatever you want - just make sure it stays private!
projectId = "MLYQ9VGP" // This can be the project ID or the slug. Either will work!
versionNumber = "1.20.1-" + System.env.BUILD_NUMBER // You don't need to set this manually. Will fail if Modrinth has this version already
versionType = "beta" // This is the default -- can also be `beta` or `alpha`
uploadFile = remapJar // With Loom, this MUST be set to `remapJar` instead of `jar`!
gameVersions = ["1.20.1"] // Must be an array, even with only one version
loaders = ["fabric"] // Must also be an array - no need to specify this if you're using Loom or ForgeGradle
}