-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.gradle
87 lines (75 loc) · 2.74 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
plugins {
id "org.jetbrains.kotlin.jvm" version "1.9.0" apply false
id "org.jetbrains.kotlin.plugin.serialization" version "1.9.0" apply false
}
allprojects {
group = "com.github.topi314.lavalyrics"
repositories {
mavenLocal()
mavenCentral()
maven { url "https://maven.arbjerg.dev/releases" }
maven { url "https://jitpack.io" }
jcenter()
}
}
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]
}
var isMavenDefined = findProperty("MAVEN_USERNAME") != null && findProperty("MAVEN_PASSWORD") != null
var isLavalinkMavenDefined = findProperty("LAVALINK_MAVEN_USERNAME") != null && findProperty("LAVALINK_MAVEN_PASSWORD") != null
subprojects {
if (name != "protocol") {
apply plugin: "java"
compileJava.options.encoding = "UTF-8"
}
apply plugin: "maven-publish"
def (versionStr, isSnapshot) = getGitVersion()
version versionStr
println "Version: " + versionStr
publishing {
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 == "plugin") {
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")
}
}
}
}
}
}