-
Notifications
You must be signed in to change notification settings - Fork 34
/
build.gradle
227 lines (205 loc) · 7.34 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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
import groovy.json.JsonOutput
plugins {
id 'java'
id 'maven-publish'
id 'signing'
id 'net.neoforged.gradle.userdev' version '7.0.97'
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
withSourcesJar()
withJavadocJar()
}
group = "io.codechicken"
base {
archivesName = 'EnderStorage'
}
sourceSets.main.resources.srcDirs += "src/main/generated"
mod_version = "${mod_version}." + (System.getenv("BUILD_NUMBER") ?: "1")
version = "${mc_version}-${mod_version}"
println "Starting build of ${base.archivesName.get()}, Version: ${mod_version}"
println "Using NeoForge: ${forge_version}, for Minecraft: ${mc_version}"
minecraft {
accessTransformers.file file("src/main/resources/META-INF/accesstransformer.cfg")
}
runs {
client {
workingDirectory file('run')
}
server {
workingDirectory file('run')
}
data {
workingDirectory file('run')
programArguments.addAll '--mod', 'enderstorage', '--all', '--output', file("src/main/generated"), '--existing', file("src/main/resources")
}
}
repositories {
mavenLocal()
maven { url = "https://chickenbones.net/maven" }
maven { url = "https://maven.blamejared.com/" }
}
dependencies {
implementation "net.neoforged:neoforge:${forge_version}"
implementation "io.codechicken:CodeChickenLib:${mc_version}-${ccl_version}"
implementation("mezz.jei:jei-${mc_version}-neoforge:${jei_version}") {
transitive false
}
}
processResources {
inputs.property 'mod_version', mod_version
inputs.property 'mc_version', mc_version
inputs.property 'ccl_version', ccl_version
filesMatching('META-INF/mods.toml') {
expand 'file': ['jarVersion': mod_version],
'mc_version': mc_version,
'forge_version': forge_version,
'lang_version': forge_version.split('\\.')[0],
'ccl_version_range': "[${ccl_version.replace(".+", "")},${ccl_version_max})"
}
}
def publishingMetadata = project.layout.buildDirectory.file("libs/${base.archivesName.get()}-$version-publishing.json")
def publishingMetadataTask = tasks.register("publishingMetadata") {
outputs.file(publishingMetadata)
doFirst {
publishingMetadata.get().asFile.text = JsonOutput.prettyPrint(JsonOutput.toJson([
[
'displayName' : "Ender Storage ${version}",
'mcVersion' : "${mc_version}",
'version' : "${mod_version}",
'classifier' : null,
'modLoader' : 'neoforge',
'curseforgeId': '245174',
'modrinthId' : 'BbrHg80P',
'dependencies': [
[
'modId' : 'codechickenlib',
'type' : 'required',
'modrinthId' : '2gq0ALnz',
'curseforgeId': 'codechicken-lib-1-8'
]
]
]
]))
}
}
jar {
finalizedBy 'signJar'
manifest {
attributes 'Specification-Title': base.archivesName.get()
attributes 'Specification-Vendor': 'covers1624'
attributes 'Specification-Version': "1"
attributes 'Implementation-Title': base.archivesName.get()
attributes 'Implementation-Vendor': 'covers1624'
attributes 'Implementation-Version': version
attributes 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
}
from file("LICENSE.txt")
}
tasks.register("signJar") {
dependsOn("jar")
doFirst {
def args = [:]
args['jar'] = jar.archiveFile.get().asFile
if (System.getenv("KEY_STORE")) {
args['keyStore'] = System.getenv("KEY_STORE")
file(System.getenv("KEY_STORE_PROPS")).withReader {
def props = new Properties()
props.load(it)
args.putAll(props)
}
} else if (project.hasProperty('keyStore')) {
args['keyStore'] = project.getProperty('keyStore')
args['alias'] = project.getProperty('keyStoreAlias')
args['storePass'] = project.getProperty('keyStorePass')
args['keyPass'] = project.getProperty('keyStoreKeyPass')
} else {
println "No signing properties."
state.setOutcome(org.gradle.api.internal.tasks.TaskExecutionOutcome.UP_TO_DATE)
didWork = false
return
}
project.ant.invokeMethod('signjar', args)
}
}
javadoc {
options.addBooleanOption("Xdoclint:none", true)
}
publishing {
repositories {
if (System.getenv('MAVEN_PASS')) {
maven {
url "https://nexus.covers1624.net/repository/maven-releases/"
credentials {
username 'covers1624'
password System.getenv('MAVEN_PASS')
}
}
}
}
publications {
EnderStorage(MavenPublication) {
groupId project.group
artifactId project.base.archivesName.get()
version project.version
artifact jar
artifact sourcesJar
artifact javadocJar
artifact(publishingMetadata) {
builtBy publishingMetadataTask
classifier 'publishing'
}
pom {
name = base.archivesName.get()
description = base.archivesName.get()
url = "https://github.com/TheCBProject/${base.archivesName.get()}"
scm {
url = "https://github.com/TheCBProject/${base.archivesName.get()}"
connection = "scm:git:git://github.com/TheCBProject/${base.archivesName.get()}.git"
connection = "scm:git:[email protected]:TheCBProject/${base.archivesName.get()}.git"
}
issueManagement {
system = 'github'
url = "https://github.com/TheCBProject/${base.archivesName.get()}/issues"
}
licenses {
license {
name = "MIT"
url = "https://raw.githubusercontent.com/TheCBProject/EnderStorage/master/LICENSE.txt"
distribution = 'repo'
}
}
developers {
developer {
id = 'covers1624'
name = 'covers1624'
}
}
developers {
developer {
id = 'chicken-bones'
name = 'chicken-bones'
}
}
}
}
}
}
signing {
if (System.getenv('GPG_PRIVATE_KEY')) {
useInMemoryPgpKeys(
new File(System.getenv('GPG_PRIVATE_KEY')).text,
System.getenv('GPG_PRIVATE_KEY_PASS')
)
} else if (project.hasProperty('gpgPrivateKey')) {
useInMemoryPgpKeys(
new File(project.getProperty('gpgPrivateKey')).text,
project.getProperty('gpgPrivateKeyPass')
)
} else {
return
}
sign publishing.publications.EnderStorage
}