-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
259 lines (222 loc) · 8.53 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
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
import net.darkhax.curseforgegradle.TaskPublishCurseForge
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.30.0")
}
}
plugins {
id 'java'
id 'eclipse'
id "com.diffplug.spotless" version "6.10.0"
id 'net.minecraftforge.gradle' version '[6.0.16,6.2)'
id 'net.darkhax.curseforgegradle' version '1.1.17'
id 'org.parchmentmc.librarian.forgegradle' version '1.+'
}
apply plugin: 'io.codearte.nexus-staging'
apply plugin: 'maven-publish'
apply plugin: 'signing'
project.version = modVersion
project.group = 'io.github.realyusufismail'
base.archivesName.set('realyusufismailcore')
description = "RealYusuf Ismail's Core. The main library for all my Minecraft mod."
final var mcVersion = mcVersion
final var projectId = projectId
ext {
dev_id = 'yusuf'
dev_name = 'Yusuf Ismail'
dev_email = 'ysufgamer222@gmail.com'
dev_organization = 'Real Yusuf Ismail'
dev_organizationUrl = 'https://github.com/RealYusufIsmail/RealYusufIsmail-Core'
gpl_name = 'Apache License 2.0'
gpl_url = 'https://github.com/RealYusufIsmail-Mc-Mods/RealYusufIsmail-Core/blob/main/LICENSE'
// Make sure we have a default for initial configuration evaluation
isReleaseVersion = false
}
java.toolchain.languageVersion = JavaLanguageVersion.of(8) // Mojang ships Java 8 to end users, so your mod should target Java 8.
println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
minecraft {
mappings channel: 'parchment', version: '2022.03.06-1.16.5'
runs {
client {
workingDirectory project.file('run')
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${buildDir}/createSrgToMcp/output.srg"
property 'forge.logging.console.level', 'debug'
mods {
realyusufismailcore {
source sourceSets.main
}
}
}
server {
workingDirectory project.file('run')
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${buildDir}/createSrgToMcp/output.srg"
property 'forge.logging.console.level', 'debug'
mods {
realyusufismailcore {
source sourceSets.main
}
}
}
data {
workingDirectory project.file('run')
property 'forge.logging.console.level', 'debug'
property 'fml.earlyprogresswindow', 'false'
args '--mod', 'realyusufismailcore', '--all',
'--existing', file('src/main/resources').toString(),
'--existing', file('src/generated/resources').toString(),
'--output', file('src/generated/resources/')
mods {
realyusufismailcore {
source sourceSets.main
}
}
}
}
}
sourceSets.main.resources {
srcDir 'src/generated/resources'
}
dependencies {
minecraft "net.minecraftforge:forge:${forge_version}"
}
jar {
manifest {
attributes([
"Specification-Title": "realyusufismailcore",
"Specification-Vendor": "Yusuf.I",
"Specification-Version": "1", // We are version 1 of ourselves
"Implementation-Title": project.name,
"Implementation-Version": "${version}",
"Implementation-Vendor" :"Yusuf.I",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
}
jar.finalizedBy('reobfJar')
javadoc {
if (JavaVersion.current().isJava8Compatible()) {
options.addStringOption('Xdoclint:none', '-quiet')
logging.captureStandardError LogLevel.INFO
logging.captureStandardOutput LogLevel.INFO
}
}
java {
withJavadocJar()
withSourcesJar()
}
afterEvaluate { project ->
ext.isReleaseVersion = !version.endsWith("RELEASE")
}
spotless {
java {
// Excludes build folder since it contains generated java classes.
targetExclude("build/**")
palantirJavaFormat()
trimTrailingWhitespace()
indentWithSpaces()
endWithNewline()
licenseHeader(
"""/*
* Copyright 2024 RealYusufIsmail.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
*
* you may not use this file except in compliance with the License.
*
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ """)
}
}
publishing {
publications {
mavenJava(MavenPublication) {
//artifactId = project.artifactId // or maybe archiveBaseName?
from components.java
pom {
name = project.archivesBaseName
description = project.description
url = "https://github.com/RealYusufIsmail-Mc-Mods/RealYusufIsmail-Core/"
packaging = "jar"
licenses {
license {
name = "${gpl_name}"
url = "${gpl_url}"
}
}
developers {
developer {
id = "${dev_id}"
name = "${dev_name}"
email = "${dev_email}"
organization = "${dev_organization}"
organizationUrl = "${dev_organizationUrl}"
}
}
scm {
connection = 'https://github.com/RealYusufIsmail/YDW.git'
developerConnection = 'scm:git:ssh://git@github.com/RealYusufIsmail-Mc-Mods/RealYusufIsmail-Core.git'
url = 'https://github.com/RealYusufIsmail-Mc-Mods/RealYusufIsmail-Core/'
}
}
}
}
repositories {
maven {
afterEvaluate { project ->
def releaseRepo = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotRepo = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
url = (isReleaseVersion) ? releaseRepo : snapshotRepo
//println "repos: " + version
//println "repos: " + isReleaseVersion
//println url
credentials {
username = project.hasProperty('ossrhUsername') ? ossrhUsername : "Unknown user"
password = project.hasProperty('ossrhPassword') ? ossrhPassword : "Unknown password"
}
}
}
}
}
signing {
afterEvaluate { project ->
//println "sign: " + version
//println "sign: " + isReleaseVersion
required { isReleaseVersion && gradle.taskGraph.hasTask("publish") }
sign publishing.publications.mavenJava
}
}
nexusStaging {
packageGroup = 'io.github.realyusufismail'
serverUrl = "https://s01.oss.sonatype.org/service/local"
username = project.hasProperty('MAVEN_USERNAME') ? project.property('MAVEN_USERNAME') : 'username'
password = project.hasProperty('MAVEN_PASSWORD') ? project.property('MAVEN_PASSWORD') : 'password'
}
tasks.register('publishCurseForge', TaskPublishCurseForge) {
group = "CurseForge"
dependsOn("build")
disableVersionDetection()
var token = project.hasProperty('curseforge.token') ? project.property('curseforge.token') as String : ""
apiToken = token
final var jar = file("build/libs/${base.archivesName.get()}-${project.version}.jar")
final var mainFile = upload(projectId, jar)
mainFile.changelog = file("CHANGELOG.md").getText()
mainFile.changelogType = "markdown"
mainFile.releaseType = "release"
mainFile.addJavaVersion("Java 8")
mainFile.addModLoader("Forge")
mainFile.addGameVersion(mcVersion)
}