generated from LCLPYT/fabric-mod-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
166 lines (129 loc) · 4.31 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
import work.lclpnet.build.task.GithubDeploymentTask
plugins {
id 'fabric-loom' version '1.7-SNAPSHOT'
id 'maven-publish'
id 'gradle-build-utils' version '1.7.0'
id 'com.modrinth.minotaur' version '2.4.3'
}
Properties props = buildUtils.loadProperties('publish.properties')
version = buildUtils.gitVersion()
group = project.maven_group
base {
archivesName = project.archives_base_name
}
repositories {
maven {
url "https://repo.lclpnet.work/repository/internal"
}
}
loom {
splitEnvironmentSourceSets()
mods {
"notica" {
sourceSet sourceSets.main
sourceSet sourceSets.client
}
}
}
sourceSets {
api {}
main {
compileClasspath += api.getOutput()
runtimeClasspath += api.getOutput()
}
client {
compileClasspath += api.getOutput()
runtimeClasspath += api.getOutput()
}
test {
compileClasspath += client.getOutput() + api.getOutput()
runtimeClasspath += client.getOutput() + api.getOutput()
}
}
dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
include(modImplementation("work.lclpnet.mods.kibu:kibu-hooks:${project.kibu_hooks_version}"))
include(modImplementation("work.lclpnet.mods.kibu:kibu-translation-api:${project.kibu_translation_api_version}"))
include(modImplementation(apiImplementation("work.lclpnet.mods.kibu:kibu-hook-api:${project.kibu_hook_api_version}")))
include(modImplementation("work.lclpnet.mods.kibu:kibu-access-lib:${project.kibu_access_lib_version}"))
include(implementation('org.json:json:20230227'))
include(implementation('work.lclpnet:json-config4j:1.0.0'))
apiImplementation(implementation('org.jetbrains:annotations:24.0.0'))
testImplementation "net.fabricmc:fabric-loader-junit:${project.loader_version}"
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.8.1'
}
test {
useJUnitPlatform()
}
afterEvaluate {
configurations {
testCompileClasspath.extendsFrom(minecraftCommonNamedCompile)
testRuntimeClasspath.extendsFrom(minecraftCommonNamedRuntime)
testCompileClasspath.extendsFrom(minecraftClientOnlyNamedCompile)
testRuntimeClasspath.extendsFrom(minecraftClientOnlyNamedRuntime)
testRuntimeClasspath.extendsFrom(modRuntimeClasspathClientMapped)
}
}
processResources {
inputs.property "version", project.version
filesMatching("fabric.mod.json") {
expand "version": project.version
}
}
tasks.withType(JavaCompile).configureEach {
it.options.release.set(21)
}
java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
withSourcesJar()
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
[jar, sourcesJar].each {
it.from("LICENSE") {
rename { "${it}_${project.base.archivesName.get()}"}
}
it.from sourceSets.api.output
}
def env = System.getenv()
tasks.register("github", GithubDeploymentTask) {
dependsOn tasks.remapJar
config {
token = env.get("GITHUB_TOKEN")
repository = env.get("GITHUB_REPOSITORY")
}
release {
title = "[$project.minecraft_version] Notica $project.version"
tag = buildUtils.latestTag()
}
assets.add(tasks.remapJar.archiveFile.get())
}
modrinth {
token = env.get("MODRINTH_TOKEN")
projectId = "notica"
versionName = "[$project.minecraft_version] Notica $project.version"
versionType = "release"
uploadFile = remapJar
dependencies {
required.project "fabric-api"
}
}
// configure the maven publication
publishing {
publications {
mavenJava(MavenPublication) {
artifactId = project.base.archivesName.get()
from components.java
pom {
name = 'Notica'
description = 'A fabric mod for playing .nbs files'
}
}
}
// automatically use DEPLOY_URL, DEPLOY_USER and DEPLOY_PASSWORD environment variables
// or mavenHost, mavenUser and mavenPassword from props
buildUtils.setupPublishRepository(repositories, props)
}