-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathbuild.gradle
More file actions
134 lines (111 loc) · 4.34 KB
/
build.gradle
File metadata and controls
134 lines (111 loc) · 4.34 KB
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
plugins {
id "dev.architectury.loom" version "1.9-SNAPSHOT" apply false
id "architectury-plugin" version "3.4-SNAPSHOT"
id "com.github.johnrengelman.shadow" version "8.1.1" apply false
id "maven-publish"
}
ext {
getVersionSuffix = {
String versionSuffix = ""
if (System.getenv("BUILD_TAG") != null && !System.getenv("BUILD_TAG").isEmpty() && System.getenv("BUILD_RELEASE") != "true") {
versionSplit = System.getenv("BUILD_TAG").split("\\+")
versionPart = (versionSplit.length >= 2) ? versionSplit[1] : ""
if ((versionPart || !versionPart.isEmpty()) && versionPart.startsWith("alpha") || versionPart.startsWith("beta")) {
versionSuffix += "+" + versionPart
}
return versionSuffix
}
if (System.getenv("BUILD_RELEASE") != "true") {
String buildNumber = System.getenv("BUILD_ID")
versionSuffix += buildNumber != null ? ("+build." + buildNumber) : "+snapshot"
}
return versionSuffix
}
}
architectury {
minecraft = project.minecraft_version
}
allprojects {
group = rootProject.maven_group
version = rootProject.mod_version
}
subprojects {
apply plugin: "dev.architectury.loom"
apply plugin: "architectury-plugin"
apply plugin: "maven-publish"
repositories {
mavenLocal()
maven {
name "CjsahMaven"
url "https://server.cjsah.net:1002/maven/"
}
}
dependencies {
minecraft "net.minecraft:minecraft:$rootProject.minecraft_version"
mappings loom.officialMojangMappings()
// incremental storage
implementation("io.github.skydynamic:incremental-storage-lib:$rootProject.incremental_storage_lib_version")
implementation("org.jetbrains.exposed:exposed-core:0.57.0")
implementation("org.jetbrains.exposed:exposed-jdbc:0.57.0")
implementation("com.h2database:h2:2.2.224")
// https://mvnrepository.com/artifact/org.quartz-scheduler/quartz
implementation("org.quartz-scheduler:quartz:2.5.0")
// lombok
compileOnly("org.projectlombok:lombok:1.18.30")
annotationProcessor("org.projectlombok:lombok:1.18.30")
}
String versionSuffix = project.getVersionSuffix()
String fullModVersion = project.mod_version + versionSuffix
version = fullModVersion
group = project.maven_group
archivesBaseName = project.archives_name + "-mc" + project.minecraft_version + "-$project.name".replace("${mod_id}-", "")
loom {
accessWidenerPath = project(":${mod_id}-common").file("src/main/resources/qbm.accesswidener")
}
java {
withSourcesJar()
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
tasks.withType(JavaCompile).configureEach {
it.options.release = 21
}
beforeEvaluate {
tasks.register('cleanBuildLibs') {
doFirst {
def libsDir = project.projectDir.toPath().resolve("build/libs").toFile()
if (libsDir.exists()) {
libsDir.listFiles().each { file ->
file.delete()
}
}
}
}
tasks.build.dependsOn(cleanBuildLibs)
tasks.remapJar.dependsOn(cleanBuildLibs)
}
afterEvaluate {
def targetLibsDir = rootProject.file("build/libs")
if (!targetLibsDir.exists()) {
targetLibsDir.mkdirs()
}
tasks.register('copyJarsToRootLibs') {
if (project.name.contains("neoforge") || project.name.contains("fabric")) {
doLast {
def sourceLibsDir = project.projectDir.toPath().resolve("build/libs").toFile()
if (sourceLibsDir.exists()) {
sourceLibsDir.listFiles().each { file ->
if (file.name.endsWith('.jar')
&& !file.name.contains('dev')
&& !file.name.contains('source')) {
ant.copy(file: file, todir: targetLibsDir)
}
}
}
}
}
}
tasks.build.finalizedBy(copyJarsToRootLibs)
tasks.remapJar.finalizedBy(copyJarsToRootLibs)
}
}