mirror of
https://github.com/CivMC/Civ.git
synced 2026-07-15 23:20:44 +00:00
Orinnari feedback: Consolidate scripts into main buildscript
This commit is contained in:
@@ -1,13 +1,90 @@
|
||||
import com.gradle.enterprise.gradleplugin.GradleEnterpriseExtension
|
||||
import xyz.jpenilla.runpaper.task.RunServer
|
||||
|
||||
plugins {
|
||||
id("io.papermc.paperweight.userdev") version "1.5.10" apply false
|
||||
id("com.github.johnrengelman.shadow") version "8.1.1" apply false
|
||||
id("xyz.jpenilla.run-paper") version "2.2.2" apply false
|
||||
}
|
||||
|
||||
allprojects {
|
||||
apply(from = "${rootProject.projectDir}/scripts/gradle/common.gradle")
|
||||
project.extensions.configure<GradleEnterpriseExtension> {
|
||||
buildScan {
|
||||
if (System.getenv("CI") != null) {
|
||||
tag("CI")
|
||||
termsOfServiceUrl = "https://gradle.com/terms-of-service"
|
||||
termsOfServiceAgree = "yes"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
pluginManager.withPlugin("java-library") {
|
||||
configure<JavaPluginExtension> {
|
||||
toolchain {
|
||||
languageVersion.set(JavaLanguageVersion.of(17))
|
||||
}
|
||||
withSourcesJar()
|
||||
withJavadocJar()
|
||||
}
|
||||
|
||||
tasks.withType<JavaCompile> {
|
||||
options.encoding = "UTF-8"
|
||||
options.release = 17
|
||||
}
|
||||
|
||||
tasks.withType<ProcessResources> {
|
||||
filteringCharset = "UTF-8"
|
||||
}
|
||||
}
|
||||
|
||||
pluginManager.withPlugin("maven-publish") {
|
||||
configure<PublishingExtension> {
|
||||
val githubActor = System.getenv("GITHUB_ACTOR")
|
||||
val githubToken = System.getenv("GITHUB_TOKEN")
|
||||
|
||||
repositories {
|
||||
if (githubActor != null && githubToken != null) {
|
||||
maven {
|
||||
name = "GitHubPackages"
|
||||
url = uri("https://maven.pkg.github.com/CivMC/Civ")
|
||||
credentials {
|
||||
username = githubActor
|
||||
password = githubToken
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType<RunServer> {
|
||||
minecraftVersion("1.18")
|
||||
}
|
||||
|
||||
pluginManager.withPlugin("io.papermc.paperweight.userdev") {
|
||||
tasks.withType<ProcessResources> {
|
||||
filesMatching("plugin.yml") {
|
||||
expand(project.properties)
|
||||
}
|
||||
}
|
||||
|
||||
tasks {
|
||||
named("build") {
|
||||
dependsOn("reobfJar")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pluginManager.withPlugin("com.github.johnrengelman.shadow") {
|
||||
tasks {
|
||||
named("build") {
|
||||
dependsOn("shadowJar")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: We probably don't want to apply this to every subproject
|
||||
subprojects {
|
||||
apply(plugin = "java-library")
|
||||
apply(plugin = "maven-publish")
|
||||
|
||||
@@ -7,8 +7,6 @@ plugins {
|
||||
group = "net.civmc.civspy"
|
||||
version = "2.0.1"
|
||||
|
||||
apply(from = "${rootProject.projectDir}/scripts/gradle/paper.gradle")
|
||||
|
||||
repositories {
|
||||
maven("https://papermc.io/repo/repository/maven-public/")
|
||||
}
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
pluginManager.withPlugin("java-library") {
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion = JavaLanguageVersion.of(17)
|
||||
}
|
||||
withSourcesJar()
|
||||
withJavadocJar()
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
options.encoding = "UTF-8"
|
||||
options.release = 17
|
||||
}
|
||||
|
||||
tasks.withType(ProcessResources).configureEach {
|
||||
filteringCharset = "UTF-8"
|
||||
}
|
||||
|
||||
// TODO
|
||||
// tasks.withType(Test).configureEach {
|
||||
// useJUnitPlatform()
|
||||
// testLogging {
|
||||
// events(*TestLogEvent.values())
|
||||
// exceptionFormat = TestExceptionFormat.FULL
|
||||
// showCauses = true
|
||||
// showExceptions = true
|
||||
// showStackTraces = true
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
pluginManager.withPlugin("maven-publish") {
|
||||
def githubActor = System.getenv("GITHUB_ACTOR")
|
||||
def githubToken = System.getenv("GITHUB_TOKEN")
|
||||
|
||||
publishing {
|
||||
repositories {
|
||||
if (githubActor && githubToken) {
|
||||
maven {
|
||||
name = "GitHubPackages"
|
||||
url = "https://maven.pkg.github.com/CivMC/Civ"
|
||||
credentials {
|
||||
username = githubActor
|
||||
password = githubToken
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
from components.java
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pluginManager.withPlugin("com.gradle.enterprise") {
|
||||
gradleEnterprise {
|
||||
buildScan {
|
||||
if (System.getenv("CI")) {
|
||||
it.tag("CI")
|
||||
it.termsOfServiceUrl = "https://gradle.com/terms-of-service"
|
||||
it.termsOfServiceAgree = "yes"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
|
||||
pluginManager.withPlugin("xyz.jpenilla.run-paper") {
|
||||
tasks {
|
||||
runServer {
|
||||
minecraftVersion("1.18")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pluginManager.withPlugin("io.papermc.paperweight.userdev") {
|
||||
tasks {
|
||||
processResources {
|
||||
filesMatching("plugin.yml") {
|
||||
expand project.properties
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
build {
|
||||
dependsOn(reobfJar)
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,9 @@
|
||||
rootProject.name = "Civ"
|
||||
|
||||
plugins {
|
||||
id("com.gradle.enterprise") version "3.16.2"
|
||||
}
|
||||
|
||||
include(":plugins:civspy-api")
|
||||
include(":plugins:civspy-paper")
|
||||
include(":plugins:civspy-bungee")
|
||||
|
||||
Reference in New Issue
Block a user