generated from TropheusJ/quilt-template-mod
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
104 lines (90 loc) · 2.64 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
plugins {
id "org.quiltmc.loom" version "1.0.+"
id "maven-publish"
}
archivesBaseName = project.archives_base_name
group = project.maven_group
ext.buildNumber = System.getenv("GITHUB_RUN_NUMBER")
String patch = buildNumber != null ? buildNumber : "99999"
version = project.version.replace("<build>", patch)
repositories {
maven { url = "https://api.modrinth.com/maven" }
maven { url = "https://maven.terraformersmc.com/releases/" }
maven { url = "https://maven.shedaniel.me/" }
maven { url = "https://jitpack.io" }
}
dependencies {
// dev environment
minecraft("com.mojang:minecraft:$minecraft_version")
mappings loom.layered {
it.mappings("org.quiltmc:quilt-mappings:$minecraft_version+build.$qm_build:intermediary-v2")
it.officialMojangMappings { nameSyntheticMembers = false }
}
modImplementation("org.quiltmc:quilt-loader:$quilt_loader")
modImplementation("org.quiltmc.quilted-fabric-api:quilted-fabric-api:$quilted_fabric_api")
// dev env
modLocalRuntime("maven.modrinth:suggestion-tweaker:$suggestion_tweaker_version")
modLocalRuntime("me.shedaniel.cloth:cloth-config-fabric:$cloth_config_version")
modLocalRuntime("maven.modrinth:jade:$jade_version")
modLocalRuntime("com.terraformersmc:modmenu:$mod_menu_version")
modLocalRuntime("dev.emi:emi-fabric:$emi_version")
}
tasks.register("buildOrPublish") {
group = "build"
String mavenUser = System.getenv("MAVEN_USER")
if (mavenUser != null && !mavenUser.isEmpty()) {
dependsOn(tasks.named("publish"))
println("prepared for publish")
} else {
dependsOn(tasks.named("build"))
println("prepared for build")
}
}
processResources {
Map<String, Object> properties = [
"version": version,
"loader_version": quilt_loader,
"qfapi_version": quilted_fabric_api,
"minecraft_version": minecraft_version
]
properties.forEach(inputs::property)
filesMatching("quilt.mod.json") {
expand properties
}
}
tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"
it.options.release.set(17)
}
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
withSourcesJar()
withJavadocJar()
}
jar {
from("LICENSE") {
rename { "${it}_${archivesBaseName}" }
}
}
publishing {
publications {
register("mavenJava", MavenPublication) {
artifactId = archivesBaseName + "_${project.name}"
//noinspection GroovyAssignabilityCheck
from(components.java)
}
}
repositories {
maven {
url = "https://mvn.devos.one/${System.getenv("PUBLISH_SUFFIX")}/"
credentials {
username = System.getenv("MAVEN_USER")
password = System.getenv("MAVEN_PASS")
}
authentication {
create("basic", BasicAuthentication)
}
}
}
}