diff --git a/engine/build.gradle b/engine/build.gradle index 8707334c5..f9fd95ad9 100644 --- a/engine/build.gradle +++ b/engine/build.gradle @@ -29,7 +29,7 @@ buildscript { // HACK: Needed for NUI and gestalt entity-component reflections classpath group: 'org.terasology.nui', name: 'nui', version: '3.1.0-SNAPSHOT' classpath group: 'javax.servlet', name: 'javax.servlet-api', version: '3.0.1' - classpath group: 'org.terasology.gestalt', name: 'gestalt-entity-system', version: '7.0.6-SNAPSHOT' + classpath group: 'org.terasology.gestalt', name: 'gestalt-entity-system', version: '7.2.0-SNAPSHOT' } } @@ -42,10 +42,10 @@ dependencies { api "com.badlogicgames.gdx:gdx-box2d:$gdxVersion" api "com.badlogicgames.gdx:gdx-controllers:$gdxVersion" - api(group: 'org.terasology.gestalt', name: 'gestalt-asset-core', version: '7.0.6-SNAPSHOT') - api(group: 'org.terasology.gestalt', name: 'gestalt-entity-system', version: '7.0.6-SNAPSHOT') - api(group: 'org.terasology.gestalt', name: 'gestalt-module', version: '7.0.6-SNAPSHOT') - api(group: 'org.terasology.gestalt', name: 'gestalt-util', version: '7.0.6-SNAPSHOT') + api(group: 'org.terasology.gestalt', name: 'gestalt-asset-core', version: '7.2.0-SNAPSHOT') + api(group: 'org.terasology.gestalt', name: 'gestalt-entity-system', version: '7.2.0-SNAPSHOT') + api(group: 'org.terasology.gestalt', name: 'gestalt-module', version: '7.2.0-SNAPSHOT') + api(group: 'org.terasology.gestalt', name: 'gestalt-util', version: '7.2.0-SNAPSHOT') api group: 'org.terasology.nui', name: 'nui', version: nuiVersion api group: 'org.terasology.nui', name: 'nui-libgdx', version: nuiVersion @@ -82,7 +82,7 @@ task cacheReflections { configurations."${sourceSets.main.runtimeClasspathConfigurationName}" outputs.upToDateWhen {classes.state.upToDate} - outputs.file("$buildDir/classes/reflections.cache") + outputs.file("$buildDir/resources/main/org/destinationsol/reflections.cache") dependsOn classes doLast { @@ -91,7 +91,7 @@ task cacheReflections { .addUrls(inputs.files.collect { it.toURI().toURL() }) .filterInputsBy({ it.startsWith("org.destinationsol") || it.startsWith("org.terasology.nui") }) .setScanners(new TypeAnnotationsScanner(), new SubTypesScanner())) - reflections.save("$buildDir/classes/reflections.cache") + reflections.save("$buildDir/resources/main/org/destinationsol/reflections.cache") } } diff --git a/engine/src/main/java/org/destinationsol/body/components/BodyLinked.java b/engine/src/main/java/org/destinationsol/body/components/BodyLinked.java index e202aa5f6..c1397ed59 100644 --- a/engine/src/main/java/org/destinationsol/body/components/BodyLinked.java +++ b/engine/src/main/java/org/destinationsol/body/components/BodyLinked.java @@ -47,7 +47,7 @@ public float getMass() { } @Override - public void copy(BodyLinked other) { + public void copyFrom(BodyLinked other) { this.mass = other.getMass(); } } diff --git a/engine/src/main/java/org/destinationsol/force/components/Durability.java b/engine/src/main/java/org/destinationsol/force/components/Durability.java index 15abbc019..65a685ee0 100644 --- a/engine/src/main/java/org/destinationsol/force/components/Durability.java +++ b/engine/src/main/java/org/destinationsol/force/components/Durability.java @@ -49,7 +49,7 @@ public void setDurability(float durability) { } @Override - public void copy(Durability other) { + public void copyFrom(Durability other) { this.durability = other.durability; } } diff --git a/engine/src/main/java/org/destinationsol/game/console/adapter/ParameterAdapter.java b/engine/src/main/java/org/destinationsol/game/console/adapter/ParameterAdapter.java index 5d5b7aa1c..9c727e911 100644 --- a/engine/src/main/java/org/destinationsol/game/console/adapter/ParameterAdapter.java +++ b/engine/src/main/java/org/destinationsol/game/console/adapter/ParameterAdapter.java @@ -15,6 +15,9 @@ */ package org.destinationsol.game.console.adapter; +import org.terasology.gestalt.module.sandbox.API; + +@API public interface ParameterAdapter { T parse(String raw); diff --git a/engine/src/main/java/org/destinationsol/game/console/adapter/ParameterAdapterManager.java b/engine/src/main/java/org/destinationsol/game/console/adapter/ParameterAdapterManager.java index ea04cb2b5..cadb95ac3 100644 --- a/engine/src/main/java/org/destinationsol/game/console/adapter/ParameterAdapterManager.java +++ b/engine/src/main/java/org/destinationsol/game/console/adapter/ParameterAdapterManager.java @@ -20,9 +20,11 @@ import org.destinationsol.SolApplication; import org.destinationsol.game.console.commands.PositionCommandHandler; import org.destinationsol.game.ship.hulls.HullConfig; +import org.terasology.gestalt.module.sandbox.API; import java.util.Map; +@API public class ParameterAdapterManager { private final Map, ParameterAdapter> adapters = Maps.newHashMap(); diff --git a/engine/src/main/java/org/destinationsol/game/console/annotations/package-info.java b/engine/src/main/java/org/destinationsol/game/console/annotations/package-info.java new file mode 100644 index 000000000..8c37b846d --- /dev/null +++ b/engine/src/main/java/org/destinationsol/game/console/annotations/package-info.java @@ -0,0 +1,18 @@ +/* + * Copyright 2021 The Terasology Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@API package org.destinationsol.game.console.annotations; + +import org.terasology.gestalt.module.sandbox.API; diff --git a/engine/src/main/java/org/destinationsol/game/console/suggesters/package-info.java b/engine/src/main/java/org/destinationsol/game/console/suggesters/package-info.java new file mode 100644 index 000000000..6988df301 --- /dev/null +++ b/engine/src/main/java/org/destinationsol/game/console/suggesters/package-info.java @@ -0,0 +1,18 @@ +/* + * Copyright 2021 The Terasology Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@API package org.destinationsol.game.console.suggesters; + +import org.terasology.gestalt.module.sandbox.API; diff --git a/engine/src/main/java/org/destinationsol/game/drawables/animated/AnimatedRectSprite.java b/engine/src/main/java/org/destinationsol/game/drawables/animated/AnimatedRectSprite.java index e60ccb851..cd594ed31 100644 --- a/engine/src/main/java/org/destinationsol/game/drawables/animated/AnimatedRectSprite.java +++ b/engine/src/main/java/org/destinationsol/game/drawables/animated/AnimatedRectSprite.java @@ -24,10 +24,12 @@ import org.destinationsol.game.SolObject; import org.destinationsol.game.drawables.DrawableLevel; import org.destinationsol.game.drawables.RectSprite; +import org.terasology.gestalt.module.sandbox.API; /** * AnimatedRectSprites are a specialised variant of RectSprites that can play a single animation, based off a sprite-sheet texture */ +@API public class AnimatedRectSprite extends RectSprite { private Animation spriteAnimation; private float animationTime; diff --git a/engine/src/main/java/org/destinationsol/health/components/Health.java b/engine/src/main/java/org/destinationsol/health/components/Health.java index e3251b20a..2bd97324b 100644 --- a/engine/src/main/java/org/destinationsol/health/components/Health.java +++ b/engine/src/main/java/org/destinationsol/health/components/Health.java @@ -26,7 +26,7 @@ public final class Health implements Component { public float currentHealth = 30; @Override - public void copy(Health other) { + public void copyFrom(Health other) { this.maxHealth = other.maxHealth; this.currentHealth = other.currentHealth; } diff --git a/engine/src/main/java/org/destinationsol/location/components/Angle.java b/engine/src/main/java/org/destinationsol/location/components/Angle.java index 5319d07b2..c02a2099e 100644 --- a/engine/src/main/java/org/destinationsol/location/components/Angle.java +++ b/engine/src/main/java/org/destinationsol/location/components/Angle.java @@ -27,7 +27,7 @@ public class Angle implements Component { private float angle; @Override - public void copy(Angle other) { + public void copyFrom(Angle other) { this.angle = other.angle; } diff --git a/engine/src/main/java/org/destinationsol/location/components/Position.java b/engine/src/main/java/org/destinationsol/location/components/Position.java index 7e38db2c9..0626d081e 100644 --- a/engine/src/main/java/org/destinationsol/location/components/Position.java +++ b/engine/src/main/java/org/destinationsol/location/components/Position.java @@ -27,7 +27,7 @@ public class Position implements Component { public Vector2 position = new Vector2(); @Override - public void copy(Position other) { + public void copyFrom(Position other) { position = other.position.cpy(); } } diff --git a/engine/src/main/java/org/destinationsol/location/components/Velocity.java b/engine/src/main/java/org/destinationsol/location/components/Velocity.java index ffa461f34..ba547c225 100644 --- a/engine/src/main/java/org/destinationsol/location/components/Velocity.java +++ b/engine/src/main/java/org/destinationsol/location/components/Velocity.java @@ -27,7 +27,7 @@ public class Velocity implements Component { public Vector2 velocity = new Vector2(); @Override - public void copy(Velocity other) { + public void copyFrom(Velocity other) { velocity = other.velocity.cpy(); } } diff --git a/engine/src/main/java/org/destinationsol/modules/ModuleManager.java b/engine/src/main/java/org/destinationsol/modules/ModuleManager.java index 7f504dd0d..6e297d554 100644 --- a/engine/src/main/java/org/destinationsol/modules/ModuleManager.java +++ b/engine/src/main/java/org/destinationsol/modules/ModuleManager.java @@ -106,7 +106,34 @@ public class ModuleManager { "com.badlogic.gdx.graphics.g2d", // The hull config exposes a box2d body instance "com.badlogic.gdx.physics", - "com.badlogic.gdx.physics.box2d" + "com.badlogic.gdx.physics.box2d", + // NUI doesn't use gestalt's @API annotations anymore, so they are replicated here + "org.terasology.input", + "org.terasology.input.device", + "org.terasology.input.device.nulldevices", + "org.terasology.nui", + "org.terasology.nui.asset", + "org.terasology.nui.asset.font", + "org.terasology.nui.canvas", + "org.terasology.nui.databinding", + "org.terasology.nui.events", + "org.terasology.nui.itemRendering", + "org.terasology.nui.layouts", + "org.terasology.nui.layouts.miglayout", + "org.terasology.nui.layouts.relative", + "org.terasology.nui.properties", + "org.terasology.nui.reflection", + "org.terasology.nui.skin", + "org.terasology.nui.translate", + "org.terasology.nui.util", + "org.terasology.nui.widgets", + "org.terasology.nui.widgets.treeView", + "org.terasology.nui.widgets.types", + "org.terasology.nui.widgets.types.builtin", + "org.terasology.nui.widgets.types.builtin.object", + "org.terasology.nui.widgets.types.builtin.util", + "org.terasology.nui.widgets.types.math", + "org.terasology.reflection.metadata" }; protected static final Class[] CLASS_WHITELIST = new Class[]{ InvocationTargetException.class, @@ -162,7 +189,14 @@ public class ModuleManager { org.terasology.gestalt.entitysystem.entity.EntityManager.class, org.terasology.gestalt.entitysystem.event.EventResult.class, org.terasology.gestalt.entitysystem.event.ReceiveEvent.class, - org.terasology.gestalt.entitysystem.prefab.GeneratedFromRecipeComponent.class + org.terasology.gestalt.entitysystem.prefab.Prefab.class, + org.terasology.gestalt.entitysystem.prefab.GeneratedFromRecipeComponent.class, + /* NUI classes */ + org.terasology.input.device.InputDevice.class, + org.terasology.input.device.KeyboardDevice.class, + org.terasology.input.device.MouseDevice.class, + org.terasology.reflection.MappedContainer.class, + org.terasology.reflection.TypeInfo.class }; protected static ModuleEnvironment environment; @@ -229,7 +263,7 @@ public void loadEnvironment(Set modules) { scanner.scan(reflections); Policy.setPolicy(new ModuleSecurityPolicy()); System.setSecurityManager(new ModuleSecurityManager()); - environment = new ModuleEnvironment(modules,permissionFactory); + environment = new ModuleEnvironment(modules, permissionFactory); } public ModuleEnvironment getEnvironment() { diff --git a/engine/src/main/java/org/destinationsol/rendering/components/Renderable.java b/engine/src/main/java/org/destinationsol/rendering/components/Renderable.java index b459c4e2d..9daf6241e 100644 --- a/engine/src/main/java/org/destinationsol/rendering/components/Renderable.java +++ b/engine/src/main/java/org/destinationsol/rendering/components/Renderable.java @@ -30,7 +30,7 @@ public final class Renderable implements Component { public boolean isInvisible; @Override - public void copy(Renderable other) { + public void copyFrom(Renderable other) { ArrayList newElements = new ArrayList<>(); for (int index = 0; index < other.elements.size(); index++) { RenderableElement data = new RenderableElement(); diff --git a/engine/src/main/java/org/destinationsol/size/components/Size.java b/engine/src/main/java/org/destinationsol/size/components/Size.java index 62ab7009d..9d07fb92c 100644 --- a/engine/src/main/java/org/destinationsol/size/components/Size.java +++ b/engine/src/main/java/org/destinationsol/size/components/Size.java @@ -25,7 +25,7 @@ public class Size implements Component { public float size; @Override - public void copy(Size other) { + public void copyFrom(Size other) { this.size = other.size; } } diff --git a/engine/src/main/java/org/destinationsol/ui/nui/package-info.java b/engine/src/main/java/org/destinationsol/ui/nui/package-info.java new file mode 100644 index 000000000..2502e6d98 --- /dev/null +++ b/engine/src/main/java/org/destinationsol/ui/nui/package-info.java @@ -0,0 +1,18 @@ +/* + * Copyright 2021 The Terasology Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@API package org.destinationsol.ui.nui; + +import org.terasology.gestalt.module.sandbox.API; diff --git a/engine/src/main/java/org/destinationsol/ui/nui/screens/package-info.java b/engine/src/main/java/org/destinationsol/ui/nui/screens/package-info.java new file mode 100644 index 000000000..d76d93c25 --- /dev/null +++ b/engine/src/main/java/org/destinationsol/ui/nui/screens/package-info.java @@ -0,0 +1,18 @@ +/* + * Copyright 2021 The Terasology Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@API package org.destinationsol.ui.nui.screens; + +import org.terasology.gestalt.module.sandbox.API; diff --git a/engine/src/main/java/org/destinationsol/ui/nui/widgets/package-info.java b/engine/src/main/java/org/destinationsol/ui/nui/widgets/package-info.java new file mode 100644 index 000000000..ae40fda61 --- /dev/null +++ b/engine/src/main/java/org/destinationsol/ui/nui/widgets/package-info.java @@ -0,0 +1,18 @@ +/* + * Copyright 2021 The Terasology Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@API package org.destinationsol.ui.nui.widgets; + +import org.terasology.gestalt.module.sandbox.API; diff --git a/engine/src/main/java/org/destinationsol/world/generators/package-info.java b/engine/src/main/java/org/destinationsol/world/generators/package-info.java new file mode 100644 index 000000000..68f8609b4 --- /dev/null +++ b/engine/src/main/java/org/destinationsol/world/generators/package-info.java @@ -0,0 +1,18 @@ +/* + * Copyright 2021 The Terasology Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@API package org.destinationsol.world.generators; + +import org.terasology.gestalt.module.sandbox.API; diff --git a/engine/src/main/java/org/destinationsol/world/package-info.java b/engine/src/main/java/org/destinationsol/world/package-info.java new file mode 100644 index 000000000..f2fad8dd0 --- /dev/null +++ b/engine/src/main/java/org/destinationsol/world/package-info.java @@ -0,0 +1,18 @@ +/* + * Copyright 2021 The Terasology Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@API package org.destinationsol.world; + +import org.terasology.gestalt.module.sandbox.API; diff --git a/templates/build.gradle b/templates/build.gradle index a14af1abb..bc4b030e3 100644 --- a/templates/build.gradle +++ b/templates/build.gradle @@ -183,9 +183,7 @@ task createSkeleton() { task cacheReflections { description = 'Caches reflection output to make regular startup faster. May go stale and need cleanup at times.' - inputs.files sourceSets.main.output.classesDirs, - // getClassesDir from all sourceSets (for any jvm (seems) language) - configurations."${sourceSets.main.runtimeClasspathConfigurationName}" + inputs.files sourceSets.main.output.classesDirs outputs.upToDateWhen {classes.state.upToDate} outputs.file("$buildDir/classes/reflections.cache")