-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
190 lines (156 loc) · 5.78 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
import java.util.Optional as If
plugins {
id 'fabric-loom' version '1.6-SNAPSHOT'
id 'scala'
id 'maven-publish'
id 'com.github.gmazzo.buildconfig' version '5.3.5'
}
static Closure mavenRepository (@DelegatesTo(MavenArtifactRepository.class) Closure closure) { closure }
static Action<? extends PasswordCredentials> credentials (Action<? extends PasswordCredentials> action) { action }
If<Action<? extends PasswordCredentials>> workshopCredentials = If.empty()
final predef_credential_username = System.getenv('workshop_maven_credential_username')
final predef_credential_password = System.getenv('workshop_maven_credential_password')
if (predef_credential_username != null && predef_credential_password != null) {
workshopCredentials = If.of(credentials { credentials ->
credentials.username = predef_credential_username
credentials.password = predef_credential_password
})
println("Using workshop credentials.")
} else {
println("Workshop credentials not set, will not be able to do maven publish.")
}
final var workshopMcModsPublishable = workshopCredentials.isPresent()
final var workshopMcMods = mavenRepository({
name 'wsMcMods'
url "https://mvn.sukazyo.cc/mc-mods"
if (workshopMcModsPublishable)
credentials workshopCredentials.get()
})
final var workshopReleases = mavenRepository({
name 'wsMcMods'
url "https://mvn.sukazyo.cc/releases"
})
final var workshopSnapshots = mavenRepository({
name 'wsMcMods'
url "https://mvn.sukazyo.cc/snapshots"
})
final var proj_group = predef_proj_group
final var proj_package = "$predef_proj_group.$predef_proj_id"
final var proj_is_snapshot = Boolean.parseBoolean(predef_proj_is_snapshot)
final var proj_version = [
predef_proj_version,
proj_is_snapshot ? "SNAPSHOT" : null
].stream().filter(x -> x != null && !x.isBlank()).reduce((x, y) -> x + '-' + y).orElseGet(() -> "0.0.0-SNAPSHOT")
final var proj_name = predef_proj_name
version = proj_version
group = proj_group
base {
archivesName = proj_name
}
repositories {
maven workshopMcMods
maven workshopReleases
maven workshopSnapshots
maven {
name = "Azure Kotori316 Cats"
url = "https://pkgs.dev.azure.com/Kotori316/minecraft/_packaging/mods/maven/v1"
}
}
loom {
splitEnvironmentSourceSets()
mods {
"$proj_name" {
sourceSet sourceSets.main
sourceSet sourceSets.client
}
}
}
remapJar {
remapperIsolation = true
}
dependencies {
// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${predef_api_minecraft_version}"
mappings "net.fabricmc:yarn:${predef_api_yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${predef_api_loader_version}"
implementation 'org.scala-lang:scala-library:2.13.14'
implementation 'org.scala-lang:scala3-library_3:3.4.2'
modImplementation "com.kotori316:scalable-cats-force-fabric:3.0.0:dev"
modImplementation "net.fabricmc:fabric-language-kotlin:1.11.0+kotlin.2.0.0"
// modCompileOnly "carpet:fabric-carpet:1.20-1.4.112+v230608"
modImplementation "carpet:fabric-carpet:1.20-1.4.112+v230608"
implementation include("com.github.pengrad:java-telegram-bot-api:7.7.0")
implementation include("cc.sukazyo:morny-system-lib:2.0.0-alpha20-SNAPSHOT")
implementation include("cc.sukazyo:da4a:0.2.0-SNAPSHOT")
implementation include("cc.sukazyo:resource-tools:0.3.1")
implementation include("io.circe:circe-core_3:0.14.9")
implementation include("io.circe:circe-generic_3:0.14.9")
implementation include("io.circe:circe-parser_3:0.14.9")
implementation include("io.circe:circe-yaml-v12_3:0.15.3")
runtimeOnly include("cc.sukazyo:messiva:0.2.0")
runtimeOnly include("org.jline:jline:3.21.0")
runtimeOnly include("org.fusesource.jansi:jansi:2.4.0")
runtimeOnly include("com.squareup.okhttp3:okhttp:4.12.0")
runtimeOnly include("com.squareup.okio:okio:3.6.0")
runtimeOnly include("com.squareup.okio:okio-jvm:3.6.0")
runtimeOnly include("com.squareup.okhttp3:logging-interceptor:4.10.0")
runtimeOnly include("com.softwaremill.sttp.client3:core_3:3.9.5")
runtimeOnly include("com.softwaremill.sttp.model:core_3:1.7.9")
runtimeOnly include("com.softwaremill.sttp.shared:core_3:1.3.16")
runtimeOnly include("com.softwaremill.sttp.shared:ws_3:1.3.16")
runtimeOnly include("com.softwaremill.sttp.client3:okhttp-backend_3:3.9.5")
runtimeOnly include("org.jsoup:jsoup:1.17.2")
runtimeOnly include("io.circe:circe-numbers_3:0.14.9")
runtimeOnly include("org.typelevel:cats-core_3:2.12.0")
runtimeOnly include("org.typelevel:cats-kernel_3:2.12.0")
runtimeOnly include("io.circe:circe-jawn_3:0.14.9")
runtimeOnly include("org.typelevel:jawn-parser_3:1.6.0")
runtimeOnly include("io.circe:circe-yaml-common_3:0.15.3")
runtimeOnly include("org.snakeyaml:snakeyaml-engine:2.7")
// Fabric API.
modImplementation "net.fabricmc.fabric-api:fabric-api:${predef_lib_fabric_version}"
// Telegram Bot API
implementation "com.github.pengrad:java-telegram-bot-api:7.7.0"
}
buildConfig {
packageName proj_package
buildConfigField(String, 'MOD_VERSION', proj_version)
}
processResources {
inputs.property "version", proj_version
filesMatching("fabric.mod.json") {
expand "version": proj_version
}
filesMatching("*.properties") {
expand "version": proj_version
}
}
tasks.withType(JavaCompile).configureEach {
it.options.release = 21
}
java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
jar {
from("LICENSE") {
rename { "${it}_${proj_name}"}
}
}
// configure the maven publication
publishing {
publications {
create("mavenJava", MavenPublication) {
artifactId = proj_name
from components.java
}
}
repositories {
if (workshopMcModsPublishable)
maven workshopMcMods
}
}