Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "feat: upgrade to Gestalt 8" #5270

Merged
merged 1 commit into from
Aug 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ dependencies {
implementation("org.jgrapht:jgrapht-core:1.5.0")

// for inspecting modules
implementation("org.terasology.gestalt:gestalt-module:8.0.0-SNAPSHOT")
implementation("org.terasology.gestalt:gestalt-module:7.2.0")

// plugins we configure
implementation("com.github.spotbugs.snom:spotbugs-gradle-plugin:5.2.3")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ class ModuleMetadataForGradle(private val moduleConfig: ModuleMetadata) {
}

private fun versionStringFromGestaltDependency(gestaltDependency: DependencyInfo): String {
val version = if (gestaltDependency.versionRange() is VersionRange) {
gestaltDependency.versionRange().toString()
val version = if (gestaltDependency.versionPredicate() is VersionRange) {
gestaltDependency.versionPredicate().toString()
} else {
// TODO: gradle-compatible version expressions for gestalt dependencies
// https://github.com/MovingBlocks/gestalt/issues/114
Expand Down
13 changes: 1 addition & 12 deletions build-logic/src/main/kotlin/terasology-module.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ dependencies {
implementation(group = "org.terasology.engine", name = "engine", version = moduleMetadata.engineVersion())
testImplementation(group = "org.terasology.engine", name = "engine-tests", version = moduleMetadata.engineVersion())

annotationProcessor("org.terasology.gestalt:gestalt-inject-java:8.0.0-SNAPSHOT")

for ((gradleDep, optional) in moduleMetadata.moduleDependencies()) {
if (optional) {
// `optional` module dependencies are ones it does not require for runtime
Expand Down Expand Up @@ -146,17 +144,8 @@ tasks.named("processResources") {
dependsOn("syncAssets", "syncOverrides", "syncDeltas", "syncModuleInfo")
}

tasks.named<JavaCompile>("compileJava") {
dependsOn("processResources")
// Create an asset list during compilation (needed for Gestalt 8)
inputs.files(sourceSets.main.get().resources.srcDirs)
options.compilerArgs = arrayListOf("-Aresource=${sourceSets.main.get().resources.srcDirs.joinToString(File.pathSeparator)}")
}
tasks.named<JavaCompile>("compileTestJava") {
tasks.named("compileJava") {
dependsOn("processResources")
// Create an asset list during compilation (needed for Gestalt 8)
inputs.files(sourceSets.test.get().resources.srcDirs)
options.compilerArgs = arrayListOf("-Aresource=${sourceSets.test.get().resources.srcDirs.joinToString(File.pathSeparator)}")
}

tasks.named<Test>("test") {
Expand Down
16 changes: 1 addition & 15 deletions engine-tests/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,6 @@ dependencies {
implementation("com.google.protobuf:protobuf-java:3.16.1")
implementation("org.terasology:reflections:0.9.12-MB")

implementation("com.github.zafarkhaja:java-semver:0.10.2")

annotationProcessor("org.terasology.gestalt:gestalt-inject-java:8.0.0-SNAPSHOT")
testAnnotationProcessor("org.terasology.gestalt:gestalt-inject-java:8.0.0-SNAPSHOT")

implementation("org.terasology.joml-ext:joml-test:0.1.0")

testImplementation("ch.qos.logback:logback-classic:1.4.14") {
Expand Down Expand Up @@ -96,17 +91,8 @@ tasks.register<Copy>("copyResourcesToClasses") {
into(sourceSets["main"].output.classesDirs.first())
}

tasks.named<JavaCompile>("compileJava") {
dependsOn("copyResourcesToClasses")
// Create an asset list during compilation (needed for Gestalt 8)
inputs.files(sourceSets.main.get().resources.srcDirs)
options.compilerArgs = arrayListOf("-Aresource=${sourceSets.main.get().resources.srcDirs.joinToString(File.pathSeparator)}")
}
tasks.named<JavaCompile>("compileTestJava") {
tasks.named("compileJava") {
dependsOn("copyResourcesToClasses")
// Create an asset list during compilation (needed for Gestalt 8)
inputs.files(sourceSets.test.get().resources.srcDirs)
options.compilerArgs = arrayListOf("-Aresource=${sourceSets.test.get().resources.srcDirs.joinToString(File.pathSeparator)}")
}

tasks.withType<Jar> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

package org.terasology.unittest;

import org.terasology.context.annotation.API;
import org.terasology.gestalt.module.sandbox.API;

@API
public class ExampleClass implements ExampleInterface {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@

package org.terasology.unittest;

import org.terasology.context.annotation.API;
import org.terasology.context.annotation.IndexInherited;
import org.terasology.gestalt.module.sandbox.API;

@API
@IndexInherited
public interface ExampleInterface {
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
@API
package org.terasology.unittest.stubs;

import org.terasology.context.annotation.API;
import org.terasology.gestalt.module.sandbox.API;
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
@API
package org.terasology.unittest.worlds;

import org.terasology.context.annotation.API;
import org.terasology.gestalt.module.sandbox.API;
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import org.terasology.engine.core.module.ModuleManager;
import org.terasology.engine.testUtil.ModuleManagerFactory;
import org.terasology.gestalt.module.ModuleEnvironment;
import org.terasology.context.annotation.API;
import org.terasology.gestalt.module.sandbox.API;

import java.net.URL;
import java.util.HashMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import org.terasology.engine.core.module.ModuleManager;
import org.terasology.engine.testUtil.ModuleManagerFactory;
import org.terasology.gestalt.module.ModuleEnvironment;
import org.terasology.context.annotation.API;
import org.terasology.gestalt.module.sandbox.API;

import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.junit.jupiter.api.Test;
import org.terasology.gestalt.module.Module;
import org.terasology.gestalt.module.ModuleMetadata;
import org.terasology.context.annotation.API;
import org.terasology.gestalt.module.sandbox.API;
import org.terasology.gestalt.naming.Name;
import org.terasology.gestalt.naming.Version;
import org.terasology.unittest.ExampleClass;
Expand Down Expand Up @@ -56,13 +56,9 @@ public void directoryModuleContainsClass() {
public void archiveModuleContainsClass() throws IOException {
Module module = factory.createArchiveModule(new File("FIXME.jar"));

String someClassInTheModule = module.getClassIndex().getTypesAnnotatedWith(API.class.getName()).iterator().next();
Class<?> someClassInTheModule = module.getModuleManifest().getTypesAnnotatedWith(API.class).iterator().next();

try {
assertTrue(module.getClassPredicate().test(Class.forName(someClassInTheModule)));
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
assertTrue(module.getClassPredicate().test(someClassInTheModule));
assertFalse(module.getClassPredicate().test(SOME_CLASS_OUTSIDE_THE_MODULE));
}

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

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.reflections.Reflections;
import org.terasology.engine.core.TerasologyConstants;
import org.terasology.gestalt.di.index.CompoundClassIndex;
import org.terasology.gestalt.module.Module;
import org.terasology.gestalt.module.ModuleMetadata;
import org.terasology.gestalt.module.ModuleRegistry;
Expand Down Expand Up @@ -86,7 +86,7 @@ private Module buildSimpleModule(String id, String version) {
if (version != null) {
metadata.setVersion(new Version(version));
}
return new Module(metadata, new EmptyFileSource(), Collections.emptyList(), new CompoundClassIndex(), (c) -> false);
return new Module(metadata, new EmptyFileSource(), Collections.emptyList(), new Reflections(), (c) -> false);
}
private Module buildEngineModule(String version) {
return buildSimpleModule(TerasologyConstants.ENGINE_MODULE.toString(), version);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import org.mockito.junit.jupiter.MockitoExtension;
import org.reflections.Reflections;
import org.terasology.engine.config.flexible.AutoConfig;
import org.terasology.engine.core.PathManager;
import org.terasology.engine.core.PathManagerProvider;
import org.terasology.engine.core.subsystem.EngineSubsystem;
import org.terasology.engine.logic.permission.PermissionSetComponent;
import org.terasology.engine.world.block.structure.AttachSupportRequiredComponent;
import org.terasology.gestalt.di.index.CompoundClassIndex;
import org.terasology.gestalt.module.Module;
import org.terasology.gestalt.module.ModuleEnvironment;
import org.terasology.gestalt.module.ModuleMetadata;
Expand Down Expand Up @@ -59,7 +59,7 @@ private Module getEmptyTestModule() {
new ModuleMetadata(new Name("EmptyTestModule"), new Version("0.0.1")),
new EmptyFileSource(),
Collections.emptyList(),
new CompoundClassIndex(),
new Reflections(),
(clazz) -> false
);
}
Expand Down Expand Up @@ -127,7 +127,7 @@ public void engineModuleContainsSubsystems() {
environment = manager.getEnvironment();
engineModule = environment.get(ENGINE_MODULE);

assertThat(engineModule.getClassIndex().getSubtypesOf(EngineSubsystem.class.getName())).contains(subsystem.getName());
assertThat(engineModule.getModuleManifest().getSubTypesOf(EngineSubsystem.class)).contains(subsystem);

assertThat(environment.getSubtypesOf(EngineSubsystem.class)).contains(subsystem);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import com.google.gson.Gson;
import org.joml.Vector3f;
import org.junit.jupiter.api.Test;
import org.terasology.context.annotation.IndexInherited;
import org.terasology.engine.ModuleEnvironmentTest;
import org.terasology.engine.core.TerasologyConstants;
import org.terasology.engine.core.module.ModuleContext;
Expand All @@ -32,7 +31,7 @@
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.terasology.engine.testUtil.Assertions.assertNotEmpty;

public class TypeSerializerTest extends ModuleEnvironmentTest {
class TypeSerializerTest extends ModuleEnvironmentTest {
private static final SomeClass<Integer> INSTANCE = new SomeClass<>(0xdeadbeef);
private static final String INSTANCE_JSON = "{\"generic-t\":-559038737,\"list\":[50,51,-52,-53]," +
"\"animals\":[{\"class\":\"org.terasology.engine.persistence.serializers.TypeSerializerTest$Dog\"," +
Expand Down Expand Up @@ -156,7 +155,6 @@ public String toString() {
}

@SuppressWarnings("checkstyle:FinalClass")
@IndexInherited
public static class Animal<T> {
public T data;

Expand All @@ -180,11 +178,6 @@ public boolean equals(Object o) {
public int hashCode() {
return Objects.hash(data);
}

@Override
public String toString() {
return "Animal(data = " + data.toString() + ")";
}
}

public static final class Dog<T> extends Animal<T> {
Expand Down
34 changes: 8 additions & 26 deletions engine/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -120,25 +120,19 @@ dependencies {
}
implementation("net.logstash.logback:logstash-logback-encoder:7.4")

// JSemVer (Semantic Versioning) - A dependency of Gestalt
implementation("com.github.zafarkhaja:java-semver:0.10.2")

// Our developed libs
api("org.terasology.gestalt:gestalt-asset-core:8.0.0-SNAPSHOT")
api("org.terasology.gestalt:gestalt-module:8.0.0-SNAPSHOT")
api("org.terasology.gestalt:gestalt-entity-system:8.0.0-SNAPSHOT")
api("org.terasology.gestalt:gestalt-util:8.0.0-SNAPSHOT")
api("org.terasology.gestalt:gestalt-inject:8.0.0-SNAPSHOT")

annotationProcessor("org.terasology.gestalt:gestalt-inject-java:8.0.0-SNAPSHOT")
api("org.terasology.gestalt:gestalt-asset-core:7.2.1-SNAPSHOT")
api("org.terasology.gestalt:gestalt-module:7.2.1-SNAPSHOT")
api("org.terasology.gestalt:gestalt-entity-system:7.2.1-SNAPSHOT")
api("org.terasology.gestalt:gestalt-util:7.2.1-SNAPSHOT")

api("org.terasology:TeraMath:1.5.0")
api("org.terasology:splash-screen:1.1.1")
api("org.terasology.jnlua:JNLua:0.1.0-SNAPSHOT")
api("org.terasology.jnbullet:JNBullet:1.0.4")
api("org.terasology.nui:nui:4.0.0-SNAPSHOT")
api("org.terasology.nui:nui-reflect:4.0.0-SNAPSHOT")
api("org.terasology.nui:nui-gestalt:4.0.0-SNAPSHOT")
api("org.terasology.nui:nui:3.0.0")
api("org.terasology.nui:nui-reflect:3.0.0")
api("org.terasology.nui:nui-gestalt7:3.0.0")


// Wildcard dependency to catch any libs provided with the project (remote repo preferred instead)
Expand Down Expand Up @@ -212,23 +206,11 @@ tasks.register<Copy>("copyResourcesToClasses") {
into(sourceSets["main"].output.classesDirs.first())
}

tasks.named<JavaCompile>("compileJava") {
dependsOn(
tasks.named("copyResourcesToClasses"),
tasks.named("createVersionInfoFile")
)
// Create an asset list during compilation (needed for Gestalt 8)
inputs.files(sourceSets.main.get().resources.srcDirs)
options.compilerArgs = arrayListOf("-Aresource=${sourceSets.main.get().resources.srcDirs.joinToString(File.pathSeparator)}")
}
tasks.named<JavaCompile>("compileTestJava") {
tasks.named("compileJava") {
dependsOn(
tasks.named("copyResourcesToClasses"),
tasks.named("createVersionInfoFile")
)
// Create an asset list during compilation (needed for Gestalt 8)
inputs.files(sourceSets.test.get().resources.srcDirs)
options.compilerArgs = arrayListOf("-Aresource=${sourceSets.test.get().resources.srcDirs.joinToString(File.pathSeparator)}")
}

// Instructions for packaging a jar file for the engine
Expand Down
3 changes: 1 addition & 2 deletions engine/src/main/java/org/terasology/engine/audio/Sound.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ public abstract class Sound<T extends AssetData> extends Asset<T> implements org
* @param assetType The asset type this asset belongs to.
*/
protected Sound(ResourceUrn urn, AssetType<?, T> assetType, DisposableResource resource) {
super(urn, assetType);
setDisposableResource(resource);
super(urn, assetType, resource);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
*/
@API package org.terasology.engine.audio.events;

import org.terasology.context.annotation.API;
import org.terasology.gestalt.module.sandbox.API;
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

@API package org.terasology.engine.audio;

import org.terasology.context.annotation.API;
import org.terasology.gestalt.module.sandbox.API;
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import org.terasology.engine.utilities.gson.SetMultimapTypeAdapter;
import org.terasology.engine.utilities.gson.UriTypeAdapterFactory;
import org.terasology.gestalt.entitysystem.component.Component;
import org.terasology.context.annotation.API;
import org.terasology.gestalt.module.sandbox.API;
import org.terasology.gestalt.naming.Name;
import org.terasology.gestalt.naming.Version;
import org.terasology.gestalt.naming.gson.NameTypeAdapter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
package org.terasology.engine.config;

import org.terasology.engine.core.subsystem.Resolution;
import org.terasology.context.annotation.API;
import org.terasology.gestalt.module.sandbox.API;
import org.terasology.engine.rendering.cameras.PerspectiveCameraSettings;
import org.terasology.engine.rendering.nui.layers.mainMenu.videoSettings.DisplayModeSetting;
import org.terasology.engine.rendering.nui.layers.mainMenu.videoSettings.ScreenshotSize;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.terasology.engine.utilities.subscribables.AbstractSubscribable;
import org.terasology.context.annotation.API;
import org.terasology.gestalt.module.sandbox.API;

import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
package org.terasology.engine.config.facade;

import org.terasology.context.annotation.API;
import org.terasology.gestalt.module.sandbox.API;

/**
* TelemetryConfiguration is a wrapper for {@link org.terasology.engine.config.TelemetryConfig}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import com.google.common.collect.ImmutableList;
import org.reflections.ReflectionUtils;
import org.terasology.context.annotation.IndexInherited;
import org.terasology.engine.config.flexible.internal.SettingBuilder;
import org.terasology.engine.config.flexible.internal.SettingImplBuilder;
import org.terasology.engine.core.SimpleUri;
Expand All @@ -19,7 +18,6 @@
* Represents a config class that will be automatically initialized and rendered by the engine.
* All settings must be contained in {@code public static} fields of type {@link Setting}.
*/
@IndexInherited
public abstract class AutoConfig {
private SimpleUri id;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
package org.terasology.engine.config.flexible;

import org.terasology.engine.config.flexible.constraints.SettingConstraint;
import org.terasology.context.annotation.API;
import org.terasology.gestalt.module.sandbox.API;
import org.terasology.reflection.TypeInfo;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
// SPDX-License-Identifier: Apache-2.0
@API package org.terasology.engine.config.flexible.constraints;

import org.terasology.context.annotation.API;
import org.terasology.gestalt.module.sandbox.API;
Loading
Loading