Skip to content

Commit dd84b42

Browse files
committed
Merge branch 'master' into dev
2 parents fe31640 + e2281a4 commit dd84b42

File tree

10 files changed

+116
-231
lines changed

10 files changed

+116
-231
lines changed

LavalinkServer/build.gradle.kts

Lines changed: 19 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1+
import com.vanniktech.maven.publish.JavadocJar
2+
import com.vanniktech.maven.publish.KotlinJvm
13
import org.apache.tools.ant.filters.ReplaceTokens
24
import org.springframework.boot.gradle.tasks.bundling.BootJar
35
import org.springframework.boot.gradle.tasks.run.BootRun
46

57
plugins {
68
application
7-
`maven-publish`
89
kotlin("jvm")
910
id("org.jetbrains.dokka")
11+
alias(libs.plugins.maven.publish.base)
1012
}
1113

1214
apply(plugin = "org.springframework.boot")
@@ -15,28 +17,17 @@ apply(plugin = "org.ajoberstar.grgit")
1517
apply(plugin = "com.adarshr.test-logger")
1618
apply(plugin = "kotlin")
1719
apply(plugin = "kotlin-spring")
18-
apply(from = "../repositories.gradle")
1920

2021
val archivesBaseName = "Lavalink"
2122
group = "dev.arbjerg.lavalink"
2223
description = "Play audio to discord voice channels"
2324

2425
application {
25-
mainClass.set("lavalink.server.Launcher")
26+
mainClass = "lavalink.server.Launcher"
2627
}
2728

2829
java {
2930
sourceCompatibility = JavaVersion.VERSION_17
30-
targetCompatibility = JavaVersion.VERSION_17
31-
withJavadocJar()
32-
withSourcesJar()
33-
}
34-
35-
val dokkaJar by tasks.registering(Jar::class) {
36-
group = JavaBasePlugin.DOCUMENTATION_GROUP
37-
description = "Assembles Javadoc with Dokka"
38-
archiveClassifier.set("javadoc")
39-
from(tasks.dokkaJavadoc)
4031
}
4132

4233
configurations {
@@ -104,11 +95,11 @@ tasks {
10495

10596
// https://stackoverflow.com/questions/41444916/multiple-artifacts-issue-with-deploying-zip-to-nexus
10697
named<AbstractArchiveTask>("bootDistTar") {
107-
archiveClassifier.set("bootTar")
98+
archiveClassifier = "bootTar"
10899
}
109100

110101
named<AbstractArchiveTask>("bootDistZip") {
111-
archiveClassifier.set("bootZip")
102+
archiveClassifier = "bootZip"
112103
}
113104

114105
named<Test>("test") {
@@ -125,16 +116,16 @@ tasks {
125116
}
126117
})
127118

128-
archiveBaseName.set("lavaplayer-natives")
129-
archiveClassifier.set("musl")
119+
archiveBaseName = "lavaplayer-natives"
120+
archiveClassifier = "musl"
130121
}
131122

132123

133124
withType<BootJar> {
134-
archiveFileName.set("Lavalink.jar")
125+
archiveFileName = "Lavalink.jar"
135126

136127
if (findProperty("targetPlatform") == "musl") {
137-
archiveFileName.set("Lavalink-musl.jar")
128+
archiveFileName = "Lavalink-musl.jar"
138129
// Exclude base dependency jar
139130
exclude {
140131
it.name.contains("lavaplayer-natives-fork") || (it.name.contains("udpqueue-native-") && !it.name.contains("musl"))
@@ -162,39 +153,18 @@ tasks {
162153
}
163154
}
164155

156+
mavenPublishing {
157+
configure(KotlinJvm(JavadocJar.Dokka("dokkaHtml")))
158+
pom {
159+
name = "Lavalink Server"
160+
description = "Lavalink Server"
161+
}
162+
}
163+
165164
publishing {
166165
publications {
167-
create<MavenPublication>("LavalinkServer") {
166+
named<MavenPublication>("maven") {
168167
artifact(tasks.named("bootJar"))
169-
artifact(tasks.kotlinSourcesJar)
170-
artifact(dokkaJar)
171-
172-
pom {
173-
name.set("Lavalink Server")
174-
description.set("Lavalink Server")
175-
url.set("https://github.com/lavalink-devs/lavalink")
176-
177-
licenses {
178-
license {
179-
name.set("The MIT License")
180-
url.set("https://github.com/lavalink-devs/Lavalink/blob/master/LICENSE")
181-
}
182-
}
183-
184-
developers {
185-
developer {
186-
id.set("freyacodes")
187-
name.set("Freya Arbjerg")
188-
url.set("https://www.arbjerg.dev")
189-
}
190-
}
191-
192-
scm {
193-
connection.set("scm:git:ssh://github.com/lavalink-devs/lavalink.git")
194-
developerConnection.set("scm:git:ssh://github.com/lavalink-devs/lavalink.git")
195-
url.set("https://github.com/lavalink-devs/lavalink")
196-
}
197-
}
198168
}
199169
}
200170
}

PLUGINS.md

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,35 +21,20 @@ You can add your own plugin by submitting a pull-request to this file.
2121
## Developing your own plugin
2222

2323
> **Note:**
24-
> If your plugin is developed in Kotlin make sure you are using **Kotlin v1.7.20**
24+
> If your plugin is developed in Kotlin make sure you are using **Kotlin v1.8.22**
2525
26-
Follow these steps to quickly get started with plugin development:
27-
1. Create a copy of https://github.com/lavalink-devs/lavalink-plugin-template
28-
2. Rename the directories `org/example/plugin/` under `src/main/java/` to something more specific like
29-
`io/github/yourusername/yourplugin`
30-
3. Rename `src/main/resources/lavalink-plugins/your-plugin.properties` to the name of your plugin. The file must end
31-
with `.properties`. This is the plugin manifest.
32-
4. Fill out the name, path, and version properties in the manifest. The path is where your classes will be loaded from,
33-
e.g. `io.github.yourusername.yourplugin`.
26+
Follow [these steps](https://github.com/lavalink-devs/lavalink-plugin-template#how-to-use-this-template) to setup a new Lavalink plugin
3427

3528
Now you can start writing your plugin. You can test your plugin against Lavalink by running Gradle with the
36-
`:run` Gradle task. The [Gradle documentation](https://docs.gradle.org/current/userguide/userguide.html) might be helpful.
29+
`:runLavalink` Gradle task. The [Gradle plugin documentation](https://github.com/lavalink-devs/lavalink-gradle-plugin#running-the-plugin) might be helpful.
3730

38-
Lavalink has a [plugin API](plugin-api/src/main/java/dev/arbjerg/lavalink/api) which you can integrate with. The API is
39-
provided as an artifact and is used by the template. It is also possible to integrate with internal parts og Lavalink,
31+
Lavalink has a [plugin API](https://javadoc.io/doc/dev.arbjerg.lavalink/plugin-api/latest/dev/arbjerg/lavalink/api/package-summary.html) which you can integrate with. The API is
32+
provided [as an artifact](https://central.sonatype.com/artifact/dev.arbjerg.lavalink/plugin-api) and is used by the template. It is also possible to integrate with internal parts og Lavalink,
4033
but this is not recommended. Instead, open an issue or pull-request to change the API.
4134

42-
Lavalink is configured by plugins using the Spring Boot framework using Spring annotations. For instance, you could define
43-
an extension to the WebSocket API by exposing a Spring bean like this:
35+
Lavalink is configured by plugins using the Spring Boot framework using Spring annotations.
4436

45-
```java
46-
@Service
47-
class MyExtension implements WebSocketExtension {
48-
// ...
49-
}
50-
```
51-
52-
You can also define custom REST endpoints and configuration file properties. See the Spring Boot documentation for
37+
You can define custom REST endpoints and configuration file properties. See the Spring Boot documentation for
5338
[Spring Web MVC](https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#web.servlet) and
5439
[type-safe configuration](https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#features.external-config.typesafe-configuration-properties).
5540

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ A [basic example bot](Testbot) is available.
1111

1212
[![Lavalink Guild](https://discordapp.com/api/guilds/1082302532421943407/embed.png?style=banner2)](https://discord.gg/ZW4s47Ppw4)
1313

14-
> **Warning** Lavalink v4 is now in beta!
15-
> See [here](CHANGELOG.md#400-beta1) for more information.
14+
> [!Warning]
15+
> Lavalink v4 is now in beta! See [here](CHANGELOG.md#400-beta1) for more information.
1616
1717
<details>
1818
<summary>Table of Contents</summary>

Testbot/build.gradle.kts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
plugins {
22
application
3-
43
kotlin("jvm")
54
}
65

76
group = "dev.arbjerg.lavalink"
87
version = "1.0"
98

109
application {
11-
mainClass.set("lavalink.testbot.TestbotKt")
10+
mainClass = "lavalink.testbot.TestbotKt"
1211
}
1312

1413
repositories {

build.gradle.kts

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import com.vanniktech.maven.publish.MavenPublishBaseExtension
2+
import com.vanniktech.maven.publish.SonatypeHost
13
import org.ajoberstar.grgit.Grgit
24
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
35

@@ -11,6 +13,7 @@ plugins {
1113
id("org.jetbrains.kotlin.jvm") version "1.8.22"
1214
id("org.jetbrains.kotlin.plugin.allopen") version "1.8.22"
1315
id("org.jetbrains.kotlin.plugin.serialization") version "1.8.22" apply false
16+
alias(libs.plugins.maven.publish.base) apply false
1417
}
1518

1619
allprojects {
@@ -42,6 +45,65 @@ subprojects {
4245
options.compilerArgs.add("-Xlint:unchecked")
4346
options.compilerArgs.add("-Xlint:deprecation")
4447
}
48+
49+
afterEvaluate {
50+
plugins.withId(libs.plugins.maven.publish.base.get().pluginId) {
51+
configure<PublishingExtension> {
52+
if (findProperty("MAVEN_PASSWORD") != null && findProperty("MAVEN_USERNAME") != null) {
53+
repositories {
54+
val snapshots = "https://maven.arbjerg.dev/snapshots"
55+
val releases = "https://maven.arbjerg.dev/releases"
56+
57+
maven(if ((version as String).endsWith("-SNAPSHOT")) releases else snapshots) {
58+
credentials {
59+
password = findProperty("MAVEN_PASSWORD") as String?
60+
username = findProperty("MAVEN_USERNAME") as String?
61+
}
62+
}
63+
}
64+
} else {
65+
logger.lifecycle("Not publishing to maven.arbjerg.dev because credentials are not set")
66+
}
67+
}
68+
configure<MavenPublishBaseExtension> {
69+
coordinates(group.toString(), project.the<BasePluginExtension>().archivesName.get(), version.toString())
70+
71+
if (findProperty("mavenCentralUsername") != null && findProperty("mavenCentralPassword") != null) {
72+
publishToMavenCentral(SonatypeHost.S01, false)
73+
if (!(version as String).endsWith("-SNAPSHOT")) {
74+
signAllPublications()
75+
}
76+
} else {
77+
logger.lifecycle("Not publishing to OSSRH due to missing credentials")
78+
}
79+
80+
pom {
81+
url = "https://github.com/lavalink-devs/Lavalink"
82+
83+
licenses {
84+
license {
85+
name = "MIT License"
86+
url = "https://github.com/lavalink-devs/Lavalink/blob/main/LICENSE"
87+
}
88+
}
89+
90+
developers {
91+
developer {
92+
id = "freyacodes"
93+
name = "Freya Arbjerg"
94+
url = "https://www.arbjerg.dev"
95+
}
96+
}
97+
98+
scm {
99+
url = "https://github.com/lavalink-devs/Lavalink/"
100+
connection = "scm:git:git://github.com/lavalink-devs/Lavalink.git"
101+
developerConnection = "scm:git:ssh://[email protected]/lavalink-devs/Lavalink.git"
102+
}
103+
}
104+
}
105+
}
106+
}
45107
}
46108

47109
@SuppressWarnings("GrMethodMayBeStatic")
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
44
networkTimeout=10000
55
zipStoreBase=GRADLE_USER_HOME
66
zipStorePath=wrapper/dists

plugin-api/build.gradle.kts

Lines changed: 9 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1+
import com.vanniktech.maven.publish.JavadocJar
2+
import com.vanniktech.maven.publish.KotlinJvm
13
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
24
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
35

46
plugins {
5-
signing
6-
`maven-publish`
77
kotlin("jvm")
88
id("org.jetbrains.dokka")
9+
alias(libs.plugins.maven.publish.base)
910
}
1011

11-
apply(from = "../repositories.gradle")
12-
1312
val archivesBaseName = "plugin-api"
1413
group = "dev.arbjerg.lavalink"
1514

@@ -27,60 +26,15 @@ java {
2726

2827
tasks.withType<KotlinCompile> {
2928
compilerOptions {
30-
jvmTarget.set(JvmTarget.JVM_17)
29+
jvmTarget = JvmTarget.JVM_17
3130
freeCompilerArgs.add("-Xjvm-default=all")
3231
}
3332
}
3433

35-
val dokkaJar by tasks.registering(Jar::class) {
36-
group = JavaBasePlugin.DOCUMENTATION_GROUP
37-
description = "Assembles Javadoc with Dokka"
38-
archiveClassifier.set("javadoc")
39-
from(tasks.dokkaJavadoc)
40-
}
41-
42-
val isGpgKeyDefined = findProperty("signing.gnupg.keyName") != null
43-
44-
publishing {
45-
publications {
46-
create<MavenPublication>("PluginApi") {
47-
from(project.components["java"])
48-
artifact(tasks.kotlinSourcesJar)
49-
artifact(dokkaJar)
50-
51-
pom {
52-
name.set("Lavalink Plugin API")
53-
description.set("API for Lavalink plugin development")
54-
url.set("https://github.com/lavalink-devs/lavalink")
55-
56-
licenses {
57-
license {
58-
name.set("The MIT License")
59-
url.set("https://github.com/lavalink-devs/Lavalink/blob/master/LICENSE")
60-
}
61-
}
62-
63-
developers {
64-
developer {
65-
id.set("freyacodes")
66-
name.set("Freya Arbjerg")
67-
url.set("https://www.arbjerg.dev")
68-
}
69-
}
70-
71-
scm {
72-
connection.set("scm:git:ssh://github.com/lavalink-devs/lavalink.git")
73-
developerConnection.set("scm:git:ssh://github.com/lavalink-devs/lavalink.git")
74-
url.set("https://github.com/lavalink-devs/lavalink")
75-
}
76-
}
77-
}
78-
}
79-
}
80-
81-
if (isGpgKeyDefined) {
82-
signing {
83-
sign(publishing.publications["PluginApi"])
84-
useGpgCmd()
34+
mavenPublishing {
35+
configure(KotlinJvm(JavadocJar.Dokka("dokkaJavadoc")))
36+
pom {
37+
name = "Lavalink Plugin API"
38+
description = "API for Lavalink plugin development"
8539
}
8640
}

0 commit comments

Comments
 (0)