-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild.gradle
102 lines (83 loc) · 3.36 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
plugins {
id 'java'
id 'net.minecraftforge.gradle.forge' version 'f2c5bb338e'
id 'com.github.johnrengelman.shadow' version '6.1.0'
id "io.freefair.lombok" version "6.0.0-m2"
}
version = project.version
group= "me.mini_bomba" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
// Get HEAD's git hash
def gitHash = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-parse', '--short=8', 'HEAD'
standardOutput = gitHash
}
gitHash = gitHash.toString().trim()
minecraft {
version = "${project.minecraftVersion}-${project.forgeVersion}"
runDir = "run"
mappings = project.mappings
replace("@VERSION@": project.version)
replace("@GIT_HASH@": gitHash)
replace("@PRERELEASE@": !project.hasProperty("release") || project.release != "true")
replaceIn("${project.modName}.java")
}
dependencies {
implementation group: 'com.github.twitch4j', name: 'twitch4j', version: '1.18.0'
implementation 'com.github.ben-manes.caffeine:caffeine:2.9.3' // Cannot upgrade to 3.0.6 as we use java 8
// implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.12.3'
}
jar {
// If the prerelease property is set to true, use git hash instead of project version in output file names
if (project.hasProperty("release") && project.release == "true") {
archiveFileName = "${project.modName}-v${project.version}-for-${project.minecraftVersion}.jar"
} else {
archiveFileName = "${project.modName}-git_${gitHash}-for-${project.minecraftVersion}.jar"
}
manifest.attributes(
'Manifest-Version': '2.0',
'Main-Class': 'ThisDoesntExistAnyway',
'Implementation-Title': project.name,
'Implementation-Version': project.version,
'Implementation-Vendor': 'mini-bomba',
'Specification-Title': project.name,
'Specification-Vendor': 'mini-bomba',
'Specification-Version': project.version,
'FMLCorePlugin': "${project.group}.${project.modId}.asm.LoadingPlugin",
'ForceLoadAsMod': true,
'FMLCorePluginContainsFMLMod': true,
'ModSide': 'CLIENT',
'FMLAT': "${project.modId}_at.cfg"
)
// Disable the default jar task and use shadowJar instead to shade the libraries into the jar.
enabled = false
}
shadowJar {
archiveFileName = jar.archiveFileName
relocate 'org.apache.commons', 'org.StreamChatMod.apache.commons'
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
exclude('dummyThing')
exclude('META-INF/maven/')
exclude('META-INF/nar/')
exclude('module-info.class')
exclude('META-INF/versions/')
}
processResources
{
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
// replace version and mcversion
expand 'version':project.version, 'mcversion':project.minecraft.version
}
// copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}
project.sourceCompatibility = '1.8'
project.targetCompatibility = '1.8'
tasks.reobfJar.dependsOn(tasks.shadowJar)