diff --git a/buildSrc/src/main/kotlin/Libs.kt b/buildSrc/src/main/kotlin/Libs.kt index c7e8020..abf3688 100644 --- a/buildSrc/src/main/kotlin/Libs.kt +++ b/buildSrc/src/main/kotlin/Libs.kt @@ -1,5 +1,5 @@ object Libs { - private const val junitVersion = "5.6.2" + private const val junitVersion = "5.7.1" const val junitApi = "org.junit.jupiter:junit-jupiter-api:$junitVersion" const val junitEngine = "org.junit.jupiter:junit-jupiter-engine:$junitVersion" const val junitVintageEngine = "org.junit.vintage:junit-vintage-engine:$junitVersion" @@ -7,17 +7,17 @@ object Libs { private const val kyoriTextVersion = "3.0.4" const val kyoriText = "net.kyori:text-api:$kyoriTextVersion" const val kyoriTextPlain = "net.kyori:text-serializer-plain:$kyoriTextVersion" - const val autoCommon = "com.google.auto:auto-common:0.10" - private const val autoValueVersion = "1.7.3" + const val autoCommon = "com.google.auto:auto-common:0.11" + private const val autoValueVersion = "1.7.4" const val autoValueAnnotations = "com.google.auto.value:auto-value-annotations:$autoValueVersion" const val autoValueProcessor = "com.google.auto.value:auto-value:$autoValueVersion" const val autoService = "com.google.auto.service:auto-service:1.0-rc6" const val javapoet = "com.squareup:javapoet:1.13.0" - const val slf4j = "org.slf4j:slf4j-api:1.7.30" - private const val logbackVersion = "1.2.3" - const val logbackClassic = "ch.qos.logback:logback-classic:$logbackVersion" - const val logbackCore = "ch.qos.logback:logback-core:$logbackVersion" + // Sync with Mojang's Log4j + private const val log4jVersion = "2.8.1" + const val log4jApi = "org.apache.logging.log4j:log4j-api:$log4jVersion" + const val log4jCore = "org.apache.logging.log4j:log4j-core:$log4jVersion" const val javaxAnnotations = "com.google.code.findbugs:jsr305:3.0.2" - const val compileTesting = "com.google.testing.compile:compile-testing:0.18" - const val mockito = "org.mockito:mockito-core:3.3.3" + const val compileTesting = "com.google.testing.compile:compile-testing:0.19" + const val mockito = "org.mockito:mockito-core:3.8.0" } diff --git a/buildSrc/src/main/kotlin/common.kt b/buildSrc/src/main/kotlin/common.kt index 067ae85..164001b 100644 --- a/buildSrc/src/main/kotlin/common.kt +++ b/buildSrc/src/main/kotlin/common.kt @@ -1,6 +1,7 @@ import net.minecrell.gradle.licenser.LicenseExtension import org.gradle.api.JavaVersion import org.gradle.api.Project +import org.gradle.api.plugins.JavaPluginExtension import org.gradle.api.publish.PublishingExtension import org.gradle.api.publish.maven.MavenPublication import org.gradle.api.tasks.Copy @@ -10,6 +11,7 @@ import org.gradle.api.tasks.compile.JavaCompile import org.gradle.api.tasks.javadoc.Javadoc import org.gradle.api.tasks.testing.Test import org.gradle.external.javadoc.CoreJavadocOptions +import org.gradle.jvm.toolchain.JavaLanguageVersion import org.gradle.kotlin.dsl.apply import org.gradle.kotlin.dsl.configure import org.gradle.kotlin.dsl.delegateClosureOf @@ -67,19 +69,15 @@ fun Project.applyCommonConfig( } } - tasks.withType().configureEach { - sourceCompatibility = JavaVersion.VERSION_1_8.toString() - targetCompatibility = JavaVersion.VERSION_1_8.toString() - } - tasks.named("processTestResources") { from(rootProject.file("common-test-resources")) } - if (JavaVersion.current().isJava8Compatible) { - tasks.withType().configureEach { - (options as CoreJavadocOptions).addStringOption("Xdoclint:none", "-quiet") - } + configure { + toolchain.languageVersion.set(JavaLanguageVersion.of(8)) + } + tasks.withType().configureEach { + (options as CoreJavadocOptions).addStringOption("Xdoclint:none", "-quiet") } dependencies { diff --git a/core-ap/processor/build.gradle.kts b/core-ap/processor/build.gradle.kts index 2f01e0c..8de5f3f 100644 --- a/core-ap/processor/build.gradle.kts +++ b/core-ap/processor/build.gradle.kts @@ -2,8 +2,8 @@ import org.gradle.internal.jvm.Jvm import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { - kotlin("jvm") version "1.3.72" - kotlin("kapt") version "1.3.72" + kotlin("jvm") version "1.4.31" + kotlin("kapt") version "1.4.31" } applyCoreApConfig() @@ -45,8 +45,7 @@ dependencies { "testRuntimeOnly"(files(Jvm.current().toolsJar ?: throw IllegalStateException("No tools.jar is present. Please ensure you are using JDK 8."))) } "testImplementation"(Libs.mockito) - "testImplementation"(Libs.logbackCore) - "testImplementation"(Libs.logbackClassic) + "testRuntimeOnly"(Libs.log4jCore) "testImplementation"(project(":default-impl")) "testCompileOnly"(Libs.autoService) "kaptTest"(Libs.autoService) diff --git a/core-ap/processor/src/main/java/org/enginehub/piston/gen/CommandProcessor.java b/core-ap/processor/src/main/java/org/enginehub/piston/gen/CommandProcessor.java index 03a9495..1f69015 100644 --- a/core-ap/processor/src/main/java/org/enginehub/piston/gen/CommandProcessor.java +++ b/core-ap/processor/src/main/java/org/enginehub/piston/gen/CommandProcessor.java @@ -28,7 +28,7 @@ import com.google.common.cache.LoadingCache; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; -import com.google.common.collect.SetMultimap; +import com.google.common.collect.ImmutableSetMultimap; import com.google.common.collect.Sets; import com.squareup.javapoet.ClassName; import org.enginehub.piston.annotation.Command; @@ -42,6 +42,10 @@ import org.enginehub.piston.gen.value.CommandParamInfo; import org.enginehub.piston.gen.value.RegistrationInfo; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.Set; import javax.annotation.Nullable; import javax.annotation.processing.Processor; import javax.annotation.processing.SupportedOptions; @@ -54,11 +58,6 @@ import javax.lang.model.element.TypeElement; import javax.lang.model.type.TypeMirror; import javax.tools.Diagnostic; -import java.io.IOException; -import java.lang.annotation.Annotation; -import java.util.List; -import java.util.Optional; -import java.util.Set; import static com.google.auto.common.MoreElements.asType; import static com.google.auto.common.MoreElements.getAnnotationMirror; @@ -81,17 +80,17 @@ public SourceVersion getSupportedSourceVersion() { } @Override - protected Iterable initSteps() { - return ImmutableList.of(new ProcessingStep() { + protected Iterable steps() { + return ImmutableList.of(new Step() { @Override - public Set> annotations() { - return ImmutableSet.of(CommandContainer.class); + public Set annotations() { + return ImmutableSet.of(CommandContainer.class.getCanonicalName()); } @Override - public Set process(SetMultimap, Element> elementsByAnnotation) { + public Set process(ImmutableSetMultimap elementsByAnnotation) { try { - return doProcess(elementsByAnnotation.get(CommandContainer.class)); + return doProcess(elementsByAnnotation.get(CommandContainer.class.getCanonicalName())); } catch (ProcessingException e) { StringBuilder message = new StringBuilder(e.getMessage()); if (e.getCause() != null) { diff --git a/core-ap/processor/src/test/kotlin/org/enginehub/piston/gen/util/AnnoValueExtractionTest.kt b/core-ap/processor/src/test/kotlin/org/enginehub/piston/gen/util/AnnoValueExtractionTest.kt index b37bac5..00015c9 100644 --- a/core-ap/processor/src/test/kotlin/org/enginehub/piston/gen/util/AnnoValueExtractionTest.kt +++ b/core-ap/processor/src/test/kotlin/org/enginehub/piston/gen/util/AnnoValueExtractionTest.kt @@ -24,7 +24,7 @@ import com.google.auto.common.MoreElements.getAnnotationMirror import com.google.common.base.Throwables import com.google.common.collect.ImmutableList import com.google.common.collect.ImmutableSet -import com.google.common.collect.SetMultimap +import com.google.common.collect.ImmutableSetMultimap import com.google.testing.compile.Compilation import com.google.testing.compile.CompilationSubject.assertThat import com.squareup.javapoet.AnnotationSpec @@ -65,15 +65,15 @@ class AnnoValueExtractionTest { return SourceVersion.latestSupported() } - override fun initSteps(): Iterable { - return ImmutableList.of(object : ProcessingStep { - override fun annotations(): Set> { - return ImmutableSet.of(ProcessingKey::class.java) + override fun steps(): Iterable { + return ImmutableList.of(object : Step { + override fun annotations(): Set { + return ImmutableSet.of(ProcessingKey::class.java.canonicalName) } - override fun process(elementsByAnnotation: SetMultimap, Element>): Set { + override fun process(elementsByAnnotation: ImmutableSetMultimap): Set { try { - return doProcess(elementsByAnnotation.get(ProcessingKey::class.java)) + return doProcess(elementsByAnnotation.get(ProcessingKey::class.java.canonicalName)) } catch (e: ProcessingException) { val message = StringBuilder(e.message) val cause = e.cause @@ -142,4 +142,4 @@ class AnnoValueExtractionTest { assertEquals(listOf(value, value2), strs) } -} \ No newline at end of file +} diff --git a/default-impl/build.gradle.kts b/default-impl/build.gradle.kts index d6c8093..caea3c2 100644 --- a/default-impl/build.gradle.kts +++ b/default-impl/build.gradle.kts @@ -2,11 +2,10 @@ applyCommonConfig() dependencies { "api"(project(":core")) - "implementation"(Libs.slf4j) + "implementation"(Libs.log4jApi) "compileOnly"(Libs.autoValueAnnotations) "annotationProcessor"(Libs.autoValueProcessor) "compileOnly"(Libs.autoService) "annotationProcessor"(Libs.autoService) - "testImplementation"(Libs.logbackCore) - "testImplementation"(Libs.logbackClassic) + "testRuntimeOnly"(Libs.log4jCore) } diff --git a/default-impl/src/main/java/org/enginehub/piston/impl/CommandParser.java b/default-impl/src/main/java/org/enginehub/piston/impl/CommandParser.java index b6c2c09..4b390b6 100644 --- a/default-impl/src/main/java/org/enginehub/piston/impl/CommandParser.java +++ b/default-impl/src/main/java/org/enginehub/piston/impl/CommandParser.java @@ -42,6 +42,8 @@ import com.google.common.collect.Iterators; import net.kyori.text.Component; import net.kyori.text.TextComponent; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.enginehub.piston.Command; import org.enginehub.piston.CommandMetadata; import org.enginehub.piston.CommandParseResult; @@ -65,12 +67,10 @@ import org.enginehub.piston.part.SubCommandPart; import org.enginehub.piston.util.ComponentHelper; import org.enginehub.piston.util.StreamHelper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; class CommandParser { - private static final Logger LOGGER = LoggerFactory.getLogger(CommandParser.class); + private static final Logger LOGGER = LogManager.getLogger(); private static final ThreadLocal PARSE_ID = new ThreadLocal<>(); diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ac33e99..442d913 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists