forked from LambdAurora/SpruceUI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
170 lines (144 loc) · 3.7 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
plugins {
id 'fabric-loom' version '1.6.+'
id 'dev.yumi.gradle.licenser' version '1.0.+'
id 'java-library'
id 'maven-publish'
}
import net.fabricmc.loom.task.RemapJarTask
group = project.maven_group
version = "${project.mod_version}+${getMCVersionString()}"
base.archivesName = project.archives_base_name
// This field defines the Java version your mod target.
def targetJavaVersion = 21
Set<String> modules = [
'fabric-api-base',
'fabric-lifecycle-events-v1',
'fabric-rendering-v1',
'fabric-resource-loader-v0',
'fabric-screen-api-v1',
'fabric-key-binding-api-v1'
]
String getMCVersionString() {
return project.minecraft_version
}
sourceSets {
testmod {
compileClasspath += sourceSets.main.compileClasspath
runtimeClasspath += sourceSets.main.runtimeClasspath
}
}
repositories {
mavenLocal()
maven {
name 'Quilt'
url 'https://maven.quiltmc.org/repository/release'
}
maven {
name 'TerraformersMC'
url 'https://maven.terraformersmc.com/releases'
}
maven {
name = "QuiltMC"
url = "https://maven.quiltmc.org/repository/release"
}
}
configurations {
api.extendsFrom libApi
}
dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "org.quiltmc:quilt-mappings:${minecraft_version}+build.${quilt_mappings}:intermediary-v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modules.stream().map { fabricApi.module(it, project.fabric_api_version) }.forEach {
modImplementation it
}
modLocalRuntime("com.terraformersmc:modmenu:${project.modmenu_version}") {
transitive = false
}
modLocalRuntime fabricApi.module("fabric-key-binding-api-v1", project.fabric_api_version)
testmodImplementation sourceSets.main.output
}
java {
sourceCompatibility = JavaVersion.toVersion(targetJavaVersion)
targetCompatibility = JavaVersion.toVersion(targetJavaVersion)
withSourcesJar()
}
tasks.withType(JavaCompile).configureEach {
it.options.encoding = 'UTF-8'
it.options.deprecation(true)
it.options.incremental(true)
it.options.release.set(targetJavaVersion)
}
processResources {
inputs.property 'version', project.version
filesMatching('fabric.mod.json') {
expand 'version': project.version
}
}
jar {
from('LICENSE') {
rename { "${it}_${base.archivesName.get()}" }
}
}
loom {
runs {
testmodClient {
client()
source(sourceSets.testmod)
}
}
}
task testmodJar(type: Jar) {
group "build"
from sourceSets.testmod.output
archiveClassifier = "testmod-dev"
destinationDirectory = project.file("build/devlibs")
}
task remapTestmodJar(type: RemapJarTask, dependsOn: testmodJar) {
group "build"
inputFile = testmodJar.archiveFile
classpath.from sourceSets.testmod.compileClasspath
archiveClassifier = "testmod"
}
build.dependsOn remapTestmodJar
license {
rule file('HEADER')
}
// configure the maven publication
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
pom {
name = 'SpruceUI'
description = 'A Minecraft mod API which adds some GUI utilities.'
}
}
}
repositories {
mavenLocal()
maven {
name 'BuildDirLocal'
url "${project.layout.buildDirectory.get()}/repo"
}
maven {
name 'GithubPackages'
url 'https://maven.pkg.github.com/LambdAurora/SpruceUI'
credentials {
username = project.findProperty('gpr.user') ?: System.getenv('USERNAME')
password = project.findProperty('gpr.key') ?: System.getenv('TOKEN')
}
}
def spruceuiMaven = System.getenv('SPRUCEUI_MAVEN')
if (spruceuiMaven) {
maven {
name = 'SpruceUIMaven'
url = uri(spruceuiMaven)
credentials {
username = project.findProperty('gpr.user') ?: System.getenv('MAVEN_USERNAME')
password = project.findProperty('gpr.key') ?: System.getenv('MAVEN_PASSWORD')
}
}
}
}
}