forked from constellation-mc/Linkart
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
189 lines (161 loc) · 5.29 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
import com.github.spotbugs.snom.SpotBugsTask
plugins {
id 'fabric-loom' version '1.9-SNAPSHOT'
id 'maven-publish'
id 'io.freefair.lombok' version '8.6'
id 'com.github.spotbugs-base' version '6.0.14'
//id 'com.diffplug.spotless' version '6.25.0'
id 'me.modmuss50.mod-publish-plugin' version "0.5.1"
}
def mcVersion = stonecutter.current.version
version = "${project.mod_version}-$mcVersion"
group = project.maven_group
repositories {
mavenCentral()
maven {
url = "https://api.modrinth.com/maven"
}
}
dependencies {
// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${stonecutter.current.project}"
mappings "net.fabricmc:yarn:${property('yarn_mappings')}:v2"
modImplementation "net.fabricmc:fabric-loader:${property('fabric_loader')}"
// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${property('fabric_api')}"
modImplementation include ("maven.modrinth:midnightlib:${project.midnightlib_version}")
}
base {
archivesName = "linkart-refabricated"
}
tasks.register("spotbugs", SpotBugsTask) { task ->
sourceSets.each {
task.sourceDirs.from(task.sourceDirs.files, it.allSource.sourceDirectories)
task.classDirs.from(task.classDirs.files, it.output)
task.auxClassPaths.from(task.auxClassPaths.files, it.compileClasspath)
}
excludeFilter = file("spotbugs.xml")
ignoreFailures = true
reports {
if (local) {
html {
required = true
outputLocation = file("$buildDir/reports/spotbugs/main/spotbugs.html")
stylesheet = 'fancy-hist.xsl'
}
} else {
sarif {
required = true
outputLocation = file("$buildDir/reports/spotbugs/main/spotbugs.sarif")
}
}
}
}
/*spotless {
java {
removeUnusedImports()
trimTrailingWhitespace()
formatAnnotations()
importOrder('', 'java|javax', '\\#')
}
}*/
processResources {
inputs.property "minecraft", mcVersion
inputs.property "version", mod_version
inputs.property "loader_version", fabric_loader
def map = [
"minecraft": mcVersion,
"version": mod_version,
"loader_version": fabric_loader
]
filesMatching("fabric.mod.json") {
expand map
}
}
loom {
runConfigs.all {
ideConfigGenerated true // Run configurations are not created for subprojects by default
runDir "../../run" // Use a shared run folder and create separate worlds
}
}
def targetJavaVersion = 17
tasks.withType(JavaCompile).configureEach {
// 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
// If Javadoc is generated, this must be specified in that task too.
it.options.encoding = "UTF-8"
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
it.options.release = targetJavaVersion
}
}
java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
withSourcesJar()
}
jar {
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}" }
}
}
sourcesJar {
exclude {
sourceSets.main.allSource.contains it.file
}
from delombok
}
/*
// configure the maven publication
publishing {
publications {
mavenJava(MavenPublication) {
artifactId 'linkart'
from components.java
}
}
repositories {
maven {
name = "GitHubPackages"
url = "https://maven.pkg.github.com/constellation-mc/Linkart"
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}
publishMods {
file = remapJar.archiveFile
additionalFiles.from(remapSourcesJar.archiveFile)
changelog = file("CHANGELOG.md").text
type = ReleaseType.valueOf(providers.environmentVariable("VERSION_TYPE").getOrElse("BETA"))
modLoaders.add("fabric")
displayName = "${project.mod_version} (${project.minecraft_version})"
modrinth {
projectId = "sc4Mu9Zu"
accessToken = providers.environmentVariable("MODRINTH_TOKEN")
minecraftVersions.add("${project.minecraft_version}")
minecraftVersions.add("1.21")
requires("fabric-api")
embeds("midnightlib")
}
curseforge {
projectId = "622736"
accessToken = providers.environmentVariable("CURSEFORGE_TOKEN")
minecraftVersions.add("${project.minecraft_version}")
minecraftVersions.add("1.21")
requires("fabric-api")
embeds("midnightlib")
}
github {
repository = "constellation-mc/Linkart"
accessToken = providers.environmentVariable("GITHUB_TOKEN")
commitish = providers.environmentVariable("GITHUB_SHA").getOrElse("${project.minecraft_version}-fabric")
type = STABLE
}
dryRun = local
}
*/