-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle
160 lines (130 loc) · 3.96 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
plugins {
id 'fabric-loom' version '1.6-SNAPSHOT'
id 'legacy-looming' version "1.6-SNAPSHOT" // Version must be the same as fabric-loom's
id 'maven-publish'
id 'com.github.johnrengelman.shadow' version '8.1.1'
id "com.modrinth.minotaur" version "2.+"
id 'jacoco'
id "org.sonarqube" version "5.0.0.4638"
}
version = project.mod_version
group = project.maven_group
repositories {
mavenCentral()
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
content {
includeGroup "maven.modrinth"
}
}
maven {
name = "Jitpack"
url = "https://jitpack.io/"
}
}
loom.mods.register(project.name + "-testmod") {
sourceSet project.sourceSets.test
}
dependencies {
minecraft "net.minecraft:minecraft:${project.minecraft_version}"
mappings legacy.yarn(project.minecraft_version, project.yarn_build)
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation(include(legacy.apiModule("legacy-fabric-logger-api-v1", project.fabric_version)))
modImplementation(include("maven.modrinth:spasm:${project.spasm_version}"))
shadow(runtimeOnly('net.fabricmc:mapping-io:0.6.1')) {
transitive = false
}
shadow(runtimeOnly('net.fabricmc:tiny-remapper:0.10.2')) {
transitive = false
}
shadow(runtimeOnly('com.google.code.gson:gson:2.2.4')) {
transitive = false
}
implementation(include("io.github.llamalad7:mixinextras-fabric:${project.mixin_extras_version}"))
implementation(include("com.github.thecatcore.CursedMixinExtensions:fabric:1.0.0"))
implementation(include("com.github.thecatcore:WFVAIO:1.1.0"))
testImplementation "net.fabricmc:fabric-loader-junit:${project.loader_version}"
}
base {
archivesName = project.archives_base_name
}
processResources {
inputs.property "version", project.version
filesMatching("fabric.mod.json") {
expand "version": project.version
}
}
// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"
// if (JavaVersion.current().isJava9Compatible()) it.options.release = 8
}
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()
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
shadowJar {
configurations = [project.configurations.shadow]
exclude("META-INF")
relocate 'net.fabricmc.mappingio', 'fr.catcore.modremapperapi.impl.lib.mappingio'
relocate 'net.fabricmc.tinyremapper', 'fr.catcore.modremapperapi.impl.lib.tinyremapper'
relocate 'com.google.gson', 'fr.catcore.modremapperapi.impl.lib.gson'
}
jar {
from("LICENSE") {
rename { "${it}_${base.archivesName.get()}" }
}
}
remapJar {
// wait until the shadowJar is done
dependsOn(shadowJar)
mustRunAfter(shadowJar)
// Set the input jar for the task. Here use the shadow Jar that include the .class of the transitive dependency
inputFile = file(shadowJar.archivePath)
}
test {
useJUnitPlatform()
}
jacocoTestReport {
reports {
xml.required = true
html.outputLocation = layout.buildDirectory.dir('jacocoHtml')
}
}
sonar {
properties {
property "sonar.host.url", System.getenv("SONAR_URL")
property "sonar.token", System.getenv("SONAR_TOKEN")
}
}
// configure the maven publication
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
// select the repositories you want to publish to
repositories {
// uncomment to publish to the local maven
// mavenLocal()
}
}
modrinth {
token = System.getenv("MODRINTH_TOKEN")
projectId = "mod-remapping-api"
changelog = """
Support remapping mods from other namespaces than obfuscated/official.
"""
uploadFile = remapJar
dependencies {
embedded.version "spasm", project.spasm_version
}
}