-
Notifications
You must be signed in to change notification settings - Fork 10
/
build.gradle
180 lines (159 loc) · 5.81 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
plugins {
id 'java'
id 'maven-publish'
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 = '70631'
changelogType = 'markdown'
changelog = "[Changelog on GitHub - ${version}](https://raw.githubusercontent.com/cofh/version/main/${mod_id}/changelog.md)"
releaseType = "${release_type}"
mainArtifact(jar)
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 = 'KfkTLdPl'
versionNumber = "${mod_version}"
versionType = "${release_type}"
changelog = "[Changelog on GitHub - ${version}](https://raw.githubusercontent.com/cofh/version/main/${mod_id}/changelog.md)"
uploadFile = jar
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})"
}
}
repositories {
mavenLocal()
maven { url 'https://maven.covers1624.net/' }
maven { url 'https://maven.blamejared.com/' }
}
dependencies {
implementation("net.neoforged:neoforge:${neo_version}")
implementation "com.teamcofh:cofh_core:${mc_version}-${cofh_core_version}+"
}
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")
])
}
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.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 jar
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'
}
}
}
}
}
}