This repository has been archived by the owner on Aug 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
237 lines (209 loc) · 7.55 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
buildscript {
repositories {
maven { url = 'https://files.minecraftforge.net/maven' }
jcenter()
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
}
}
plugins {
id 'org.ajoberstar.grgit' version '4.0.2'
id "com.matthewprenger.cursegradle" version '1.4.0'
id "com.wynprice.cursemaven" version "2.1.4"
id 'java'
id 'idea'
id 'maven'
id 'maven-publish'
id "com.github.breadmoirai.github-release" version "2.2.10"
}
apply plugin: 'idea'
apply plugin: 'net.minecraftforge.gradle'
version = "${minecraft_version}-${mod_version}." + (System.getenv().BUILD_NUMBER ?: "test-env")
group = "${mod_group}"
archivesBaseName = "${mod_name}"
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8'
minecraft {
mappings channel: 'snapshot', version: "${mappings_version}"
// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
accessTransformers(file('src/main/resources/META-INF/accesstransformer.cfg'))
runs {
client {
workingDirectory project.file('run')
// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'
mods {
craftle {
source sourceSets.main
}
}
}
server {
workingDirectory project.file('run')
// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'
mods {
craftle {
source sourceSets.main
}
}
}
data {
workingDirectory project.file('run')
// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'
args '--mod', 'craftle', '--all', '--output', file('src/generated/resources/')
mods {
examplemod {
source sourceSets.main
}
}
}
}
}
// prevent java 8's strict doclint for javadocs from failing builds
if (JavaVersion.current().isJava8Compatible()) {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
dependencies {
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.3.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.3.1'
}
// Process resources on build
processResources {
// This will ensure that this task is redone when the versions change.
inputs.property 'version', project.version
// Replace stuff in mods.toml, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'META-INF/mods.toml'
// Replace version
expand 'version': project.version
}
// Copy everything else except the mods.toml
from(sourceSets.main.resources.srcDirs) {
exclude 'META-INF/mods.toml'
}
}
jar {
from sourceSets.main.output
// from sourceSets.main.output.classesDirs
// from sourceSets.main.output.resourcesDir
manifest {
attributes([
"Specification-Title" : "Craftle",
"Specification-Vendor" : "kalindu",
"Specification-Version" : "${mod_version}",
"Implementation-Title" : project.name,
"Implementation-Version" : "${project.version}",
"Implementation-Vendor" : "kalindu",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
])
}
}
task coreJar(type: Jar) {
archiveName = "Craftle-${project.version}.jar"
from sourceSets.main.output
}
artifacts {
archives coreJar
}
reobf {
coreJar { classpath = sourceSets.main.compileClasspath }
}
// Credit: Mekanism
//uploadArchives {
// if (System.getenv("LOCAL_MAVEN") != null) {
// repositories {
// mavenDeployer {
// repository(url: "file://" + System.getenv("LOCAL_MAVEN"))
// pom {
// groupId = project.group
// version = project.version
// if (System.getenv("MAVEN_ARTIFACT") != null) {
// artifactId = System.getenv("MAVEN_ARTIFACT")
// } else {
// artifactId = "Craftle"
// }
// project {
// name = "Craftle"
// packaging 'jar'
// description 'Craftle is a Minecraft modification, providing highly technical machines, tools and other resources.'
// url 'https://kdecosta.com/craftle/'
// scm {
// url 'https://github.com/kalindudc/craftle.git'
// }
// issueManagement {
// system 'github'
// url 'https://github.com/kalindudc/craftle/issues'
// }
// licenses {
// license {
// name = 'CC-NC-SA 4.0'
// distribution 'repo'
// }
// }
// }
// }
// }
// }
// }
//}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
tasks.build.dependsOn sourcesJar
githubRelease {
token "" + System.getenv("RELEASE_TOKEN")
owner "kalindudc"
repo "craftle"
tagName "v${project.version}"
targetCommitish System.getenv("TRAVIS_BRANCH") ?: "master"
releaseName
"v${project.version}"
body ""
draft false
prerelease new String("${curse_release_type}").equalsIgnoreCase("alpha") || new String("${curse_release_type}").equalsIgnoreCase("beta")
FilenameFilter filter = { dir, filename -> filename.contains(project.version) }
releaseAssets jar.destinationDir.listFiles(filter)
// complain if tag already exists, I probably forgot to bump the patch number
overwrite false
apiEndpoint "https://api.github.com"
}
task deployRelease {
dependsOn 'build'
dependsOn 'githubRelease'
// add curseforge
tasks.findByName('githubRelease').mustRunAfter 'build'
}
//tasks.curseforge.dependsOn coreJar
//
//if (System.getenv("CURSEFORGE_KEY") != null || project.hasProperty('curseforgeKey')) {
// println "Enabling Curseforge config"
// curseforge {
// //Core
// project {
// id = '268560'
// changelogType = "html"
// changelog = generatedChangelog
// // A file can also be set using: changelog = file('changelog.txt')
// releaseType = "${curse_release_type}"
// mainArtifact(coreJar) {
// relations {
// // optionalDependency "jei"
// }
// }
// addGameVersion "${minecraft_version}"
// }
// }
//}