Skip to content

Commit

Permalink
feat: update to Java 21
Browse files Browse the repository at this point in the history
Builds everything and the main tests pass. The
annotations have moved packages to avoid collision
with the Sponge API module.
  • Loading branch information
gabizou committed Sep 29, 2024
1 parent fe3ec69 commit b3e9ff6
Show file tree
Hide file tree
Showing 32 changed files with 107 additions and 102 deletions.
7 changes: 0 additions & 7 deletions annotations/build.gradle

This file was deleted.

4 changes: 4 additions & 0 deletions annotations/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module org.spongepowered.eventgen.annotations {
exports org.spongepowered.eventgen.annotations;
exports org.spongepowered.eventgen.annotations.internal;
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.api.util.annotation.eventgen;
package org.spongepowered.eventgen.annotations;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.api.util.annotation.eventgen;
package org.spongepowered.eventgen.annotations;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.api.util.annotation.eventgen;
package org.spongepowered.eventgen.annotations;

import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.api.util.annotation.eventgen;
package org.spongepowered.eventgen.annotations;

import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.api.util.annotation.eventgen;
package org.spongepowered.eventgen.annotations;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.api.util.annotation.eventgen;
package org.spongepowered.eventgen.annotations;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.api.util.annotation.eventgen;
package org.spongepowered.eventgen.annotations;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.api.util.annotation.eventgen;
package org.spongepowered.eventgen.annotations;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.api.util.annotation.eventgen;
package org.spongepowered.eventgen.annotations;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.api.util.annotation.eventgen.internal;
package org.spongepowered.eventgen.annotations.internal;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
Expand Down
4 changes: 0 additions & 4 deletions annotations/src/main/java9/module-info.java

This file was deleted.

47 changes: 33 additions & 14 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ plugins {
alias(libs.plugins.indra.sonatype) apply false
alias(libs.plugins.errorprone)
alias(libs.plugins.eclipseApt)
id('java-library')
id("org.gradlex.extra-java-module-info") version "1.9"
}

// Default tasks
Expand All @@ -11,16 +13,33 @@ defaultTasks 'spotlessApply', 'build'
// Basic project information
group = "org.spongepowered"

extraJavaModuleInfo {
deriveAutomaticModuleNamesFromFileNames = true
module("com.google.errorprone:javac-shaded", "com.google.errorprone.javac.shaded") {
exports("com.google.errorprone.javac.shaded")
}
module("io.soabase.java-composer:java-composer", "io.soabase.java.composer") {
exports("com.squareup.javapoet")
requiresTransitive("java.compiler")
}
module("org.jooq:joor-java-8", "org.jooq.joor") {
exports("org.joor")
}
}

allprojects {
apply plugin: "org.spongepowered.gradle.sponge.dev"
apply plugin: "net.kyori.indra.publishing"
apply plugin: "net.ltgt.errorprone"
apply plugin: "com.diffplug.eclipse.apt"
apply plugin: "java-library"
apply plugin: "eclipse"

dependencies {
errorprone libs.errorprone
}


eclipse {
synchronizationTasks eclipseJdtApt, eclipseJdt, eclipseFactorypath
}
Expand Down Expand Up @@ -51,35 +70,35 @@ allprojects {
)
}
}
indra {
javaVersions {
minimumToolchain(21)
target(21)
}
}

indraSpotlessLicenser {
property("name", rootProject.projectName)
}
}

indra {
javaVersions {
testWith(8, 11, 17)
tasks.withType(JavaCompile).configureEach {
options.forkOptions.jvmArgs = [
'-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005'
]
}
}

sourceSets {
main {
multirelease {
moduleName "org.spongepowered.eventimplgen"
alternateVersions 9, 13
}
}
}


// Project dependencies
dependencies {
implementation project(":event-impl-gen-annotations")
api libs.javapoet
api libs.javaxInject
api libs.jakartaInject

compileOnlyApi libs.errorprone.annotations

api libs.dagger.runtime
api(libs.dagger.runtime)
annotationProcessor libs.dagger.compiler

compileOnlyApi libs.autoService.annotations
Expand Down
6 changes: 4 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "1.0"
[versions]
autoService = "1.1.1"
checkerQual = "3.26.0"
dagger = "2.51.1"
dagger = "2.52"
errorprone = "2.28.0"
junit = "5.10.2"

Expand All @@ -15,8 +15,10 @@ dagger-runtime = { module = "com.google.dagger:dagger", version.ref = "dagger" }
dagger-compiler = { module = "com.google.dagger:dagger-compiler", version.ref = "dagger" }
errorprone = { module = "com.google.errorprone:error_prone_core", version.ref = "errorprone" }
errorprone-annotations = { module = "com.google.errorprone:error_prone_annotations", version.ref = "errorprone" }
javapoet = { module = "com.squareup:javapoet", version = "1.13.0" }
javapoet = { module = "io.soabase.java-composer:java-composer", version = "1.0" }
jetbrainsAnnotations = { module = "org.jetbrains:annotations", version = "24.1.0"}
jakartaInject = { module = "jakarta.inject:jakarta.inject-api", version = "2.0.1" }
javaxInject = { module = "javax.inject:javax.inject", version = "1" }

# Tests
assertj = { module = "org.assertj:assertj-core", version = "3.26.0" }
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
module org.spongepowered.eventimplgen {
exports org.spongepowered.eventimplgen.processor;

requires java.compiler;
requires com.squareup.javapoet;
// requires transitive dagger;
requires transitive org.spongepowered.eventimplgen.annotations;
requires dagger;
requires javax.inject;
requires jakarta.inject;
requires io.soabase.java.composer;
requires transitive java.compiler;
requires transitive org.spongepowered.eventgen.annotations;

requires static transitive com.google.auto.service;
requires static transitive org.jetbrains.annotations;
// requires static transitive javax.inject; TODO maybe?

provides javax.annotation.processing.Processor with org.spongepowered.eventimplgen.processor.EventImplGenProcessor;
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/
package org.spongepowered.eventimplgen.eventgencore;

import org.spongepowered.api.util.annotation.eventgen.AbsoluteSortPosition;
import org.spongepowered.eventgen.annotations.AbsoluteSortPosition;
import org.spongepowered.eventimplgen.processor.EventGenOptions;

import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import dagger.assisted.Assisted;
import dagger.assisted.AssistedFactory;
import dagger.assisted.AssistedInject;
import org.spongepowered.api.util.annotation.eventgen.UseField;
import org.spongepowered.eventgen.annotations.UseField;
import org.spongepowered.eventimplgen.eventgencore.Property;

import java.util.Optional;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,13 @@
import com.squareup.javapoet.TypeSpec;
import com.squareup.javapoet.TypeVariableName;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.api.util.annotation.eventgen.PropertySettings;
import org.spongepowered.api.util.annotation.eventgen.UseField;
import org.spongepowered.api.util.annotation.eventgen.internal.GeneratedEvent;
import org.spongepowered.eventgen.annotations.PropertySettings;
import org.spongepowered.eventgen.annotations.UseField;
import org.spongepowered.eventgen.annotations.internal.GeneratedEvent;
import org.spongepowered.eventimplgen.eventgencore.Property;
import org.spongepowered.eventimplgen.eventgencore.PropertySorter;
import org.spongepowered.eventimplgen.factory.plugin.EventFactoryPlugin;
import org.spongepowered.eventimplgen.processor.EventImplGenProcessor;
import org.spongepowered.eventimplgen.signature.Descriptors;

import java.util.List;
import java.util.Objects;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import com.squareup.javapoet.TypeName;
import com.squareup.javapoet.TypeSpec;
import com.squareup.javapoet.TypeVariableName;
import org.spongepowered.api.util.annotation.eventgen.internal.GeneratedEvent;
import org.spongepowered.eventgen.annotations.internal.GeneratedEvent;
import org.spongepowered.eventimplgen.eventgencore.Property;
import org.spongepowered.eventimplgen.eventgencore.PropertySorter;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@

import com.squareup.javapoet.MethodSpec;
import com.squareup.javapoet.TypeName;
import org.spongepowered.api.util.annotation.eventgen.TransformResult;
import org.spongepowered.api.util.annotation.eventgen.TransformWith;
import org.spongepowered.eventgen.annotations.TransformResult;
import org.spongepowered.eventgen.annotations.TransformWith;
import org.spongepowered.eventimplgen.eventgencore.Property;
import org.spongepowered.eventimplgen.factory.ClassContext;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
package org.spongepowered.eventimplgen.processor;

import org.jetbrains.annotations.Nullable;
import org.spongepowered.api.util.annotation.eventgen.GenerateFactoryMethod;
import org.spongepowered.api.util.annotation.eventgen.NoFactoryMethod;
import org.spongepowered.eventgen.annotations.GenerateFactoryMethod;
import org.spongepowered.eventgen.annotations.NoFactoryMethod;

import java.util.Arrays;
import java.util.Collections;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
package org.spongepowered.eventimplgen.processor;

import com.google.auto.service.AutoService;
import org.spongepowered.api.util.annotation.eventgen.internal.GeneratedEvent;
import org.spongepowered.eventgen.annotations.internal.GeneratedEvent;

import java.io.IOException;
import java.util.HashSet;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import com.squareup.javapoet.ClassName;
import com.squareup.javapoet.JavaFile;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.api.util.annotation.eventgen.ImplementedBy;
import org.spongepowered.eventgen.annotations.ImplementedBy;
import org.spongepowered.eventimplgen.AnnotationUtils;
import org.spongepowered.eventimplgen.eventgencore.Property;
import org.spongepowered.eventimplgen.eventgencore.PropertySorter;
Expand Down
Loading

0 comments on commit b3e9ff6

Please sign in to comment.