diff --git a/build.gradle.kts b/build.gradle.kts index 1d6c81b0fed..2cc3a31542e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -24,6 +24,10 @@ repositories { } } +java { + modularity.inferModulePath.set(false) +} + val ap by sourceSets.registering { compileClasspath += sourceSets.main.get().compileClasspath + sourceSets.main.get().output } @@ -31,6 +35,7 @@ val ap by sourceSets.registering { // Project dependencies val adventureVersion: String by project val configurateVersion: String by project +val geantyrefVersion: String by project val gsonVersion: String by project val guavaVersion: String by project val log4jVersion: String by project @@ -113,6 +118,9 @@ dependencies { exclude(group = "com.google.inject", module = "guice") } + // Generic type reflection + capture library (used by Configurate, we bump the version for a module name) + api("io.leangen.geantyref:geantyref:$geantyrefVersion") + // Compile-time static analysis compileOnly("com.google.errorprone:error_prone_annotations:$errorproneVersion") errorprone("com.google.errorprone:error_prone_core:$errorproneVersion") @@ -170,6 +178,10 @@ tasks { compilerArgs.addAll(listOf("-Xlint:-path")) isDeprecation = false } + + doFirst { + options.compilerArgs.addAll(listOf("--module-path", classpath.asPath)) + } } javadoc { @@ -189,6 +201,10 @@ tasks { addBooleanOption("quiet", true) } } + + doFirst { + options.modulePath(classpath.toList()) + } } withType(JavaCompile::class).configureEach { diff --git a/gradle.properties b/gradle.properties index 2e1e08cefd9..cba728f8dbb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,6 +13,7 @@ caffeineVersion=3.1.1 checkstyleVersion=10.3.4 configurateVersion=4.1.2 errorproneVersion=2.16 +geantyrefVersion=1.3.13 gsonVersion=2.8.9 guavaVersion=31.0.1-jre junitVersion=5.9.1 @@ -20,4 +21,4 @@ log4jVersion=2.17.0 mathVersion=2.0.1 mockitoVersion=4.8.0 -pluginSpiVersion=0.3.0 +pluginSpiVersion=0.3.1-SNAPSHOT diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java new file mode 100644 index 00000000000..dd48a5a4ee2 --- /dev/null +++ b/src/main/java/module-info.java @@ -0,0 +1,39 @@ +open module org.spongepowered.api { + requires transitive java.desktop; + requires transitive java.sql; + + requires transitive org.apache.logging.log4j; + requires transitive com.google.common; // guava + requires transitive com.google.gson; + + requires transitive net.kyori.adventure; + requires transitive net.kyori.adventure.text.serializer.gson; + requires transitive net.kyori.adventure.text.serializer.legacy; + requires transitive net.kyori.adventure.text.serializer.plain; + requires transitive net.kyori.adventure.text.minimessage; + + requires transitive com.google.guice; + requires transitive com.github.benmanes.caffeine; + requires transitive com.github.benmanes.caffeine.guava; + + requires transitive org.spongepowered.plugin.spi; + requires transitive org.spongepowered.plugin.metadata; + + requires transitive org.spongepowered.configurate; + requires transitive org.spongepowered.configurate.hocon; + requires transitive org.spongepowered.configurate.gson; + requires transitive org.spongepowered.configurate.yaml; + requires transitive org.spongepowered.configurate.extra.guice; + + requires static transitive com.google.errorprone.annotations; + requires static transitive org.checkerframework.checker.qual; + requires static transitive org.jetbrains.annotations; // via adventure (unneeded once Adventure gets real module descriptors) + + requires transitive org.spongepowered.math; + requires transitive io.leangen.geantyref; + + // AP + requires transitive java.compiler; + + // provides javax.annotation.processing.Processor with org.spongepowered.plugin.processor.ListenerProcessor; // TODO +} diff --git a/src/main/java/org/spongepowered/api/datapack/DataPackTypes.java b/src/main/java/org/spongepowered/api/datapack/DataPackTypes.java index d57bb8bc66f..100bf1575a4 100644 --- a/src/main/java/org/spongepowered/api/datapack/DataPackTypes.java +++ b/src/main/java/org/spongepowered/api/datapack/DataPackTypes.java @@ -65,7 +65,7 @@ public final class DataPackTypes { public static final DataPackType> ITEM_TAG = Sponge.game().factoryProvider().provide(DataPackType.Factory.class).tag(RegistryTypes.ITEM_TYPE); - public static final DataPackType>> ENTITY_TAG = Sponge.game().factoryProvider().provide(DataPackType.Factory.class).tag((RegistryType>) RegistryTypes.ENTITY_TYPE); + public static final DataPackType>> ENTITY_TAG = Sponge.game().factoryProvider().provide(DataPackType.Factory.class).tag((RegistryType>) (RegistryType) RegistryTypes.ENTITY_TYPE); public static final DataPackType> BIOME_TAG = Sponge.game().factoryProvider().provide(DataPackType.Factory.class).tag(RegistryTypes.BIOME); diff --git a/src/test/java/org/spongepowered/api/data/package-info.java b/src/test/java/org/spongepowered/api/data/package-info.java deleted file mode 100644 index 0ee2ebb30c4..00000000000 --- a/src/test/java/org/spongepowered/api/data/package-info.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * This file is part of SpongeAPI, licensed under the MIT License (MIT). - * - * Copyright (c) SpongePowered - * Copyright (c) contributors - * - * 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. - */ -@org.checkerframework.framework.qual.DefaultQualifier(org.checkerframework.checker.nullness.qual.NonNull.class) -package org.spongepowered.api.data; diff --git a/src/test/java/org/spongepowered/api/event/package-info.java b/src/test/java/org/spongepowered/api/event/package-info.java deleted file mode 100644 index 9d12180f851..00000000000 --- a/src/test/java/org/spongepowered/api/event/package-info.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * This file is part of SpongeAPI, licensed under the MIT License (MIT). - * - * Copyright (c) SpongePowered - * Copyright (c) contributors - * - * 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. - */ -@org.checkerframework.framework.qual.DefaultQualifier(org.checkerframework.checker.nullness.qual.NonNull.class) -package org.spongepowered.api.event; diff --git a/src/test/java/org/spongepowered/api/util/package-info.java b/src/test/java/org/spongepowered/api/util/package-info.java deleted file mode 100644 index 0a0e3b5c653..00000000000 --- a/src/test/java/org/spongepowered/api/util/package-info.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * This file is part of SpongeAPI, licensed under the MIT License (MIT). - * - * Copyright (c) SpongePowered - * Copyright (c) contributors - * - * 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. - */ -@org.checkerframework.framework.qual.DefaultQualifier(org.checkerframework.checker.nullness.qual.NonNull.class) -package org.spongepowered.api.util; diff --git a/src/test/java/org/spongepowered/api/util/weighted/package-info.java b/src/test/java/org/spongepowered/api/util/weighted/package-info.java deleted file mode 100644 index c70b3c7454f..00000000000 --- a/src/test/java/org/spongepowered/api/util/weighted/package-info.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * This file is part of SpongeAPI, licensed under the MIT License (MIT). - * - * Copyright (c) SpongePowered - * Copyright (c) contributors - * - * 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. - */ -@org.checkerframework.framework.qual.DefaultQualifier(org.checkerframework.checker.nullness.qual.NonNull.class) -package org.spongepowered.api.util.weighted;