forked from tterrag1098/Registrate
-
Notifications
You must be signed in to change notification settings - Fork 7
/
build.gradle
175 lines (151 loc) · 5.2 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
//file:noinspection GroovyAssignabilityCheck
//file:noinspection GroovyAccessibility
plugins {
id "fabric-loom" version "1.0.+"
id "io.github.juuxel.loom-quiltflower" version "1.+" // Quiltflower, a better decompiler
id "io.freefair.lombok" version "6.1.0-m3"
id "maven-publish"
}
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
version = "${project.mod_version}-MC${minecraft_version}"
group = "com.tterrag.registrate_fabric"
archivesBaseName = "Registrate-Fabric"
String buildNumber = System.getenv("GITHUB_RUN_NUMBER")
String patch = buildNumber != null ? buildNumber : "99999"
version = version.replace("<patch>", patch)
repositories {
mavenLocal()
maven { url = "https://maven.parchmentmc.org" }
maven { url = "https://maven.quiltmc.org/repository/release" }
maven { url = "https://repo.maven.apache.org/maven2" }
maven { url = "https://mvn.devos.one/snapshots" }
maven {
url = "https://jitpack.io"
content {
includeGroup("com.github.LlamaLad7")
}
}
}
dependencies {
minecraft("com.mojang:minecraft:${project.minecraft_version}")
mappings(loom.layered {
it.mappings("org.quiltmc:quilt-mappings:${project.minecraft_version}+build.${project.qm_version}:intermediary-v2")
it.parchment("org.parchmentmc.data:parchment-${project.minecraft_version}:${project.parchment_version}@zip")
it.officialMojangMappings { nameSyntheticMembers = false }
})
modImplementation("net.fabricmc:fabric-loader:${project.loader_version}")
modImplementation("net.fabricmc.fabric-api:fabric-api:${project.fabric_version}")
modApi(include(fabricApi.module("fabric-data-generation-api-v1", project.fabric_version))) // include datagen api
modApi(include("io.github.fabricators_of_create.Porting-Lib:tags:${project.porting_lib_version}")) { transitive = false }
modApi(include("io.github.fabricators_of_create.Porting-Lib:model_generators:${project.porting_lib_version}")) { transitive = false }
implementation(include("com.github.LlamaLad7:MixinExtras:0.1.1"))
annotationProcessor("com.github.LlamaLad7:MixinExtras:0.1.1")
compileOnly("org.projectlombok:lombok:1.18.22")
implementation(include("com.google.code.findbugs:jsr305:3.0.2"))
implementation("javax.annotation:javax.annotation-api:1.3.2")
}
task buildOrPublish {
group = "build"
String mavenUser = System.getenv().MAVEN_USER
if (mavenUser != null && !mavenUser.isEmpty()) {
dependsOn(tasks.getByName("publish"))
println "prepared for publish"
} else {
dependsOn(tasks.getByName("build"))
println "prepared for build"
}
}
sourceSets {
testmod {
compileClasspath += main.compileClasspath
compileClasspath += main.output
runtimeClasspath += main.runtimeClasspath
runtimeClasspath += main.output
resources {
srcDir("src/testmod/generated/resources")
exclude("src/testmod/generated/resources/.cache")
}
}
}
loom {
accessWidenerPath = file("src/main/resources/registrate-fabric.accesswidener")
runs {
testmodClient {
client()
name "Testmod Client"
source sourceSets.testmod
runDir "run/test"
}
testmodServer {
server()
name "Testmod Server"
source sourceSets.testmod
runDir "run/test_server"
}
testmodDatagen {
client()
name "Testmod Data Generation"
vmArg "-Dfabric-api.datagen"
vmArg "-Dfabric-api.datagen.output-dir=${file("src/testmod/generated/resources")}"
vmArg "-Dfabric-api.datagen.modid=testmod"
source sourceSets.testmod
}
}
}
lombok {
version = "1.18.20"
config["lombok.addJavaxGeneratedAnnotation"] = "true"
}
delombok {
format = [
"suppressWarnings": "skip",
"javaLangAsFQN": "skip"
]
}
task sourceJar(type: Jar, dependsOn: classes) {
classifier = "sources"
from sourceSets.main.delombokTask
exclude "com.tterrag.registrate.test.*"
}
javadoc {
source = delombok
options.addStringOption("tag", "apiNote:a:API Note:")
}
processResources {
inputs.property "version", project.version
filesMatching("fabric.mod.json") {
expand "version": project.version
}
}
tasks.withType(JavaCompile).configureEach {
it.options.release = Integer.parseInt(sourceCompatibility)
}
java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()
}
jar {
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}"}
}
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
repositories {
maven {
url = "https://mvn.devos.one/${System.getenv().PUBLISH_SUFFIX}/"
credentials {
username = System.getenv().MAVEN_USER
password = System.getenv().MAVEN_PASS
}
authentication { basic(BasicAuthentication) }
}
}
}