@@ -0,0 +1,26 @@
|
||||
import java.util.*
|
||||
|
||||
plugins {
|
||||
`kotlin-dsl`
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
|
||||
val properties = Properties().also { props ->
|
||||
project.projectDir.resolveSibling("gradle.properties").bufferedReader().use {
|
||||
props.load(it)
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(gradleApi())
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvmToolchain {
|
||||
this.languageVersion.set(JavaLanguageVersion.of(21))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.plugins.JavaPluginExtension
|
||||
import org.gradle.api.tasks.compile.JavaCompile
|
||||
import org.gradle.jvm.toolchain.JavaLanguageVersion
|
||||
import org.gradle.kotlin.dsl.repositories
|
||||
import org.gradle.kotlin.dsl.the
|
||||
import org.gradle.kotlin.dsl.withType
|
||||
|
||||
fun Project.applyCommonConfiguration() {
|
||||
group = rootProject.group
|
||||
version = rootProject.version
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
name = "Spigot"
|
||||
url = uri("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
|
||||
}
|
||||
maven {
|
||||
name = "PaperMC"
|
||||
url = uri("https://repo.papermc.io/repository/maven-public/")
|
||||
}
|
||||
maven {
|
||||
name = "OSS Sonatype Snapshots"
|
||||
url = uri("https://oss.sonatype.org/content/repositories/snapshots/")
|
||||
}
|
||||
mavenLocal()
|
||||
}
|
||||
|
||||
plugins.withId("java") {
|
||||
the<JavaPluginExtension>().apply {
|
||||
toolchain {
|
||||
languageVersion.set(JavaLanguageVersion.of(21))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType<JavaCompile> {
|
||||
options.encoding = Charsets.UTF_8.name()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.artifacts.dsl.RepositoryHandler
|
||||
import org.gradle.api.plugins.JavaPluginExtension
|
||||
import org.gradle.kotlin.dsl.apply
|
||||
import org.gradle.kotlin.dsl.ivy
|
||||
import org.gradle.kotlin.dsl.the
|
||||
|
||||
fun Project.applyCoreConfiguration() {
|
||||
applyCommonConfiguration()
|
||||
|
||||
apply(plugin = "java")
|
||||
apply(plugin = "eclipse")
|
||||
apply(plugin = "idea")
|
||||
|
||||
if (name in setOf("buildsystem-core")) {
|
||||
the<JavaPluginExtension>().withSourcesJar()
|
||||
}
|
||||
}
|
||||
|
||||
fun RepositoryHandler.modrinthMavenWorkaround(nameOrId: String, version: String, fileName: String) {
|
||||
val url = "https://api.modrinth.com/maven/maven/modrinth/$nameOrId/$version/$fileName"
|
||||
val group = "maven.modrinth.workaround"
|
||||
ivy(url.substringBeforeLast('/')) {
|
||||
name = "Modrinth Maven Workaround for $nameOrId"
|
||||
patternLayout { artifact(url.substringAfterLast('/')) }
|
||||
metadataSources { artifact() }
|
||||
content { includeModule(group, nameOrId) }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user