-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
110 lines (91 loc) · 2.5 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
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import kotlin.io.path.Path
plugins {
id("java")
id("maven-publish")
id("io.freefair.lombok") version "8.10"
id("com.gradleup.shadow") version "8.3.0"
}
object Project {
const val NAME = "CommandAPI"
const val GROUP = "net.j4c0b3y"
const val AUTHOR = "J4C0B3Y"
const val VERSION = "1.0.0"
}
allprojects {
repositories {
mavenCentral()
}
}
subprojects {
apply(plugin = "java")
apply(plugin = "io.freefair.lombok")
apply(plugin = "com.gradleup.shadow")
apply(plugin = "maven-publish")
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
withSourcesJar()
}
dependencies {
if (name != "core") {
implementation(project(":core"))
}
}
tasks {
register<Copy>("copy") {
from(named("shadowJar"))
rename("(.*)-all.jar", "${Project.NAME}-${[email protected]}-${Project.VERSION}.jar")
into(Path(rootDir.path, "jars"))
}
named<JavaCompile>("compileJava") {
options.encoding = "UTF-8"
}
}
publishing {
repositories {
maven {
name = "j4c0b3yPublic"
url = uri("https://repo.j4c0b3y.net/public")
credentials(PasswordCredentials::class)
authentication {
create<BasicAuthentication>("basic")
}
}
}
publications {
create<MavenPublication>("release") {
artifactId = [email protected]
groupId = "${Project.GROUP}.${Project.NAME}"
version = Project.VERSION
artifact(tasks.named<ShadowJar>("shadowJar").get().archiveFile)
artifact(tasks.named<Jar>("sourcesJar").get().archiveFile) {
classifier = "sources"
}
}
}
}
}
tasks {
named("classes") {
depend(this)
}
register("shadow") {
depend(this, "shadowJar")
}
register("delete") {
file("jars").deleteRecursively()
}
register("copy") {
depend(this)
}
named("clean") {
depend(this)
}
register("install") {
depend(this, "publishReleasePublicationToMavenLocal")
}
}
fun depend(task: Task, name: String = task.name) {
task.dependsOn(subprojects.map { it.tasks.named(name) })
}