forked from Wynntils/Wynntils
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
147 lines (130 loc) · 5.01 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
plugins {
id "architectury-plugin" version "${architectury_plugin_version}"
id "dev.architectury.loom" version "${architectury_loom_version}" apply false
id "com.diffplug.spotless" version "${spotless_version}"
}
architectury {
minecraft = minecraft_version
}
// Add "wynntils.hotswap=true" to your personal gradle properties file to use hotswap.
// By default, this is C:\Users\<your username>\.gradle\gradle.properties on Windows
// or ~/.gradle/gradle.properties on Linux/MacOS.
def usingHotswapAgent = project.hasProperty("wynntils.hotswap") ? project.getProperty("wynntils.hotswap") == "true" : false
// On the release branches, this string will be automatically updated by the bots
// Do not change this in the main branch!
version = "2.0.0-SNAPSHOT"
subprojects {
apply plugin: "dev.architectury.loom"
repositories {
maven { url = "https://pkgs.dev.azure.com/djtheredstoner/DevAuth/_packaging/public/maven/v1" }
maven { url = "https://jitpack.io" }
}
loom {
silentMojangMappingsLicense()
accessWidenerPath = file("src/main/resources/wynntils.accessWidener")
runs {
client {
property("devauth.configDir", getRootProject().file(".devauth").absolutePath)
if (usingHotswapAgent) {
vmArgs "-XX:+AllowEnhancedClassRedefinition"
// https://youtrack.jetbrains.com/issue/JBR-7351/JVM-CodeCache-will-not-be-cleaned-using-G1GC-if-Hotswap-Agent-is-enabled-since-JBR-6419-jbr21.351
vmArgs "-XX:+ClassUnloading"
vmArgs "-XX:HotswapAgent=fatjar"
}
vmArgs "-ea" // run dev builds with asserts
client()
}
}
}
dependencies {
minecraft "com.mojang:minecraft:${minecraft_version}"
mappings loom.layered() {
officialMojangMappings()
parchment("org.parchmentmc.data:parchment-${parchment_version}@zip")
}
}
}
allprojects {
apply plugin: "java"
apply plugin: "architectury-plugin"
apply plugin: "com.diffplug.spotless"
base {
archivesName = archives_base_name
}
version = rootProject.version
repositories {
maven { url "https://maven.parchmentmc.org/" }
maven { url "https://jitpack.io" }
}
tasks.withType(JavaCompile).configureEach {
options.encoding = "UTF-8"
}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(java_version))
}
withSourcesJar()
}
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.")
}
}
custom "Refuse IntelliJ annotations", {
if (it =~ /\nimport org\.jetbrains\.annotations\./) {
throw new AssertionError("Do not use IntelliJ annotations. 'spotlessApply' cannot resolve this issue.")
}
}
custom "No empty line after opening curly brace", {
it.replaceAll(/\{\n\n/, '{\n')
}
licenseHeader("/*\n" +
" * Copyright © Wynntils \$YEAR.\n" +
" * This file is released under LGPLv3. See LICENSE for full license details.\n" +
" */")
.updateYearWithLatest(true)
}
json {
target "src/**/*.json"
// schemaVersion must be at the top or else Fabric will complain
targetExclude("src/main/resources/fabric.mod.json")
gson()
.indentWithSpaces(2)
.sortByKeys()
.version(spotless_gson_version)
trimTrailingWhitespace()
endWithNewline()
}
format "lang", {
target "src/main/resources/assets/wynntils/lang/*.json"
custom "No empty language json files", {
it.replaceAll(/^\{\}\n$/, '')
}
}
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()
}
}
}