-
-
Notifications
You must be signed in to change notification settings - Fork 238
/
build.gradle
184 lines (159 loc) · 5.89 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
import dev.architectury.pack200.java.Pack200Adapter
import java.text.NumberFormat
import java.text.ParseException
plugins {
id 'java'
id 'gg.essential.loom' version '0.10.0.5'
id 'dev.architectury.architectury-pack200' version '0.1.3'
id 'io.freefair.lombok' version "6.6.1"
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'net.kyori.blossom' version '1.3.1'
}
group = 'codes.biscuit'
ext {
formattedBuildNumber = ''
includeRunAttempt = false
modId = project.name.toLowerCase(Locale.US)
}
java {
toolchain.languageVersion.set(JavaLanguageVersion.of(8))
}
blossom {
def modVersion = project.version
if (project.hasProperty('runningOnCi')) {
if (!project.hasProperty('buildNumber')) {
throw new InvalidUserDataException('No build number provided for CI build.')
} else if (!project.hasProperty('runAttempt')) {
throw new InvalidUserDataException('No run attempt provided for CI build.')
} else {
def nf = NumberFormat.getIntegerInstance(Locale.US)
def buildNumber = project.property('buildNumber')
def runAttempt = project.property('runAttempt')
includeRunAttempt = nf.parse(runAttempt as String) > 1
try {
if (includeRunAttempt) {
project.setProperty('buildNumber', "${buildNumber}.${nf.parse(runAttempt as String) - 1}")
}
formattedBuildNumber = nf.format(nf.parse(project.property('buildNumber') as String))
project.version = "${project.version}+" + project.property('buildNumber')
} catch (ParseException e) {
throw new InvalidUserDataException("Build number could not be parsed (${e.message})", e)
}
}
}
replaceTokenIn('src/main/java/codes/biscuit/skyblockaddons/SkyblockAddons.java')
replaceToken('@VERSION@', modVersion)
replaceToken('@MOD_ACCEPTED@', project.minecraftVersion)
replaceToken('@BUILD_NUMBER@', project.buildNumber)
}
loom {
//noinspection GroovyAssignabilityCheck
launchConfigs {
"client" {
property('fml.coreMods.load', 'codes.biscuit.skyblockaddons.tweaker.SkyblockAddonsLoadingPlugin')
property('devauth.enabled', 'true')
}
}
// Change this to one of the other log configs if desired
log4jConfigs.from(file('log-config.xml'))
forge {
pack200Provider.set(new Pack200Adapter())
accessTransformer('src/main/resources/META-INF/skyblockaddons_at.cfg')
}
}
sourceSets {
main {
// Forge needs resources to be in the same directory as the classes.
output.resourcesDir = java.classesDirectory
}
}
configurations.create('bundle')
configurations.implementation.extendsFrom(configurations.named('bundle').get())
repositories {
mavenCentral()
maven {
name 'JitPack'
url 'https://jitpack.io'
}
maven {
name 'DevAuth'
url 'https://pkgs.dev.azure.com/djtheredstoner/DevAuth/_packaging/public/maven/v1'
}
}
dependencies {
minecraft("com.mojang:minecraft:${project.minecraftVersion}")
mappings("de.oceanlabs.mcp:mcp_stable:${project.mappings}")
forge("net.minecraftforge:forge:${project.forgeVersion}")
runtimeOnly('me.djtheredstoner:DevAuth-forge-legacy:1.1.0')
// Discord RPC for Java https://github.com/jagrosh/DiscordIPC
bundle('com.github.ILikePlayingGames:DiscordIPC:-SNAPSHOT') {
exclude module: 'log4j'
because 'Different version conflicts with Minecraft\'s Log4J'
exclude module: 'gson'
because 'Different version conflicts with Minecraft\'s GSON'
}
bundle('com.github.BiscuitDevelopment:HypixelLocalizationLib:7122472085') {
exclude module: 'gson'
because 'Different version conflicts with Minecraft\'s GSON'
}
testImplementation('org.junit.jupiter:junit-jupiter:5.9.1')
}
tasks.withType(JavaCompile).configureEach {
options.compilerArgs << '-Xlint:unchecked' << '-Xlint:deprecation'
options.encoding = 'UTF-8'
}
tasks.register('copyLicenses', Copy) {
from(project.projectDir) {
include('LICENSE')
include('NOTICE')
include('dependencyLicenses/**')
}
into(sourceSets.main.output.resourcesDir)
}
jar {
manifest.attributes(
'Manifest-Version': '2.0',
'Main-Class': 'SkyblockAddonsInstallerFrame',
'Implementation-Title': project.name,
'Implementation-Version': project.version,
'Implementation-Vendor' : 'BiscuitDevelopment',
'Specification-Title': project.name,
'Specification-Vendor': 'BiscuitDevelopment',
'Specification-Version': project.version,
'FMLCorePlugin': "${project.group}.${modId}.tweaker.${project.name}LoadingPlugin",
'ForceLoadAsMod': true,
'FMLCorePluginContainsFMLMod': true,
'ModSide': 'CLIENT',
'FMLAT': "${modId}_at.cfg"
)
}
remapJar {
from(tasks.shadowJar)
input.set(tasks.shadowJar.archiveFile.get())
archiveFileName = "${project.name}-${project.version}-for-MC-${project.minecraftVersion}.jar"
}
processResources {
dependsOn tasks.copyLicenses
inputs.property 'version', project.version
inputs.property 'mcversion', project.minecraftVersion
// replace stuff in mcmod.info, nothing else
filesMatching('mcmod.info') {
// replace version and mcversion
expand('version': project.version, 'mcversion': project.minecraftVersion)
}
}
shadowJar {
configurations = [project.configurations.bundle]
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
exclude('dummyThing')
exclude('module-info.class')
exclude('META-INF/versions/')
// Relocate Discord RPC into the main codebase
relocate 'com.jagrosh.discordipc', 'shadow.discordipc'
}
test {
useJUnitPlatform()
testLogging {
events 'passed', 'skipped', 'failed'
}
}