-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.gradle.kts
137 lines (122 loc) · 4.28 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
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
plugins {
`maven-publish`
`java-library`
id("java")
id("com.github.johnrengelman.shadow") version "8.1.1"
id("com.github.harbby.gradle.serviceloader") version ("1.1.8")
}
group = "net.cytonic"
version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
mavenLocal()
maven("https://jitpack.io")
maven("https://repo.foxikle.dev/cytonic")
}
dependencies {
api("net.cytonic:CytosisPluginProcessor:1.0")
api("net.minestom:minestom-snapshots:698af959c8")
api("com.google.code.gson:gson:2.11.0") // serializing
api("com.squareup.okhttp3:okhttp:4.12.0") // http api requests
implementation("net.kyori:adventure-text-minimessage:4.18.0")// better components
implementation("com.mysql:mysql-connector-j:9.1.0") //mysql connector
compileOnly("org.projectlombok:lombok:1.18.36") // lombok
annotationProcessor("org.projectlombok:lombok:1.18.36") // lombok
implementation("org.tomlj:tomlj:1.1.1") // Config lang
api("com.rabbitmq:amqp-client:5.24.0") // Message broker
api("dev.hollowcube:polar:1.12.1") // Polar
api("redis.clients:jedis:5.2.0") // redis client
api("com.google.guava:guava:33.4.0-jre")
implementation("org.reflections:reflections:0.10.2") // reflection utils
implementation("org.slf4j:slf4j-api:2.0.16") // SLF4J API
implementation("org.apache.logging.log4j:log4j-core:2.24.3") // Log4j core
implementation("org.apache.logging.log4j:log4j-slf4j2-impl:2.24.3")
implementation("io.nats:jnats:2.20.5")
}
tasks.withType<Jar> {
manifest {
attributes["Main-Class"] = "net.cytonic.cytosis.Cytosis"
}
}
tasks.withType<JavaCompile> {
// use String templates
options.compilerArgs.add("--enable-preview")
}
tasks.withType<Javadoc> {
val javadocOptions = options as CoreJavadocOptions
javadocOptions.addStringOption("source", "21")
javadocOptions.addBooleanOption("-enable-preview", true)
}
tasks {
assemble {
dependsOn("shadowJar")
dependsOn("copyShadowJarToSecondary")
}
named<ShadowJar>("shadowJar") {
manifest {
attributes["Main-Class"] = "net.cytonic.cytosis.Cytosis"
}
mergeServiceFiles()
archiveFileName.set("cytosis.jar")
archiveClassifier.set("")
destinationDirectory.set(
file(
providers.gradleProperty("server_dir").orElse(destinationDirectory.get().toString())
)
)
}
}
tasks.register<Copy>("copyShadowJarToSecondary") {
dependsOn(tasks.shadowJar)
if (providers.gradleProperty("server_dir2").isPresent) {
from(tasks.shadowJar.get().archiveFile)
into(providers.gradleProperty("server_dir2"))
}
}
val javadocJar = tasks.register<Jar>("javadocJar") {
archiveClassifier.set("javadoc")
from(tasks.javadoc)
}
val sourcesJar = tasks.register<Jar>("sourcesJar") {
archiveClassifier.set("sources")
from(sourceSets.main.get().allJava)
}
publishing {
repositories {
maven {
name = "FoxikleCytonicRepository"
url = uri("https://repo.foxikle.dev/cytonic")
// credentials(PasswordCredentials::class)
// Use providers to get the properties or fallback to environment variables
var u = System.getenv("REPO_USERNAME")
var p = System.getenv("REPO_PASSWORD")
if (u == null || u.isEmpty()) {
u = "no-value-provided"
}
if (p == null || p.isEmpty()) {
p = "no-value-provided"
}
val user = providers.gradleProperty("FoxikleCytonicRepositoryUsername").orElse(u).get()
val pass = providers.gradleProperty("FoxikleCytonicRepositoryPassword").orElse(p).get()
credentials {
username = user
password = pass
}
authentication {
create<BasicAuthentication>("basic") {
}
}
}
}
publications {
create<MavenPublication>("maven") {
groupId = project.group.toString()
artifactId = project.name
version = project.version.toString()
artifact(tasks["shadowJar"])
artifact(javadocJar)
artifact(sourcesJar)
}
}
}