This repository has been archived by the owner on Nov 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
139 lines (116 loc) · 3.69 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
plugins {
id 'java'
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'maven-publish'
}
group = 'xyz.hynse'
version = '1.2-SNAPSHOT-2'
repositories {
mavenCentral()
maven {
name = "papermc-repo"
url = "https://repo.papermc.io/repository/maven-public/"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/groups/public/"
}
maven {
url = 'https://repo.extendedclip.com/content/repositories/placeholderapi/'
}
}
dependencies {
compileOnly "dev.folia:folia-api:1.20.1-R0.1-SNAPSHOT"
// Use a relocated version of HikariCP
implementation 'com.zaxxer:HikariCP:5.0.1'
// Add the MariaDB JDBC driver
implementation 'org.mariadb.jdbc:mariadb-java-client:3.2.0'
//Mini Message
implementation 'net.kyori:adventure-text-minimessage:4.14.0'
compileOnly 'me.clip:placeholderapi:2.11.4'
// Define a configuration for the lib folder
configurations {
lib
}
// Add the lib folder as a runtime dependency for the Minecraft server
dependencies {
runtimeOnly files(configurations.lib.collect { "${project.projectDir}/lib/${it.name}" })
}
shadowJar {
// Relocate the HikariCP package
relocate 'com.zaxxer.hikari', 'xyz.hynse.hyeconomy.hikari'
// Relocate the PlaceholderAPI package
relocate 'me.clip:placeholderapi', 'xyz.hynse.hyeconomy.placeholderapi'
}
}
publishing {
repositories {
maven {
name = "HynseAPI"
url = uri("https://repo.hynse.xyz/releases")
credentials {
authentication {
username = project.findProperty("HynseRepositoryUsername")
password = project.findProperty("HynseRepositoryPassword")
}
}
}
}
publications {
mavenJava(MavenPublication) {
groupId = group
artifactId = project.findProperty("HynseRepositoryArtifact")
version = project.version
from(components["java"])
}
}
}
javadoc {
destinationDir = file("${buildDir}/javadocs")
source = sourceSets.main.allJava
}
def targetJavaVersion = 17
java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
}
tasks.withType(JavaCompile).configureEach {
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
options.release = targetJavaVersion
}
}
// Define a new configuration 'libConfig' that extends 'implementation' and is resolvable
configurations {
libConfig {
canBeResolved = true
extendsFrom implementation
}
}
// Define the task to copy the MariaDB JDBC driver to the lib folder
tasks.register('copyMariaDBDriver', Copy) {
from configurations.libConfig
into 'lib'
}
// Ensure that the copy task is executed before building the shadow JAR
shadowJar.dependsOn copyMariaDBDriver
processResources {
def props = [version: version]
inputs.properties props
filteringCharset 'UTF-8'
filesMatching('plugin.yml') {
expand props
}
}
tasks.register('deploy', Exec) {
dependsOn shadowJar
// Build the destination directory based on group and version
def destinationDir = "/home/mid/hynse/devtest/plugins/"
commandLine 'scp', '-i', "~/.ssh/lynse", '-P', '24', "./build/libs/${project.name}-${project.version}-all.jar", "mid@ssh.lynse:${destinationDir}"
}
tasks.register('installondevtest') {
dependsOn 'build', 'jar', 'shadowJar', 'deploy'
}