-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
107 lines (84 loc) · 3.24 KB
/
build.gradle.kts
File metadata and controls
107 lines (84 loc) · 3.24 KB
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
plugins {
`java-gradle-plugin`
`kotlin-dsl`
id("com.gradle.plugin-publish") version "2.0.0"
idea
}
group = "dev.isxander.modstitch"
version = "0.8.5"
repositories {
mavenCentral()
gradlePluginPortal()
maven("https://maven.fabricmc.net/")
maven("https://maven.neoforged.net/releases/")
}
fun String.capitalize(): String {
return this.replaceFirstChar { if (it.isLowerCase()) it.titlecase() else it.toString() }
}
gradlePlugin {
website = "https://github.com/isXander/modstitch"
vcsUrl = "https://github.com/isXander/modstitch.git"
val pluginTags = listOf("modstitch", "minecraft", "mod")
fun registerExtension(extensionId: String, description: String) {
val extensionCapitalised = extensionId.capitalize()
plugins.create(extensionId) {
id = "dev.isxander.modstitch.$extensionId"
implementationClass = "dev.isxander.modstitch.$extensionId.${extensionCapitalised}Plugin"
displayName = "ModStitch $extensionCapitalised"
this.description = description
tags = pluginTags
}
}
registerExtension("base", description = "The base plugin for ModStitch")
registerExtension("publishing", description = "Adds mod publishing functionality to ModStitch")
}
dependencies {
fun plugin(id: String?, version: String? = null, prop: String? = null): String {
return listOfNotNull(
id?.let { "$it:$it.gradle.plugin" },
version ?: prop?.let { findProperty(it)?.toString() },
).joinToString(separator = ":")
}
// Gradle Plugins
implementation(plugin("fabric-loom", prop = "deps.loom"))
implementation(plugin("net.neoforged.moddev", prop = "deps.moddevgradle"))
implementation(plugin("net.neoforged.moddev.legacyforge", prop = "deps.moddevgradle"))
implementation(plugin("me.modmuss50.mod-publish-plugin", prop = "deps.mpp"))
implementation(plugin("com.gradleup.shadow", prop = "deps.shadow"))
// Libraries used within the plugin
implementation("com.google.code.gson:gson:2.11.0")
implementation("com.electronwill.night-config:toml:3.8.1")
implementation("org.semver4j:semver4j:5.5.0")
// Libraries used for testing
testImplementation(gradleTestKit())
testImplementation("org.junit.jupiter:junit-jupiter:5.13.4")
testImplementation(kotlin("test-junit5"))
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}
tasks.jar {
manifest.attributes["Implementation-Version"] = project.version
}
tasks.test {
useJUnitPlatform {
excludeTags("mdgl") // mdgl does not work without at least one mixin
}
testLogging {
// Log all standard lifecycle events: PASSED, FAILED, SKIPPED
events("passed", "failed", "skipped")
// For failed tests, show the full stack trace
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
// Show any output streams (println, etc.) from the tests
showStandardStreams = true
}
}
idea {
module {
isDownloadJavadoc = true
isDownloadSources = true
}
}
val releasePlugin by tasks.registering {
group = "modstitch"
dependsOn("publishPlugins")
dependsOn("publishAllPublicationsToXanderReleasesRepository")
}