Skip to content

Commit

Permalink
Update deps, swap out slf4j for log4j2-api
Browse files Browse the repository at this point in the history
  • Loading branch information
octylFractal committed Mar 28, 2021
1 parent cccb64a commit c19f63e
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 49 deletions.
18 changes: 9 additions & 9 deletions buildSrc/src/main/kotlin/Libs.kt
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
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"
const val guava = "com.google.guava:guava"
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"
}
16 changes: 7 additions & 9 deletions buildSrc/src/main/kotlin/common.kt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down Expand Up @@ -67,19 +69,15 @@ fun Project.applyCommonConfig(
}
}

tasks.withType<JavaCompile>().configureEach {
sourceCompatibility = JavaVersion.VERSION_1_8.toString()
targetCompatibility = JavaVersion.VERSION_1_8.toString()
}

tasks.named<Copy>("processTestResources") {
from(rootProject.file("common-test-resources"))
}

if (JavaVersion.current().isJava8Compatible) {
tasks.withType<Javadoc>().configureEach {
(options as CoreJavadocOptions).addStringOption("Xdoclint:none", "-quiet")
}
configure<JavaPluginExtension> {
toolchain.languageVersion.set(JavaLanguageVersion.of(8))
}
tasks.withType<Javadoc>().configureEach {
(options as CoreJavadocOptions).addStringOption("Xdoclint:none", "-quiet")
}

dependencies {
Expand Down
7 changes: 3 additions & 4 deletions core-ap/processor/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -81,17 +80,17 @@ public SourceVersion getSupportedSourceVersion() {
}

@Override
protected Iterable<? extends ProcessingStep> initSteps() {
return ImmutableList.of(new ProcessingStep() {
protected Iterable<? extends Step> steps() {
return ImmutableList.of(new Step() {
@Override
public Set<? extends Class<? extends Annotation>> annotations() {
return ImmutableSet.of(CommandContainer.class);
public Set<String> annotations() {
return ImmutableSet.of(CommandContainer.class.getCanonicalName());
}

@Override
public Set<Element> process(SetMultimap<Class<? extends Annotation>, Element> elementsByAnnotation) {
public Set<Element> process(ImmutableSetMultimap<String, Element> 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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -65,15 +65,15 @@ class AnnoValueExtractionTest {
return SourceVersion.latestSupported()
}

override fun initSteps(): Iterable<ProcessingStep> {
return ImmutableList.of(object : ProcessingStep {
override fun annotations(): Set<Class<out Annotation>> {
return ImmutableSet.of(ProcessingKey::class.java)
override fun steps(): Iterable<Step> {
return ImmutableList.of(object : Step {
override fun annotations(): Set<String> {
return ImmutableSet.of(ProcessingKey::class.java.canonicalName)
}

override fun process(elementsByAnnotation: SetMultimap<Class<out Annotation>, Element>): Set<Element> {
override fun process(elementsByAnnotation: ImmutableSetMultimap<String, Element>): Set<Element> {
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
Expand Down Expand Up @@ -142,4 +142,4 @@ class AnnoValueExtractionTest {
assertEquals(listOf(value, value2), strs)
}

}
}
5 changes: 2 additions & 3 deletions default-impl/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<String> PARSE_ID = new ThreadLocal<>();

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit c19f63e

Please sign in to comment.