-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
137 lines (113 loc) · 3.58 KB
/
build.gradle.kts
File metadata and controls
137 lines (113 loc) · 3.58 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
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
@file:Suppress("VulnerableLibrariesLocal")
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
plugins {
alias(libs.plugins.shadow) apply(false)
alias(libs.plugins.lombok) apply(false)
alias(libs.plugins.reproducible.builds) apply(false)
}
group = "org.polyfrost.oneconfig"
allprojects {
apply(plugin = "maven-publish")
apply(plugin = "org.gradlex.reproducible-builds")
group = rootProject.group
configure<PublishingExtension> {
afterEvaluate {
publications.withType<MavenPublication> {
version = project.version.toString()
}
}
repositories {
mavenLocal()
mapOf(
"polyfrostReleases" to "basic",
"polyfrostSnapshots" to "basic",
"polyfrostPrivate" to "private"
).forEach { (channel, authMethod) ->
maven {
name = channel
setUrl("https://repo.polyfrost.org/${channel.removePrefix("polyfrost").lowercase()}")
credentials(PasswordCredentials::class)
authentication {
create<BasicAuthentication>(authMethod)
}
}
}
}
}
}
subprojects {
apply(plugin = "java-library")
apply(plugin = "idea")
apply(plugin = "com.gradleup.shadow")
apply(plugin = "io.freefair.lombok")
val compileOnly by configurations
val include by configurations.registering {
compileOnly.extendsFrom(this)
}
val sourceSets = extensions.getByName<SourceSetContainer>("sourceSets")
configure<JavaPluginExtension> {
withSourcesJar()
withJavadocJar()
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_1_8
}
dependencies {
compileOnly(rootProject.libs.bundles.subproject)
}
if (project.name !== "common") {
val main by sourceSets
val mock by sourceSets.creating {
compileClasspath += main.compileClasspath
}
main.compileClasspath += mock.output
}
configure<PublishingExtension> {
publications {
register<MavenPublication>("mavenJava") {
artifactId = project.name
group = project.group
version = project.version.toString()
artifact(tasks.named("shadowJar"))
artifact(tasks.named("sourcesJar"))
}
}
}
tasks {
withType<Javadoc> {
options {
this as StandardJavadocDocletOptions
addStringOption("Xdoclint:none", "-quiet")
}
}
named<Jar>("jar") {
manifest.attributes += mapOf(
"Specification-Title" to "OneConfig Loader",
"Specification-Vendor" to "Polyfrost",
"Specification-Version" to "2.0.0",
"Implementation-Title" to "loader-${project.name}",
"Implementation-Vendor" to project.group,
"Implementation-Version" to project.version,
"Implementation-License" to "GPL-3.0",
"Implementation-Source" to "https://github.com/Polyfrost/OneConfigLoader",
"Implementation-Website" to "https://polyfrost.org",
)
}
named<ShadowJar>("shadowJar") {
configurations = listOf(include.get())
}
val assemble by this
withType(ShadowJar::class) {
assemble.dependsOn(this)
}
fun applyCompilerOptions(compileOptions: JavaCompile) {
compileOptions.targetCompatibility = "1.8"
compileOptions.sourceCompatibility = "1.8"
}
named<JavaCompile>("compileJava") {
applyCompilerOptions(this)
}
withType<JavaCompile> {
applyCompilerOptions(this)
}
}
}