-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild.gradle
197 lines (160 loc) · 5.1 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
185
186
187
188
189
190
191
192
193
194
195
196
197
plugins {
id 'maven-publish'
id 'net.neoforged.gradle.userdev' version '7.0.155'
id 'io.github.goooler.shadow' version '8.1.8'
id 'org.cadixdev.licenser' version '0.6.1'
id 'dev.sciwhiz12.gradle.simplversion' version '0.2.0'
}
versions {
stripPattern = /^\d+\.\d+(?:\.[\dx]+)?-/
}
version = versions.version
println "Mod version: $version"
sourceSets {
data
main.resources {
srcDirs += data.resources.srcDirs
exclude '.cache/'
}
}
java {
archivesBaseName = "${project.name}-${mc_version}"
toolchain.languageVersion = JavaLanguageVersion.of(java_version)
withSourcesJar()
}
print "Java: ${System.getProperty('java.version')}"
print ", JVM: ${System.getProperty('java.vm.version')} (${System.getProperty('java.vendor')})"
println ", Arch: ${System.getProperty('os.arch')}"
configurations {
dataImplementation.extendsFrom implementation
library
implementation.extendsFrom library
}
runs {
configureEach {
systemProperty 'forge.logging.markers', logging_markers
systemProperty 'forge.logging.console.level', logging_console
systemProperty 'forge.enabledGameTestNamespaces', modid
modSource project.sourceSets.main
dependencies {
runtime project.configurations.library
}
}
client {
}
server {
programArgument '--nogui'
}
gameTestServer {
}
data {
programArguments.addAll '--mod', modid, '--all'
programArguments.addAll '--output', sourceSets.data.resources.srcDirs[0].toString()
programArguments.addAll '--existing', sourceSets.main.resources.srcDirs[0].toString()
modSource project.sourceSets.data
}
}
repositories {
maven {
name 'm2-dv8tion'
url 'https://m2.dv8tion.net/releases'
}
}
dependencies {
implementation "net.neoforged:neoforge:${neoforge_version}"
library(group: 'net.dv8tion', name: 'JDA', version: jda_version) {
exclude module: 'opus-java'
exclude module: 'slf4j-api'
exclude module: 'annotations'
exclude module: 'jsr305'
}
dataImplementation sourceSets.main.output
}
license {
header = project.file('HEADER.txt')
}
var manifestAttributes = [
'Specification-Title' : modid,
'Specification-Vendor' : author,
'Specification-Version' : versions.rawVersion,
'Implementation-Title' : project.name,
'Implementation-Version': versions.version,
'Implementation-Vendor' : author,
"Git-Commit" : versions.fullCommitId,
"Git-Commit-Timestamp" : versions.commitTimestamp
] as LinkedHashMap
tasks.withType(Jar).configureEach {
manifest.attributes(manifestAttributes)
includeEmptyDirs false
preserveFileTimestamps = false
reproducibleFileOrder = true
// Normalize line endings from CRLF to LF
filesMatching('META-INF/neoforge.mods.toml') {
//noinspection UnnecessaryQualifiedReference
filter(org.apache.tools.ant.filters.FixCrLfFilter.class,
eol: org.apache.tools.ant.filters.FixCrLfFilter.CrLf.newInstance('lf'))
}
}
tasks.named('jar', Jar).configure {
archiveClassifier.set('lite')
}
@SuppressWarnings('GrMethodMayBeStatic')
def relocate(origin) {
shadowJar.relocate(origin, "dev.sciwhiz12.concord.shadow.$origin")
}
// noinspection UnnecessaryQualifiedReference
tasks.named('shadowJar', com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar).configure {
preserveFileTimestamps = false
reproducibleFileOrder = true
archiveClassifier.set('')
configurations = [ project.configurations.library ]
relocate 'com.iwebpp.crypto'
relocate 'org.json'
relocate 'net.sf.trove4j'
relocate 'gnu.trove'
relocate 'com.neovisionaries.ws.client'
relocate 'okio'
relocate 'okhttp3'
relocate 'kotlin'
relocate 'org.apache.commons.collections4'
relocate 'javax.annotation'
relocate 'com.fasterxml.jackson'
relocate 'net.dv8tion.jda'
relocate 'club.minnced.discord.webhook'
exclude 'META-INF/maven/**'
exclude 'META-INF/proguard/**'
exclude 'META-INF/services/**'
exclude 'META-INF/versions/9/module-info.class'
exclude 'META-INF/LICENSE*'
exclude 'META-INF/NOTICE*'
exclude 'module-info.class'
}
tasks.named('assemble') {
dependsOn shadowJar
}
tasks.named('javadoc', Javadoc).configure {
failOnError = false
options.addStringOption('Xdoclint:all,-missing', '-public')
options {
tags = [
'apiNote:a:<em>API Note:</em>',
'implSpec:a:<em>Implementation Requirements:</em>',
'implNote:a:<em>Implementation Note:</em>'
]
author = false
noSince = true
noHelp = true
}
}
publishing {
publications.create('mavenJava', MavenPublication) {
it.from components.java
it.version = "$mc_version-${versions.rawVersion}${versions.snapshot ? '-SNAPSHOT' : ''}"
}
repositories {
maven {
name 'projectLocal'
url "file://${project.file('repo').absolutePath}"
}
}
}