-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbuild.gradle.kts
160 lines (132 loc) · 4.33 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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
import com.modrinth.minotaur.TaskModrinthUpload
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.jfrog.buildinfo:build-info-extractor-gradle:4.+")
}
}
plugins {
java
id("fabric-loom") version "0.9-SNAPSHOT"
`maven-publish`
id("com.modrinth.minotaur") version "1.1.0"
kotlin("jvm") version "1.5.21"
id("org.jetbrains.dokka") version "1.4.20"
}
object Globals {
const val mcVer = "1.17.1"
const val yarnVer = "32"
const val loaderVer = "0.11.6"
const val fapiVer = "0.37.1+1.17"
const val kotlinVer = "1.5.21"
const val flkVer = "1.6.3"
const val grp = "io.github.ytg1234"
const val abn = "manhunt"
const val modVer = "2.0.3"
const val modrinthId = "z0z6kFjN"
const val unstable = false
val modrinthMcVers =
arrayOf("1.17.1")
}
allprojects {
apply(plugin = "java")
apply(plugin = "fabric-loom")
apply(plugin = "org.jetbrains.kotlin.jvm")
apply(plugin = "org.jetbrains.dokka")
repositories {
maven(url = "https://jitpack.io/") {
name = "Jitpack"
content {
includeGroup("com.github.P03W")
}
}
}
group = Globals.grp
dependencies {
// Essentials
minecraft("com.mojang", "minecraft", Globals.mcVer)
mappings("net.fabricmc", "yarn", "${Globals.mcVer}+build.${Globals.yarnVer}", classifier = "v2")
modImplementation("net.fabricmc", "fabric-loader", Globals.loaderVer)
// Fabric API
modImplementation("net.fabricmc.fabric-api", "fabric-api", Globals.fapiVer)
// Kotlin
modImplementation("net.fabricmc", "fabric-language-kotlin", "${Globals.flkVer}+kotlin.${Globals.kotlinVer}")
}
tasks {
withType<JavaCompile> {
options.encoding = "UTF-8"
options.release.set(16)
}
withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions.jvmTarget = "16"
}
register<Jar>("sourcesJar") {
archiveClassifier.set("sources")
from(sourceSets["main"].allSource)
}
jar {
from("LICENSE")
}
withType(org.jetbrains.dokka.gradle.DokkaTask::class).configureEach {
dokkaSourceSets {
configureEach {
includes.from("Module.md")
}
}
}
processResources {
duplicatesStrategy = DuplicatesStrategy.WARN
}
}
}
version = Globals.modVer
dependencies {
implementation(project(":manhunt-api"))
implementation(project(":manhunt-base"))
afterEvaluate {
include(project(":manhunt-api"))
include(project(":manhunt-base"))
}
}
tasks.getByName("remapJar").dependsOn(project(":manhunt-api").tasks.getByName("remapJar"))
tasks.getByName("remapJar").dependsOn(project(":manhunt-base").tasks.getByName("remapJar"))
tasks {
register<TaskModrinthUpload>("publishModrinth") {
token = System.getenv("MODRINTH_API_TOKEN")
projectId = Globals.modrinthId
versionNumber = "v${Globals.modVer}"
uploadFile = "${project.buildDir.absolutePath}/libs/${Globals.abn}-${Globals.modVer}.jar"
Globals.modrinthMcVers.forEach { addGameVersion(it) }
addLoader("fabric")
addFile("${project.buildDir.absolutePath}/libs/${Globals.abn}-${Globals.modVer}-dev.jar")
addFile("${project.buildDir.absolutePath}/libs/${Globals.abn}-${Globals.modVer}-sources.jar")
versionName = "Manhunt: Fabric v${Globals.modVer}"
dependsOn(remapJar)
dependsOn(project.tasks.getByName("sourcesJar"))
}
processResources {
inputs.property("version", Globals.modVer)
from(sourceSets["main"].resources.srcDirs) {
include("fabric.mod.json")
expand("version" to Globals.modVer)
}
}
}
publishing {
publications {
create<MavenPublication>("mavenJava") {
artifact(tasks.jar) {
builtBy(tasks.remapJar)
}
artifact("${project.buildDir.absolutePath}/libs/${Globals.abn}-${Globals.modVer}.jar") {
builtBy(tasks.remapJar)
}
artifact(tasks.getByName("sourcesJar")) {
builtBy(tasks.remapSourcesJar)
}
}
}
}
apply(from = "https://raw.githubusercontent.com/YTG1234/scripts/main/scripts/gradle/artifactory.gradle")