-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
112 lines (92 loc) · 2.63 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
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.net.URI
plugins {
kotlin("jvm") version "1.8.21"
id("com.github.johnrengelman.shadow") version "8.0.0"
`java-gradle-plugin`
`maven-publish`
}
version = if (project.hasProperty("version_snapshot")) project.properties["version"] as String + "-SNAPSHOT" else project.properties["version"] as String
group = project.properties["maven_group"] as String
base {
archivesName.set(project.properties["archives_base_name"] as String)
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
repositories {
mavenCentral()
maven("https://maven.minecraftforge.net/")
maven("https://maven.fabricmc.net/")
gradlePluginPortal()
}
configurations {
create("shadowOnly")
}
dependencies {
testImplementation(kotlin("test"))
"shadowOnly"(project(":server"))
}
tasks.withType<JavaCompile> {
val targetVersion = 8
if (JavaVersion.current().isJava9Compatible) {
options.release.set(targetVersion)
}
}
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
// compilerOptions {
// freeCompilerArgs.add("-Xjvm-default=all")
// }
}
tasks.jar {
from(
sourceSets["main"].output
)
manifest {
attributes(
"Implementation-Version" to project.version
)
}
}
tasks.shadowJar {
configurations = listOf(project.configurations["shadowOnly"])
archiveClassifier.set("")
}
tasks.build.get().finalizedBy(tasks.shadowJar)
tasks.test {
useJUnitPlatform()
}
gradlePlugin {
plugins {
create("simplePlugin") {
id = "xyz.wagyourtail.mchotswap"
implementationClass = "xyz.wagyourtail.mchotswap.McHotswapPlugin"
}
}
}
publishing {
repositories {
maven {
name = "WagYourMaven"
url = if (project.hasProperty("version_snapshot")) {
URI.create("https://maven.wagyourtail.xyz/snapshots/")
} else {
URI.create("https://maven.wagyourtail.xyz/releases/")
}
credentials {
username = project.findProperty("mvn.user") as String? ?: System.getenv("USERNAME")
password = project.findProperty("mvn.key") as String? ?: System.getenv("TOKEN")
}
}
}
publications {
create<MavenPublication>("maven") {
groupId = project.group as String
artifactId = project.properties["archives_base_name"] as String? ?: project.name
version = project.version as String
from(components["java"])
}
}
}