This repository has been archived by the owner on Apr 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
157 lines (129 loc) · 4 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
plugins {
id 'java'
id "maven-publish"
id "com.github.johnrengelman.shadow" version '8.1.1' apply false
}
allprojects {
apply plugin: "java"
group = rootProject.maven_group
version = rootProject.release_version
base.archivesName = "${rootProject.archives_base_name}-${project.name}"
repositories {
mavenLocal()
mavenCentral()
maven {
name = "JitPack"
url = "https://jitpack.io/"
}
maven {
name = "Papi"
url = "https://repo.extendedclip.com/content/repositories/placeholderapi/"
}
maven {
name = "CodeMC"
url = "https://repo.codemc.org/repository/maven-public/"
}
maven {
name = "spigotmc-repo"
url = "https://hub.spigotmc.org/nexus/content/repositories/snapshots/"
}
maven {
name = "papermc-repo"
url = "https://repo.papermc.io/repository/maven-public/"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/groups/public/"
}
}
def targetJavaVersion = 17
java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
withSourcesJar()
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
options.release.set(targetJavaVersion)
}
}
compileJava.dependsOn(clean)
jar {
archiveClassifier.set "dev"
zip64 true
}
sourcesJar {
archiveClassifier.set "dev-source"
zip64 true
duplicatesStrategy DuplicatesStrategy.EXCLUDE
}
}
subprojects {
apply plugin: "maven-publish"
apply plugin: "com.github.johnrengelman.shadow"
dependencies {
compileOnly "net.luckperms:api:5.4"
annotationProcessor 'org.projectlombok:lombok:1.18.32'
compileOnly 'org.projectlombok:lombok:1.18.32'
annotationProcessor(testImplementation("org.projectlombok:lombok:1.18.32"))
testImplementation platform('org.junit:junit-bom:5.10.2')
testImplementation 'org.junit.jupiter:junit-jupiter'
}
test {
useJUnitPlatform()
ignoreFailures true
testLogging {
exceptionFormat = 'full'
events "passed", "skipped", "failed"
}
}
shadowJar {
archiveClassifier.set null
zip64 true
}
publishing {
publications {
MavenJava(MavenPublication) {
artifactId = "${rootProject.archives_base_name}-${project.name}"
from components.java
}
}
repositories {
mavenLocal()
}
}
}
tasks.register("buildArtifacts") {
subprojects {
dependsOn project.tasks.named("build").get()
dependsOn project.tasks.named("shadowJar").get()
}
doFirst {
logger.lifecycle(":executing 2 steps to build artifacts")
logger.lifecycle(":step1 clean buildLibs of rootProject")
delete fileTree(rootProject.buildDir.toPath().resolve("libs")) {
include '*'
}
logger.lifecycle(":step2 copy buildLibs from subprojects")
subprojects {
if (project.name != "common") {
copy {
from(project.buildDir.toPath().resolve("libs")) {
include "*.jar"
exclude "*-dev.jar", "*-dev-source.jar"
}
into(rootProject.buildDir.toPath().resolve("libs"))
duplicatesStrategy DuplicatesStrategy.EXCLUDE
}
}
}
}
doLast {
logger.lifecycle(":buildArtifacts done")
}
}