Treat each plugin as an individual source set

Adds separate build tasks for each plugin by auto-discovering plugin meta
files in the build script.  Each plugin will automatically have its
main sources and tests compiled, and then it's output added to the game
modules classpath.

This enables support for incremental compilation of scripts, as well as
unit testing using Gradle's test framework.
This commit is contained in:
Gary Tierney
2017-05-30 02:19:09 +01:00
parent 4ee123a59d
commit 3fb6d3f792
23 changed files with 225 additions and 80 deletions
+7
View File
@@ -0,0 +1,7 @@
name = "Banking"
package = "org.apollo.game.plugin.banking"
authors = [ "Major" ]
[config]
srcDir = "src/"
testDir = "test/"
-14
View File
@@ -1,14 +0,0 @@
<?xml version="1.0"?>
<plugin>
<id>bank</id>
<version>1</version>
<name>Bank</name>
<description>Opens the bank interface when players select 'use-quickly' on a bank booth.</description>
<authors>
<author>Major</author>
</authors>
<scripts>
<script>bank.plugin.kts</script>
</scripts>
<dependencies />
</plugin>
View File
+8
View File
@@ -0,0 +1,8 @@
name = "spawning"
package = "org.apollo.game.plugin.entity"
authors = [ "Gary Tierney" ]
dependencies = [ "entity_lookup" ]
[config]
srcDir = "src/"
testDir = "test/"
@@ -0,0 +1,8 @@
name = "lumbridge npc spawns"
package = "org.apollo.game.plugin.locations"
authors = [ "Gary Tierney" ]
dependencies = [ "spawning" ]
[config]
srcDir = "src/"
testDir = "test/"
+2
View File
@@ -0,0 +1,2 @@
name = "entity lookup"
package = "org.apollo.game.plugins.util"
@@ -0,0 +1,14 @@
import org.apollo.cache.def.ItemDefinition
import org.junit.Test
import kotlin.test.assertEquals
class LookupTests {
@Test fun itemLookup() {
val testItem = ItemDefinition(0)
testItem.name = "sword"
ItemDefinition.init(arrayOf(testItem))
assertEquals(testItem, lookup_item("sword"))
}
}