forked from CoFH/Ensorcellation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
194 lines (170 loc) · 6.19 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
plugins {
id 'java'
id 'maven-publish'
id 'com.matthewprenger.cursegradle' version '1.4.0'
id 'com.modrinth.minotaur' version "2.+"
id 'net.covers1624.signing' version '1.1.4'
id 'net.minecraftforge.gradle' version '5.1.+'
id 'org.spongepowered.mixin' version '0.7-SNAPSHOT'
}
java.toolchain.languageVersion = JavaLanguageVersion.of("${java_version}")
sourceSets.main.resources.srcDirs += "src/main/generated"
group = 'com.teamcofh'
archivesBaseName = "${mod_id}"
def buildVersion = "${mod_version}." + (System.getenv("BUILD_NUMBER") ?: '0')
version = "${mc_version}-${buildVersion}"
def signProps = [:]
if (System.getenv('KEY_STORE')) {
println 'Using Env variables for jar signing.'
signProps['keyStore'] = System.getenv('KEY_STORE')
file(System.getenv('KEY_STORE_PROPS')).withReader {
def props = new Properties()
props.load(it)
signProps.putAll(props)
}
} else if (project.hasProperty('keyStore')) {
println 'Using Project properties for jar signing.'
signProps['keyStore'] = project.getProperty('keyStore')
signProps['storePass'] = project.getProperty('keyStorePass')
signProps['alias'] = project.getProperty('keyStoreAlias')
signProps['keyPass'] = project.getProperty('keyStoreKeyPass')
} else {
println 'No signing secrets found, build will not be signed.'
}
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 = '349447'
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 = 'ImlP9deQ'
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}"]
}
}
minecraft {
mappings channel: 'official', version: "${mc_version}"
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
}
processResources {
filesMatching('META-INF/mods.toml') {
expand 'file': ['jarVersion': mod_version],
'mc_version': mc_version,
'forge_version': forge_version,
'forge_major_version': forge_version.split('\\.')[0],
'cofh_core_version': cofh_core_version,
'cofh_core_max_version': cofh_core_max_version
}
}
configurations {
annotationProcessor.extendsFrom minecraft
}
repositories {
mavenLocal()
maven { url 'https://maven.covers1624.net/' }
maven { url 'https://maven.tterrag.com/' }
maven { url 'https://dvs1.progwml6.com/files/maven/' }
maven { url 'https://maven.blamejared.com/' }
maven { url 'https://maven.theillusivec4.top/' }
}
dependencies {
minecraft "net.minecraftforge:forge:${mc_version}-${forge_version}"
implementation fg.deobf("com.teamcofh:cofh_core:${mc_version}-${cofh_core_version}.+")
}
signing {
if (!signProps.isEmpty()) {
jars {
sign jar
after 'reobfJar'
keyStore = signProps.keyStore
alias = signProps.alias
storePass = signProps.storePass
keyPass = signProps.keyPass
}
}
}
jar {
manifest {
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")
])
}
}
task srcJar(type: Jar) {
build.dependsOn it
from sourceSets.main.allSource
classifier = 'sources'
}
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 srcJar
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'
}
}
}
}
}
}