-
Notifications
You must be signed in to change notification settings - Fork 18
/
build.gradle.kts
128 lines (109 loc) · 4.58 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
plugins {
id("java")
id("idea")
id("eclipse")
id("maven-publish")
id("org.ajoberstar.grgit.service") version "5.2.0"
}
val pluginVersion: String by project
group = "io.th0rgal"
version = pluginVersion
repositories {
mavenCentral()
//mavenLocal()
maven("https://repo.codemc.org/repository/maven-public/")
maven("https://repo.oraxen.com/releases")
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
maven("https://ci.ender.zone/plugin/repository/everything/")
maven("https://repo.glaremasters.me/repository/towny/")
maven("https://maven.enginehub.org/repo/")
maven("https://repo.papermc.io/repository/maven-public/")
maven("https://jitpack.io")
maven("https://repo.william278.net/releases")
}
dependencies {
compileOnly("world.bentobox:bentobox:2.0.0-SNAPSHOT")
compileOnly("org.spigotmc:spigot-api:1.20.4-R0.1-SNAPSHOT")
compileOnly("com.sk89q.worldguard:worldguard-bukkit:7.1.0-SNAPSHOT")
compileOnly("com.palmergames.bukkit.towny:towny:0.100.1.0")
compileOnly("com.massivecraft:Factions:1.6.9.5-U0.6.11") {
exclude("org.kitteh:paste-gg-api")
exclude("com.darkblade12:particleeffect")
exclude("org.spongepowered:configurate-hocon")
exclude("com.mojang:brigadier")
}
compileOnly("com.github.angeschossen:LandsAPI:7.0.2")
implementation(platform("com.intellectualsites.bom:bom-1.18.x:1.20"))
compileOnly("com.plotsquared:PlotSquared-Core")
compileOnly("com.plotsquared:PlotSquared-Bukkit")
//compileOnly("com.github.TechFortress:GriefPrevention:16.18")
implementation(files("libs/GriefPrevention-16.18.jar"))
compileOnly("net.william278.huskclaims:huskclaims-bukkit:1.4")
compileOnly("net.william278.husktowns:husktowns-bukkit:3.0.4")
compileOnly(files("libs/NoBuildPlus-1.4.9.jar"))
compileOnly(files("libs/Residence5.1.6.2.jar"))
compileOnly("net.crashcraft:CrashClaim:1.0.43")
}
java {
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
}
tasks {
compileJava.get().dependsOn(clean)
}
publishing {
val publishData = PublishData(project)
publications {
create<MavenPublication>("maven") {
groupId = rootProject.group.toString()
artifactId = rootProject.name
version = publishData.getVersion()
from(components["java"])
}
}
repositories {
maven {
authentication {
credentials(PasswordCredentials::class) {
username = System.getenv("MAVEN_USERNAME") ?: (project.findProperty("oraxenUsername") as? String ?: "defaultUsername")
password = System.getenv("MAVEN_PASSWORD") ?: (project.findProperty("oraxenPassword") as? String ?: "defaultPassword")
}
authentication {
create<BasicAuthentication>("basic")
}
}
url = uri(publishData.getRepository())
name = "oraxen"
this.isAllowInsecureProtocol = true
}
}
}
class PublishData(private val project: Project) {
var type: Type = getReleaseType()
var hashLength: Int = 7
private fun getReleaseType(): Type {
val branch = getCheckedOutBranch()
println("Branch: $branch")
return when {
branch.contentEquals("master") -> Type.RELEASE
branch.contentEquals("develop") -> Type.SNAPSHOT
else -> Type.DEV
}
}
private fun getCheckedOutGitCommitHash(): String =
System.getenv("GITHUB_SHA")?.substring(0, hashLength) ?: "local"
private fun getCheckedOutBranch(): String =
System.getenv("GITHUB_REF")?.replace("refs/heads/", "") ?: grgitService.service.get().grgit.branch.current().name
fun getVersion(): String = getVersion(false)
fun getVersion(appendCommit: Boolean): String =
type.append(getVersionString(), appendCommit, getCheckedOutGitCommitHash())
private fun getVersionString(): String =
(rootProject.version as String).replace("-SNAPSHOT", "").replace("-DEV", "")
fun getRepository(): String = type.repo
enum class Type(private val append: String, val repo: String, private val addCommit: Boolean) {
RELEASE("", "http://repo.oraxen.com:8080/releases/", false),
DEV("-DEV", "http://repo.oraxen.com:8080/development/", true),
SNAPSHOT("-SNAPSHOT", "http://repo.oraxen.com:8080/snapshots/", true);
fun append(name: String, appendCommit: Boolean, commitHash: String): String =
name.plus(append).plus(if (appendCommit && addCommit) "-".plus(commitHash) else "")
}
}