-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
build.gradle
138 lines (108 loc) · 3.4 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
plugins {
id 'eclipse'
id 'maven-publish'
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'net.neoforged.gradle' version '[6.0.18,6.2)'
id 'org.parchmentmc.librarian.forgegradle' version '1.+'
}
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
ext.early = true
apply from: 'project.gradle'
project.ext.package = project.ext.group + '.' + project.ext.projectName.toLowerCase()
if (project.ext.useElytraVersionFormat) {
def branch
if (System.env.BRANCH_NAME) {
// Jenkins support
branch = System.env.BRANCH_NAME
branch = branch.substring(branch.lastIndexOf('/') + 1)
} else {
branch = 'git rev-parse --abbrev-ref HEAD'.execute().in.text.trim()
}
if (branch == "HEAD") {
branch = 'git rev-parse --short HEAD'.execute().in.text.trim()
}
def commits = 'git rev-list --count HEAD'.execute().in.text.trim()
def dirty = !'git diff-index HEAD'.execute().in.text.trim().isEmpty()
version = branch + '-' + project.ext.version + '.' + commits + (dirty ? '-dirty' : '')
} else {
version = project.ext.version
}
group = project.ext.group
archivesBaseName = project.ext.projectName
ext {
compoundClassesDir = file('build/compound')
}
configurations {
shade
}
repositories {
maven { url = 'https://repo.tridevmc.com/' }
}
minecraft {
mappings channel: project.ext.mappingsChannel, version: project.ext.mappingsVersion
runs {
client {
workingDirectory project.file('run')
// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'REGISTRIES'
// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'
mods {
mainMod {
source sourceSets.main
}
}
}
server {
workingDirectory project.file('run')
// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'REGISTRIES'
// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'
mods {
mainMod {
source sourceSets.main
}
}
}
}
}
dependencies {
minecraft "net.neoforged:forge:${project.ext.forge}"
}
jar.finalizedBy('reobfJar')
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
}
def needsShadow = !project.ext.compoundModules.isEmpty()
if (needsShadow) {
dependencies {
for (String module : project.ext.compoundModules) {
def moduleIdentifier = 'com.tridevmc.compound:compound-' + module + ':' + project.ext.compoundVersion
implementation(moduleIdentifier)
shade(moduleIdentifier)
}
}
tasks.build.dependsOn shadowJar
artifacts {
archives shadowJar
}
jar {
archiveClassifier = 'slim'
}
shadowJar {
configurations = [project.configurations.shade]
relocate 'com.tridevmc.compound', project.ext.projectPackage + '.com.tridevmc.compound'
finalizedBy 'reobfShadowJar'
}
assemble.dependsOn shadowJar
reobf {
shadowJar {}
}
}
ext.early = false
apply from: 'project.gradle'
if (file('private.gradle').exists()) {
apply plugin: 'maven-publish'
apply from: 'private.gradle'
}