-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle.kts
137 lines (117 loc) · 3.65 KB
/
build.gradle.kts
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
plugins {
id("fabric-loom") version Versions.LOOM
id("maven-publish")
id("io.github.p03w.machete") version "2.0.1"
}
version = ModData.VERSION
group = ModData.GROUP
repositories {
}
dependencies {
minecraft("com.mojang:minecraft:${Versions.MINECRAFT}")
mappings("net.fabricmc:yarn:${Versions.YARN}:v2")
modImplementation("net.fabricmc:fabric-loader:${Versions.FABRIC_LOADER}")
modImplementation("net.fabricmc.fabric-api:fabric-api:${Versions.FABRIC_API}")
afterEvaluate {
"testmodImplementation"(sourceSets.main.get().output)
}
}
java {
withSourcesJar()
withJavadocJar()
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
tasks {
withType<JavaCompile>().configureEach {
options.encoding = "UTF-8"
}
withType<GenerateModuleMetadata> {
dependsOn("optimizeOutputsOfRemapJar")
}
javadoc {
// Disable no comment warning
(options as StandardJavadocDocletOptions).addStringOption("Xdoclint:none", "-quiet")
}
jar {
from("LICENSE") {
rename { "${it}_${ModData.GROUP}" }
}
}
processResources {
inputs.property("version", ModData.VERSION)
inputs.property("minecraft_version", Versions.MINECRAFT)
inputs.property("loader_version", Versions.FABRIC_LOADER)
filteringCharset = "UTF-8"
filesMatching("fabric.mod.json") {
expand(
"version" to ModData.VERSION,
"minecraft_version" to Versions.MINECRAFT,
"loader_version" to Versions.FABRIC_LOADER
)
}
}
// Publish to GitHub Releases
register<Exec>("publishToGithub") {
group = "publishing"
description = "Publishes the current version to GitHub Releases"
workingDir = projectDir
dependsOn("build")
val jarName = "${ModData.ID}-${ModData.VERSION}"
val changelog = with(file("changelogs/${ModData.VERSION}.md")) {
if (exists()) readText() else ""
}
commandLine(
"gh", "release",
"create", ModData.VERSION,
"build/libs/${jarName}.jar",
"build/libs/${jarName}-javadoc.jar",
"build/libs/${jarName}-sources.jar",
"-t", "Gimm1q ${ModData.VERSION_TYPE} ${ModData.VERSION}",
"-n", changelog,
)
}
}
sourceSets {
create("testmod") {
runtimeClasspath += main.get().runtimeClasspath
compileClasspath += main.get().compileClasspath
compileClasspath += sourceSets.getByName("testmod").compileClasspath
runtimeClasspath += sourceSets.getByName("testmod").runtimeClasspath
}
}
loom {
runs {
create("testmodClient") {
client()
ideConfigGenerated(project.rootProject == project)
name("Testmod Client")
source(sourceSets.getByName("testmod"))
}
create("testmodServer") {
server()
ideConfigGenerated(project.rootProject == project)
name("Testmod Server")
source(sourceSets.getByName("testmod"))
}
}
}
publishing {
publications {
register<MavenPublication>("mavenJava") {
from(components["java"])
groupId = ModData.GROUP
artifactId = ModData.ID
version = ModData.VERSION
}
}
repositories {
maven {
url = uri("https://repo.repsy.io/mvn/mim1q/mods/")
credentials {
username = properties["repsyUsername"] as String
password = properties["repsyPassword"] as String
}
}
}
}