-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathbuild.gradle
148 lines (127 loc) · 4.79 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
plugins {
id 'fabric-loom' version '1.7-SNAPSHOT'
id "com.diffplug.spotless" version "${spotless_version}"
}
base {
archivesName = project.mod_name.replaceAll("\\s", "-") + "-fabric"
}
group = project.maven_group
// On the release branches, this string will be automatically updated by the bots
// Do not change this in the main branch!
version = "1.0.0-SNAPSHOT"
repositories {
maven { url "https://pkgs.dev.azure.com/djtheredstoner/DevAuth/_packaging/public/maven/v1" }
maven { url "https://maven.shedaniel.me/" }
maven { url "https://maven.terraformersmc.com/releases/" }
maven { url "https://maven.parchmentmc.org/" }
}
allprojects {
apply plugin: "com.diffplug.spotless"
spotless {
java {
// define the steps to apply to Java source code
importOrder()
removeUnusedImports()
palantirJavaFormat(spotless_palantir_version)
trimTrailingWhitespace()
endWithNewline()
ratchetFrom('origin/main')
// Custom rule from https://github.com/apache/geode
custom "Refuse wildcard imports", {
if (it =~ /\nimport .*\*;/) {
throw new AssertionError("Do not use wildcard imports. 'spotlessApply' cannot resolve this issue.")
}
} as Closure<String>
custom "Refuse IntelliJ annotations", {
if (it =~ /\nimport org\.jetbrains\.annotations\./) {
throw new AssertionError("Do not use IntelliJ annotations. 'spotlessApply' cannot resolve this issue.")
}
} as Closure<String>
custom "No empty line after opening curly brace", {
it.replaceAll(/\{\n\n/, '{\n')
}
licenseHeader("/*\n" +
" * Copyright © Team-VoW \$YEAR.\n" +
" * This file is released under AGPLv3. See LICENSE for full license details.\n" +
" */")
.updateYearWithLatest(true)
}
json {
target "src/**/*.json"
targetExclude "src/**/sound_info.json", "src/**/sounds.json"
gson()
.indentWithSpaces(2)
.sortByKeys()
.version(spotless_gson_version)
trimTrailingWhitespace()
endWithNewline()
}
groovyGradle {
target '**/*.gradle'
greclipse("${spotless_greclipse_version}").configFile("${rootDir}/greclipse.properties")
trimTrailingWhitespace()
endWithNewline()
}
format "misc", {
// define the files to apply `misc` to
target "*.gradle", "*.md", ".gitignore", "*.properties"
targetExclude("CHANGELOG.md")
// define the steps to apply to those files
trimTrailingWhitespace()
indentWithSpaces()
endWithNewline()
}
}
}
dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings loom.layered() {
officialMojangMappings()
parchment("org.parchmentmc.data:parchment-${project.parchment_version}@zip")
}
modImplementation "net.fabricmc:fabric-loader:${project.fabric_loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}+${project.minecraft_version}"
// Development dependencies
modRuntimeOnly "me.djtheredstoner:DevAuth-fabric:${project.devauth_version}"
// Optional dependencies
modApi("me.shedaniel.cloth:cloth-config-fabric:${cloth_config_version}") {
exclude(group: "net.fabricmc.fabric-loader")
exclude(group: "net.fabricmc.fabric-api")
}
modApi("com.terraformersmc:modmenu:${mod_menu_version}") {
exclude(group: "net.fabricmc.fabric-loader")
exclude(group: "net.fabricmc.fabric-api")
}
}
processResources {
var replaceProperties = [
mod_version : version,
mod_id : maven_group,
mod_name : mod_name,
minecraft_version_range : minecraft_version_range,
fabric_loader_version : fabric_loader_version,
fabric_api_version : fabric_api_version,
cloth_config_version : cloth_config_version,
]
inputs.properties replaceProperties
filesMatching("fabric.mod.json") {
expand replaceProperties
}
}
tasks.withType(JavaCompile).configureEach {
it.options.release = 21
options.encoding = 'UTF-8'
}
java {
withSourcesJar()
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
remapJar {
archiveClassifier = "fabric+MC-${minecraft_version}"
}
jar {
from("LICENSE") {
rename { "${it}_${base.archivesName.get()}"}
}
}