mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-03 06:28:54 +00:00
build script cleanup
This commit is contained in:
1 parent
bef6eff47c
commit
da4b5051ca
11 files changed
+53
-23
No files matched your search
@@ -0,0 +1,20 @@
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.tasks.InputFile
|
||||
import org.gradle.api.tasks.OutputDirectory
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
|
||||
open class FileCopyTask : DefaultTask() {
|
||||
@InputFile
|
||||
val fileToCopy = project.objects.fileProperty()
|
||||
|
||||
@OutputDirectory
|
||||
val destinationDirectory = project.objects.directoryProperty()
|
||||
|
||||
private val destination = project.objects.fileProperty().convention(destinationDirectory.file(fileToCopy.map { it.asFile.name }))
|
||||
|
||||
@TaskAction
|
||||
private fun copyFile() {
|
||||
destinationDirectory.get().asFile.mkdirs()
|
||||
fileToCopy.get().asFile.copyTo(destination.get().asFile, overwrite = true)
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
@@ -0,0 +1,23 @@
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
|
||||
plugins {
|
||||
id("com.github.johnrengelman.shadow")
|
||||
}
|
||||
|
||||
tasks {
|
||||
named<Jar>("jar") {
|
||||
archiveClassifier.set("unshaded")
|
||||
}
|
||||
val shadowJar = named<ShadowJar>("shadowJar") {
|
||||
archiveClassifier.set(null as String?)
|
||||
configureShadowJar()
|
||||
}
|
||||
val copyJar = register<FileCopyTask>("copyJar") {
|
||||
fileToCopy.set(shadowJar.flatMap { it.archiveFile })
|
||||
destinationDirectory.set(rootProject.buildDir.resolve("libs"))
|
||||
dependsOn(shadowJar)
|
||||
}
|
||||
named<DefaultTask>("build") {
|
||||
dependsOn(copyJar)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
const val GITHUB_REPO_URL = "https://github.com/Hexaoxide/Carbon"
|
||||
@@ -0,0 +1,38 @@
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
|
||||
/**
|
||||
* Relocate a package into the `net.draycia.carbon.libs` namespace.
|
||||
*/
|
||||
fun ShadowJar.relocateDependency(pkg: String) {
|
||||
relocate(pkg, "net.draycia.carbon.libs.$pkg")
|
||||
}
|
||||
|
||||
/**
|
||||
* Relocates dependencies which we bundle and relocate on all platforms.
|
||||
*/
|
||||
fun ShadowJar.standardRelocations() {
|
||||
relocateDependency("org.bstats")
|
||||
relocateDependency("net.kyori.adventure.text.minimessage")
|
||||
relocateDependency("net.kyori.adventure.serializer.configurate4")
|
||||
relocateDependency("net.kyori.event")
|
||||
relocateDependency("net.kyori.registry")
|
||||
relocateDependency("cloud.commandframework")
|
||||
relocateDependency("org.spongepowered.configurate")
|
||||
relocateDependency("com.typesafe.config")
|
||||
relocateDependency("com.google.common")
|
||||
relocateDependency("com.google.thirdparty.publicsuffix")
|
||||
relocateDependency("com.proximyst.moonshine")
|
||||
relocateDependency("it.unimi.dsi.fastutil")
|
||||
}
|
||||
|
||||
fun ShadowJar.configureShadowJar() {
|
||||
minimize()
|
||||
standardRelocations()
|
||||
dependencies {
|
||||
// not needed at runtime
|
||||
exclude(dependency("com.google.code.findbugs:jsr305"))
|
||||
exclude(dependency("org.checkerframework:checker-qual"))
|
||||
exclude(dependency("com.google.errorprone:error_prone_annotations"))
|
||||
exclude(dependency("com.google.j2objc:j2objc-annotations"))
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user