From cfc88cce3844a3427e291ab79bf97791097960e7 Mon Sep 17 00:00:00 2001 From: Keuin Date: Sun, 22 Oct 2023 22:18:16 +0800 Subject: bugfix: not work in non-debug server environment --- build.gradle | 64 +++++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 46 insertions(+), 18 deletions(-) (limited to 'build.gradle') diff --git a/build.gradle b/build.gradle index 6fa7bc2..574e7b8 100644 --- a/build.gradle +++ b/build.gradle @@ -1,10 +1,12 @@ plugins { - id 'fabric-loom' version '0.8-SNAPSHOT' + id 'fabric-loom' version '1.1-SNAPSHOT' id 'maven-publish' + id 'com.github.johnrengelman.shadow' version '7.1.2' + id 'java' } -sourceCompatibility = JavaVersion.VERSION_16 -targetCompatibility = JavaVersion.VERSION_16 +sourceCompatibility = JavaVersion.VERSION_17 +targetCompatibility = JavaVersion.VERSION_17 archivesBaseName = project.archives_base_name version = project.mod_version @@ -20,6 +22,40 @@ repositories { // for more information about repositories. } +shadowJar { + configurations = [project.configurations.shadow] + + // mitigate log4j security problem + exclude 'org/apache/logging/log4j/core/lookup/JndiLookup.class' +} + +// copied from https://github.com/Siphalor/spiceoffabric/blob/1.18/build.gradle +// MIT License +// +// Copyright (c) 2021-2022 Siphalor +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. +remapJar { + dependsOn(shadowJar) + inputFile = tasks.shadowJar.archiveFile +} + dependencies { implementation 'org.junit.jupiter:junit-jupiter:5.8.1' @@ -35,7 +71,9 @@ dependencies { // You may need to force-disable transitiveness on them. implementation 'junit:junit:4.13.2' modImplementation 'com.clickhouse:clickhouse-http-client:0.4.6' + shadow 'com.clickhouse:clickhouse-http-client:0.4.6' modImplementation 'com.google.code.gson:gson:2.10.1' // 2.10 supports deserializing java record objects + shadow 'com.google.code.gson:gson:2.10.1' // 2.10 supports deserializing java record objects } processResources { @@ -47,14 +85,9 @@ processResources { } tasks.withType(JavaCompile).configureEach { - // ensure that the encoding is set to UTF-8, no matter what the system default is - // this fixes some edge cases with special characters not displaying correctly - // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html - // If Javadoc is generated, this must be specified in that task too. - it.options.encoding = "UTF-8" - - // Minecraft 1.17 (21w19a) upwards uses Java 16. - it.options.release = 16 + // Minecraft 1.18 (1.18-pre2) upwards uses Java 17. + //noinspection GroovyAssignabilityCheck + it.options.release = 17 } java { @@ -73,14 +106,9 @@ jar { // configure the maven publication publishing { publications { + //noinspection GroovyAssignabilityCheck mavenJava(MavenPublication) { - // add all the jars that should be included when publishing to maven - artifact(remapJar) { - builtBy remapJar - } - artifact(sourcesJar) { - builtBy remapSourcesJar - } + from components.java } } -- cgit v1.2.3