-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
153 lines (135 loc) · 4.82 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
153 lines (135 loc) · 4.82 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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins {
kotlin("jvm") version "2.3.0"
id("java")
id("java-library")
id("maven-publish")
id("com.gradleup.shadow") version "9.3.1"
id("com.willfp.libreforge-gradle-plugin") version "2.0.0"
}
group = "com.willfp"
version = findProperty("version")!!
val libreforgeVersion = findProperty("libreforge-version")
val ecoApiVersion = findProperty("eco-api-version")
val ecoVersion = findProperty("eco-version")
base {
archivesName.set(project.name)
}
dependencies {
project.project(project(":eco-core").path).subprojects {
implementation(this)
}
}
publishing {
publications {
// maven-private: the libreforge jar (shaded plugin with libreforge embedded)
create<MavenPublication>("private") {
artifactId = rootProject.name
}
// maven-releases (served publicly via the maven-public group): the API jar
create<MavenPublication>("release") {
artifactId = rootProject.name
}
}
repositories {
maven {
name = "Auxilor"
url = uri("https://repo.auxilor.io/repository/maven-private/")
credentials {
username = System.getenv("MAVEN_USERNAME")
password = System.getenv("MAVEN_PASSWORD")
}
}
// maven-public is a group repo and rejects uploads (405) - deploy to the
// hosted maven-releases repo, which the group serves.
maven {
name = "AuxilorReleases"
url = uri("https://repo.auxilor.io/repository/maven-releases/")
credentials {
username = System.getenv("MAVEN_USERNAME")
password = System.getenv("MAVEN_PASSWORD")
}
}
}
}
// Neither publication is attached to a software component, so only the single jar
// and its pom are published - no sources, javadoc, or classified variants.
afterEvaluate {
publishing.publications.named<MavenPublication>("private") {
artifact(tasks.named("libreforgeJar"))
}
// The public artifact is what other plugins compile against, so it must be the
// plain jar, not shadowJar: shadowJar drops META-INF (taking the .kotlin_module
// with it, which hides every top-level declaration from the Kotlin compiler) and
// relocates kotlin.* into com.willfp.eco.libs.kotlin, which rewrites @kotlin.Metadata
// and makes the whole API read as Java. eco publishes its API the same way.
publishing.publications.named<MavenPublication>("release") {
artifact(project(":eco-core:core-plugin").tasks.named<Jar>("jar")) {
classifier = ""
}
}
}
tasks.matching { it.name.startsWith("generatePomFileFor") }.configureEach {
mustRunAfter(tasks.named("clean"))
}
tasks.register("publishToAuxilor") {
dependsOn(
"publishPrivatePublicationToAuxilorRepository",
"publishReleasePublicationToAuxilorReleasesRepository",
)
}
allprojects {
apply(plugin = "java")
apply(plugin = "kotlin")
apply(plugin = "maven-publish")
apply(plugin = "com.gradleup.shadow")
repositories {
mavenLocal()
mavenCentral()
maven("https://repo.papermc.io/repository/maven-public/")
maven("https://repo.auxilor.io/repository/maven-public/")
maven("https://jitpack.io")
}
dependencies {
compileOnly("com.willfp:eco:$ecoVersion")
compileOnly("org.jetbrains:annotations:26.0.2")
compileOnly("org.jetbrains.kotlin:kotlin-stdlib:2.3.0")
}
java {
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
}
tasks {
shadowJar {
exclude("META-INF/**")
relocate("com.willfp.libreforge.loader", "com.willfp.ecoshop.libreforge.loader")
relocate("com.willfp.ecomponent", "com.willfp.ecoshop.ecomponent")
relocate("kotlin", "com.willfp.eco.libs.kotlin")
relocate("kotlin.jvm", "com.willfp.eco.libs.kotlin.jvm")
relocate("kotlin.coroutines", "com.willfp.eco.libs.kotlin.coroutines")
relocate("kotlin.reflect", "com.willfp.eco.libs.kotlin.reflect")
}
compileKotlin {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_21)
}
}
compileJava {
options.isDeprecation = true
options.encoding = "UTF-8"
dependsOn(clean)
}
processResources {
filesMatching(listOf("**plugin.yml", "**eco.yml")) {
expand(
"version" to project.version,
"libreforgeVersion" to libreforgeVersion!!,
"ecoApiVersion" to ecoApiVersion!!,
"pluginName" to rootProject.name
)
}
}
build {
dependsOn(shadowJar)
}
}
}