-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.gradle
211 lines (182 loc) · 6.71 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
plugins {
id 'java'
id 'maven-publish'
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'com.matthewprenger.cursegradle' version '1.4.0'
id 'com.modrinth.minotaur' version "2.+"
id 'net.neoforged.gradle.userdev' version '7.0.97'
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
withSourcesJar()
// withJavadocJar()
}
sourceSets.main.resources.srcDirs += "src/main/generated"
group = 'com.teamcofh'
base {
archivesName = "${mod_id}"
}
def buildVersion = "${mod_version}." + (System.getenv("BUILD_NUMBER") ?: '0')
version = "${mc_version}-${buildVersion}"
println "Starting build of ${archivesBaseName}, Version: ${mod_version}"
println "Using NeoForge: ${neo_version}, for Minecraft: ${mc_version}"
minecraft {
accessTransformers.file file("src/main/resources/META-INF/accesstransformer.cfg")
}
if (System.getenv('CURSEFORGE_KEY') || project.hasProperty('curseforgeKey')) {
println "Enabling CurseForge config."
tasks.named('curseforge').configure { dependsOn(jar) }
curseforge {
apiKey = System.getenv("CURSEFORGE_KEY") ?: project.findProperty("curseforgeKey")
project {
id = '227443'
changelogType = 'markdown'
changelog = "[Changelog on GitHub - ${version}](https://raw.githubusercontent.com/cofh/version/main/${mod_id}/changelog.md)"
releaseType = "${release_type}"
mainArtifact(shadowJar)
addGameVersion "Java ${java_version}"
addGameVersion "${mc_version}"
}
}
}
if (System.getenv('MODRINTH_TOKEN') || project.hasProperty('modrinthToken')) {
println "Enabling Modrinth config."
tasks.named('modrinth').configure { dependsOn(jar) }
modrinth {
token = System.getenv("MODRINTH_TOKEN") ?: project.findProperty("modrinthToken")
projectId = 't8bmWGI2'
versionNumber = "${mod_version}"
versionType = "${release_type}"
changelog = "[Changelog on GitHub - ${version}](https://raw.githubusercontent.com/cofh/version/main/${mod_id}/changelog.md)"
uploadFile = shadowJar
gameVersions = ["${mc_version}"]
}
}
processResources {
filesMatching('META-INF/mods.toml') {
expand 'file': ['jarVersion': mod_version],
'mc_version': mc_version,
'neo_version': neo_version,
'lang_version': neo_version.split('\\.')[0],
'cofh_core_version_range': "[${cofh_core_version.replace(".+", "")},${cofh_core_max_version})",
'thermal_core_version_range': "[${thermal_core_version.replace(".+", "")},${thermal_core_max_version})"
}
}
configurations {
shadow
implementation.extendsFrom shadow
}
repositories {
mavenLocal()
maven { url 'https://maven.covers1624.net/' }
maven { url 'https://maven.blamejared.com/' }
maven { url 'https://maven.theillusivec4.top/' }
}
dependencies {
implementation("net.neoforged:neoforge:${neo_version}")
implementation("com.teamcofh:cofh_core:${mc_version}-${cofh_core_version}+")
implementation("com.teamcofh:thermal_core:${mc_version}-${thermal_core_version}+")
shadow("net.covers1624:Quack:0.4.10.105")
compileOnly("org.jetbrains:annotations:22.0.0")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.2")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.8.2")
}
test {
useJUnitPlatform()
}
def commonManifest = {
attributes([
'Specification-Title' : "${mod_name}",
'Specification-Vendor' : 'Team CoFH',
'Specification-Version' : "${mc_version}",
'Implementation-Title' : "${mod_id}",
'Implementation-Vendor' : 'Team CoFH',
'Implementation-Version' : "${mod_version}",
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
jar.enabled = false
shadowJar {
finalizedBy 'signShadowJar'
archiveClassifier = 'universal'
manifest commonManifest
configurations = [project.configurations.shadow]
relocate 'net.covers1624.quack', 'cofh.requack'
}
tasks.register("signShadowJar") {
dependsOn("shadowJar")
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.addAll(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)
}
}
publishing {
repositories {
if (System.getenv('MAVEN_PASS')) {
maven {
url 'https://nexus.covers1624.net/repository/cofh-releases/'
credentials {
username 'kinglemming'
password System.getenv('MAVEN_PASS')
}
}
}
}
publications {
mod(MavenPublication) {
groupId project.group
artifactId project.archivesBaseName
version project.version
artifact shadowJar
artifact sourcesJar
pom {
name = archivesBaseName
description = archivesBaseName
url = "https://github.com/CoFH/${project.name}"
scm {
url = "https://github.com/CoFH/${project.name}"
connection = "scm:git:git://github.com/CoFH/${project.name}.git"
connection = "scm:git:[email protected]:CoFH/${project.name}.git"
}
issueManagement {
system = 'discord'
url = 'https://discord.gg/uRKrnbH'
}
licenses {
license {
name = 'Don\'t Be a Jerk v2'
url = "https://github.com/CoFH/${project.name}/blob/main/README.md"
distribution = 'repo'
}
}
developers {
developer {
id = 'teamcofh'
name = 'Team CoFH'
}
}
}
}
}
}