forked from NovaMachina-Mods/ExNihiloSequentia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
242 lines (208 loc) · 7.56 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
import se.bjurr.gitchangelog.plugin.gradle.GitChangelogTask
buildscript {
repositories {
maven { url = 'https://files.minecraftforge.net/maven' }
maven { url "https://plugins.gradle.org/m2/" }
jcenter()
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
classpath group: 'gradle.plugin.se.bjurr.gitchangelog', name: 'git-changelog-gradle-plugin', version: '1.71.4' }
}
plugins {
id 'java'
id 'eclipse'
id 'idea'
id 'maven-publish'
id 'com.matthewprenger.cursegradle' version '1.4.0'
}
apply plugin: 'net.minecraftforge.gradle'
def ENV = System.getenv()
String semver = "${version_major}.${version_api_major}.${version_api_minor}.${version_patch}"
version = "${minecraft_release}-" + new Date().format("yyyyMMdd-HHmmss")
group = "${artifact_group}.${artifact_basename}"
archivesBaseName = "${artifact_basename}"
sourceSets {
main {
resources {
srcDir 'generated/resources'
}
}
}
java.toolchain.languageVersion = JavaLanguageVersion.of(8)
repositories {
maven { url = 'https://files.minecraftforge.net/maven' }
maven { url = "https://dvs1.progwml6.com/files/maven" } // JEI
maven { url = "https://maven.tterrag.com/" } // TOP
maven { url = "https://maven.blamejared.com" } // CraftTweaker
maven {
url = "https://cursemaven.com"
content {
includeGroup "curse.maven"
}
}
maven { url = "https://modmaven.dev"}
}
dependencies {
minecraft([
group: "net.minecraftforge",
name: 'forge',
version: "${minecraft_version}-${forge_major}.${forge_minor}.${forge_patch}"
])
compileOnly fg.deobf("mezz.jei:jei-${minecraft_version}:${jei_version}:api")
runtimeOnly fg.deobf("mezz.jei:jei-${minecraft_version}:${jei_version}")
compileOnly fg.deobf("mcjty.theoneprobe:TheOneProbe-${minecraft_release}:${minecraft_release}-${top_version}:api")
runtimeOnly fg.deobf("mcjty.theoneprobe:TheOneProbe-${minecraft_release}:${minecraft_release}-${top_version}")
compileOnly fg.deobf("com.blamejared.crafttweaker:CraftTweaker-${minecraft_version}:${crafttweaker_version}")
runtimeOnly fg.deobf("com.blamejared.crafttweaker:CraftTweaker-${minecraft_version}:${crafttweaker_version}")
compileOnly fg.deobf("curse.maven:jade-api-324717:${jade_api_id}")
runtimeOnly fg.deobf("curse.maven:jade-324717:${jade_id}")
runtimeOnly fg.deobf("curse.maven:ctm-267602:3137659")
runtimeOnly fg.deobf("curse.maven:jer-240630:3066754")
}
task replaceResources(type: Copy) {
outputs.upToDateWhen { false }
from(sourceSets.main.resources.srcDirs) {
include 'META-INF/mods.toml'
expand 'version': version, 'mc_version': minecraft_version_range, 'forge_version': forge_version_range
}
into "$buildDir/resources/main"
}
processResources {
duplicatesStrategy(DuplicatesStrategy.INCLUDE)
from(sourceSets.main.resources.srcDirs) {
exclude 'META-INF/mods.toml'
}
finalizedBy replaceResources
}
task createVersionFile(type: CreateVersionClass) {
fileVersion = version
}
minecraft {
mappings channel: 'official', version: "${minecraft_version}"
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
runs {
client {
workingDirectory project.file('run')
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'debug'
mods {
exnihilosequentia {
source sourceSets.main
}
}
}
server {
workingDirectory project.file('runserver')
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'debug'
mods {
exnihilosequentia {
source sourceSets.main
}
}
}
data {
workingDirectory project.file('run')
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'debug'
args '--mod', 'exnihilosequentia', '--all', '--output', file('generated/resources/'), '--existing', file('src/main/resources')
mods {
exnihilosequentia {
source sourceSets.main
}
}
}
}
}
task makeChangelog(type: GitChangelogTask) {
file = file('changelog.html')
untaggedName = "Current Release ${version}"
fromCommit = "1be698f061a24f615c2a770d1190c995259ecbcd"
toRef = 'HEAD'
templateContent = file('changelog.mustache').getText('UTF-8')
fromRepo = file(".")
}
curseforge {
apiKey = ENV.CURSEFORGE_KEY ?: '0'
project {
id = "${curseforge_project}"
releaseType = 'release'
mainArtifact jar
addGameVersion '1.16'
addGameVersion '1.16.1'
addGameVersion '1.16.2'
addGameVersion '1.16.3'
addGameVersion '1.16.4'
addGameVersion '1.16.5'
changelog = file('changelog.html')
changelogType = 'html'
}
}
afterEvaluate {
tasks.curseforge400012.dependsOn createVersionFile
tasks.jar.dependsOn replaceResources
tasks.curseforge400012.dependsOn makeChangelog
}
jar {
manifest {
attributes([
"Specification-Title": "Ex Nihilo: Sequentia",
"Specification-Vendor": "NovaMachina",
"Specification-Version": version, // We are version 1 of ourselves
"Implementation-Title": project.name,
"Implementation-Version": version,
"Implementation-Vendor" :"NovaMachina",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
}
// Example configuration to allow publishing using the maven-publish task
// This is the preferred method to reobfuscate your jar file
jar.finalizedBy('reobfJar')
// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing
//publish.dependsOn('reobfJar')
publishing {
publications {
mavenJava(MavenPublication) {
groupId = "${artifact_group}"
artifactId = "${artifact_basename}"
version = "${version}"
artifact jar
}
}
repositories {
// maven {
// url "file:///${project.projectDir}/mcmodsrepo"
// }
maven {
credentials {
username = ENV.NEXUS_USERNAME
password = ENV.NEXUS_PASSWORD
}
url = "https://repo.jacob-williams.me/repository/maven-releases/"
}
}
}
abstract class CreateVersionClass extends DefaultTask {
CreateVersionClass() {
this.fileVersion = getFileVersion()
}
@Input
abstract Property<String> getFileVersion()
@TaskAction
void writeString() {
FileWriter fw;
fw = new FileWriter('update.json');
fw.write("{\n" +
" \"homepage\": \"https://www.curseforge.com/minecraft/mc-mods/ex-nihilo-sequentia\",\n" +
" \"promos\": {\n" +
" \"1.16-latest\": \"${fileVersion.get()}\",\n" +
" \"1.16-recommended\": \"${fileVersion.get()}\"\n" +
" }\n" +
"}\n");
fw.close();
}
}