generated from lavalink-devs/lavalink-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
123 lines (105 loc) · 2.79 KB
/
build.gradle
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
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins {
id "java"
id "maven-publish"
id "dev.arbjerg.lavalink.gradle-plugin" version "1.0.15"
id "org.jetbrains.kotlin.jvm" version "1.9.0"
id "org.jetbrains.kotlin.plugin.serialization" version "1.9.0"
}
group "com.github.topi314.sponsorblock"
def (versionStr, isSnapshot) = getGitVersion()
allprojects {
version versionStr
}
println "Version: " + versionStr
archivesBaseName = "sponsorblock-plugin"
lavalinkPlugin {
name = "sponsorblock-plugin"
apiVersion = "4.0.0"
serverVersion = "4.0.0"
}
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
compileJava.options.encoding = "UTF-8"
compileJava.options.compilerArgs.add("-parameters")
allprojects {
repositories {
mavenCentral()
jcenter()
}
}
var isMavenDefined = findProperty("MAVEN_USERNAME") != null && findProperty("MAVEN_PASSWORD") != null
var isLavalinkMavenDefined = findProperty("LAVALINK_MAVEN_USERNAME") != null && findProperty("LAVALINK_MAVEN_PASSWORD") != null
dependencies {
implementation(projects.protocol)
}
allprojects {
publishing {
publications {
withType(MavenPublication).configureEach {
artifactId(artifactId.toLowerCase())
}
}
repositories {
if (isMavenDefined) {
System.out.println("Publishing to Maven Repo")
def snapshots = "https://maven.topi.wtf/snapshots"
def releases = "https://maven.topi.wtf/releases"
maven {
name = "Reposilite"
url = isSnapshot ? snapshots : releases
credentials {
username = findProperty("MAVEN_USERNAME")
password = findProperty("MAVEN_PASSWORD")
}
}
}
if (isLavalinkMavenDefined && name != "protocol") {
System.out.println("Publishing to Lavalink Maven Repo")
def lavalinkSnapshots = "https://maven.lavalink.dev/snapshots"
def lavalinkReleases = "https://maven.lavalink.dev/releases"
maven {
name = "Reposilite-Lavalink"
url = isSnapshot ? lavalinkSnapshots : lavalinkReleases
credentials {
username = findProperty("LAVALINK_MAVEN_USERNAME")
password = findProperty("LAVALINK_MAVEN_PASSWORD")
}
}
}
}
}
}
def getGitVersion() {
def versionStr = new ByteArrayOutputStream()
def result = exec {
standardOutput versionStr
errorOutput versionStr
ignoreExitValue true
commandLine "git", "describe", "--exact-match", "--tags"
}
if (result.exitValue == 0) {
return [versionStr.toString().trim(), false]
}
versionStr = new ByteArrayOutputStream()
exec {
standardOutput versionStr
errorOutput versionStr
commandLine "git", "rev-parse", "--short", "HEAD"
}
return [versionStr.toString().trim(), true]
}
kotlin {
compilerOptions {
jvmTarget = JvmTarget.JVM_17
}
}
sourceSets {
main {
resources {
srcDir("build/generated/lavalink/main/resources")
}
}
}