-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
104 lines (86 loc) · 2.47 KB
/
build.gradle.kts
File metadata and controls
104 lines (86 loc) · 2.47 KB
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
plugins {
id("java-library")
id("maven-publish")
id("com.github.johnrengelman.shadow") version "8.1.1"
}
group = "dev.rollczi"
version = "2.0.0"
repositories {
mavenCentral()
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
maven("https://maven.enginehub.org/repo/")
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
dependencies {
compileOnly("org.jetbrains:annotations:26.0.2")
compileOnly("org.spigotmc:spigot-api:1.20.2-R0.1-SNAPSHOT")
compileOnly("com.mojang:authlib:1.5.25")
testImplementation("org.awaitility:awaitility:4.3.0")
testImplementation("org.spigotmc:spigot-api:1.20.2-R0.1-SNAPSHOT")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.12.2")
testImplementation("org.assertj:assertj-core:3.27.3")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.11.4")
}
publishing {
java {
withSourcesJar()
withJavadocJar()
}
repositories {
mavenLocal()
maven(
name = "eternalcode",
url = "https://repo.eternalcode.pl",
username = "ETERNAL_CODE_MAVEN_USERNAME",
password = "ETERNAL_CODE_MAVEN_PASSWORD",
snapshots = true,
beta = true,
)
}
publications {
create<MavenPublication>("maven") {
artifactId = "liteskullapi"
from(project.components["java"])
}
}
}
fun RepositoryHandler.maven(
name: String,
url: String,
username: String,
password: String,
snapshots: Boolean = true,
beta: Boolean = false
) {
val isSnapshot = version.toString().endsWith("-SNAPSHOT")
if (isSnapshot && !snapshots) {
return
}
val isBeta = version.toString().contains("-BETA")
if (isBeta && !beta) {
return
}
this.maven {
this.name =
if (isSnapshot) "${name}Snapshots"
else "${name}Releases"
this.url =
if (isSnapshot) uri("$url/snapshots")
else uri("$url/releases")
this.credentials {
this.username = System.getenv(username)
this.password = System.getenv(password)
}
}
}
tasks.getByName<Test>("test") {
useJUnitPlatform()
maxParallelForks = Runtime.getRuntime().availableProcessors()
tasks.withType<JavaCompile>().configureEach {
options.isFork = true
options.compilerArgs.add("-parameters")
}
}