Update gradle to 8.14.1, use kotlin instead of groovy
This commit is contained in:
1 parent
79c30df06a
commit
014e0ea62e
7 files changed
+151
-162
No files matched your search
-154
@@ -1,154 +0,0 @@
|
||||
import com.google.gson.JsonObject
|
||||
import com.google.gson.JsonParser
|
||||
import org.yaml.snakeyaml.DumperOptions
|
||||
import org.yaml.snakeyaml.Yaml
|
||||
|
||||
import java.nio.charset.StandardCharsets
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath(group: 'org.yaml', name: 'snakeyaml', version: '1.26')
|
||||
classpath(group: 'com.google.code.gson', name: 'gson', version: '2.8.6')
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'eclipse'
|
||||
id 'idea'
|
||||
}
|
||||
|
||||
version = '2.8.0'
|
||||
group = 'net.tcpshield.tcpshield'
|
||||
|
||||
base {
|
||||
archivesName = 'TCPShield'
|
||||
}
|
||||
|
||||
idea {
|
||||
module {
|
||||
downloadJavadoc = true
|
||||
downloadSources = true
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
java {
|
||||
srcDirs('src/main/java')
|
||||
}
|
||||
resources {
|
||||
srcDirs('src/main/resources')
|
||||
}
|
||||
}
|
||||
test {
|
||||
java {
|
||||
srcDirs('src/test/java')
|
||||
}
|
||||
resources {
|
||||
srcDirs('src/test/resources')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
compileJava {
|
||||
sourceCompatibility = 17
|
||||
targetCompatibility = 17
|
||||
options.encoding = 'UTF-8'
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
url = 'https://repo1.maven.org/maven2/'
|
||||
}
|
||||
maven {
|
||||
url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
|
||||
}
|
||||
maven {
|
||||
url = 'https://repo.dmulloy2.net/nexus/repository/public/'
|
||||
}
|
||||
maven {
|
||||
url = 'https://oss.sonatype.org/content/repositories/snapshots'
|
||||
}
|
||||
maven {
|
||||
url = 'https://repo.papermc.io/repository/maven-public/'
|
||||
}
|
||||
maven {
|
||||
url = 'https://repo.opencollab.dev/maven-snapshots/'
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly 'com.comphenix.protocol:ProtocolLib:5.1.0'
|
||||
compileOnly 'io.papermc.paper:paper-api:1.19.4-R0.1-SNAPSHOT'
|
||||
compileOnly 'net.md-5:bungeecord-api:1.14-SNAPSHOT'
|
||||
compileOnly 'com.velocitypowered:velocity-api:3.3.0-SNAPSHOT'
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0-M1'
|
||||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0-M1'
|
||||
compileOnly 'org.geysermc.floodgate:api:2.1.1-SNAPSHOT'
|
||||
}
|
||||
|
||||
processResources {
|
||||
duplicatesStrategy = DuplicatesStrategy.INCLUDE
|
||||
}
|
||||
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
configurations {
|
||||
testImplementation.extendsFrom compileOnly
|
||||
}
|
||||
|
||||
task updateVersion {
|
||||
updateYamls()
|
||||
updateJsons()
|
||||
}
|
||||
|
||||
void updateYamls() {
|
||||
DumperOptions options = new DumperOptions()
|
||||
options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK)
|
||||
options.setSplitLines(false)
|
||||
options.setPrettyFlow(true)
|
||||
|
||||
def yaml = new Yaml(options)
|
||||
|
||||
def bukkitYamlFile = new File('src/main/resources/plugin.yml')
|
||||
def bungeeYamlFile = new File('src/main/resources/bungee.yml')
|
||||
|
||||
def files = [bukkitYamlFile, bungeeYamlFile]
|
||||
files.each { file ->
|
||||
file.newInputStream().withCloseable { inputStream ->
|
||||
def cfg = yaml.load(inputStream)
|
||||
cfg.put("version", version)
|
||||
|
||||
new FileWriter(file).withCloseable { writer ->
|
||||
yaml.dump(cfg, writer)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void updateJsons() {
|
||||
def velocityJson = new File('src/main/resources/velocity-plugin.json')
|
||||
|
||||
def files = [velocityJson]
|
||||
files.each { file ->
|
||||
file.newInputStream().withCloseable { inputStream ->
|
||||
new InputStreamReader(inputStream, StandardCharsets.UTF_8).withCloseable { inputStreamReader ->
|
||||
JsonObject object = JsonParser.parseReader(inputStreamReader).getAsJsonObject()
|
||||
object.addProperty("version", version.toString())
|
||||
|
||||
new FileWriter(file).withCloseable { writer ->
|
||||
writer.write(object.toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
build.dependsOn updateVersion
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
import com.google.gson.JsonObject
|
||||
import com.google.gson.JsonParser
|
||||
import org.yaml.snakeyaml.DumperOptions
|
||||
import org.yaml.snakeyaml.Yaml
|
||||
import java.io.File
|
||||
import java.io.FileWriter
|
||||
import java.io.InputStreamReader
|
||||
import java.nio.charset.StandardCharsets
|
||||
import org.gradle.api.tasks.compile.JavaCompile
|
||||
import org.gradle.api.tasks.testing.Test
|
||||
import org.gradle.kotlin.dsl.*
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath("org.yaml:snakeyaml:1.26")
|
||||
classpath("com.google.code.gson:gson:2.8.6")
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id("java")
|
||||
id("eclipse")
|
||||
id("idea")
|
||||
}
|
||||
|
||||
version = "2.8.0"
|
||||
group = "net.tcpshield.tcpshield"
|
||||
|
||||
base {
|
||||
archivesName.set("TCPShield")
|
||||
}
|
||||
|
||||
idea {
|
||||
module {
|
||||
isDownloadJavadoc = true
|
||||
isDownloadSources = true
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
named("main") {
|
||||
java.srcDir("src/main/java")
|
||||
resources.srcDir("src/main/resources")
|
||||
}
|
||||
named("test") {
|
||||
java.srcDir("src/test/java")
|
||||
resources.srcDir("src/test/resources")
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType<JavaCompile> {
|
||||
sourceCompatibility = "17"
|
||||
targetCompatibility = "17"
|
||||
options.encoding = "UTF-8"
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven { url = uri("https://repo1.maven.org/maven2/") }
|
||||
maven { url = uri("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") }
|
||||
maven { url = uri("https://repo.dmulloy2.net/nexus/repository/public/") }
|
||||
maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots") }
|
||||
maven { url = uri("https://repo.papermc.io/repository/maven-public/") }
|
||||
maven { url = uri("https://repo.opencollab.dev/maven-snapshots/") }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly("com.comphenix.protocol:ProtocolLib:5.1.0")
|
||||
compileOnly("io.papermc.paper:paper-api:1.19.4-R0.1-SNAPSHOT")
|
||||
compileOnly("net.md-5:bungeecord-api:1.14-SNAPSHOT")
|
||||
compileOnly("com.velocitypowered:velocity-api:3.3.0-SNAPSHOT")
|
||||
testImplementation("org.junit.jupiter:junit-jupiter-api:5.7.0-M1")
|
||||
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.7.0-M1")
|
||||
compileOnly("org.geysermc.floodgate:api:2.1.1-SNAPSHOT")
|
||||
}
|
||||
|
||||
tasks.named<ProcessResources>("processResources") {
|
||||
duplicatesStrategy = DuplicatesStrategy.INCLUDE
|
||||
}
|
||||
|
||||
tasks.named<Test>("test") {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
configurations {
|
||||
named("testImplementation") {
|
||||
extendsFrom(configurations.named("compileOnly").get())
|
||||
}
|
||||
}
|
||||
|
||||
fun updateYamls() {
|
||||
val options = DumperOptions().apply {
|
||||
defaultFlowStyle = DumperOptions.FlowStyle.BLOCK
|
||||
setSplitLines(false)
|
||||
setPrettyFlow(true)
|
||||
}
|
||||
val yaml = Yaml(options)
|
||||
val files = listOf(
|
||||
File("src/main/resources/plugin.yml"),
|
||||
File("src/main/resources/bungee.yml")
|
||||
)
|
||||
files.forEach { file ->
|
||||
file.inputStream().use { inputStream ->
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
val cfg = yaml.load<MutableMap<String, Any?>>(inputStream)
|
||||
cfg["version"] = project.version.toString()
|
||||
FileWriter(file).use { writer ->
|
||||
yaml.dump(cfg, writer)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun updateJsons() {
|
||||
val file = File("src/main/resources/velocity-plugin.json")
|
||||
file.inputStream().use { inputStream ->
|
||||
InputStreamReader(inputStream, StandardCharsets.UTF_8).use { reader ->
|
||||
val obj: JsonObject = JsonParser.parseReader(reader).asJsonObject
|
||||
obj.addProperty("version", project.version.toString())
|
||||
FileWriter(file).use { writer ->
|
||||
writer.write(obj.toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.register("updateVersion") {
|
||||
doLast {
|
||||
updateYamls()
|
||||
updateJsons()
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named("build") {
|
||||
dependsOn("updateVersion")
|
||||
}
|
||||
|
||||
Vendored
BIN
Binary file not shown.
@@ -15,6 +15,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
@@ -84,7 +86,7 @@ done
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
@@ -112,7 +114,7 @@ case "$( uname )" in #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
CLASSPATH="\\\"\\\""
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
@@ -203,7 +205,7 @@ fi
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
@@ -211,7 +213,7 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
|
||||
Vendored
+4
-2
@@ -13,6 +13,8 @@
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@@ -68,11 +70,11 @@ goto fail
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
set CLASSPATH=
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
rootProject.name = 'TCPShield'
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
rootProject.name = "TCPShield"
|
||||
|
||||
Reference in new issue
Block a user