diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml
deleted file mode 100644
index ee4beb07..00000000
--- a/.idea/kotlinc.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index 5ce4fad5..f8a414e4 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,52 +1,23 @@
+plugins {
+ id 'org.jetbrains.kotlin.jvm' version "1.2.60" apply(false)
+}
+
+wrapper {
+ gradleVersion = "4.9"
+ distributionType = Wrapper.DistributionType.ALL
+}
+
allprojects {
group = 'apollo'
version = '0.0.1'
-}
-
-apply from: 'properties.gradle'
-
-subprojects {
- apply plugin: 'java'
-
- sourceCompatibility = 1.8
- targetCompatibility = 1.8
repositories {
mavenLocal()
maven { url "https://repo.maven.apache.org/maven2" }
maven { url "https://dl.bintray.com/kotlin/kotlinx/" }
}
-
- dependencies {
- compile group: 'org.apache.commons', name: 'commons-compress', version: '1.10'
- compile group: 'org.jruby', name: 'jruby-complete', version: '9.0.5.0'
- compile group: 'com.google.guava', name: 'guava', version: '19.0'
- compile group: 'io.netty', name: 'netty-all', version: '4.0.34.Final'
- compile group: 'com.lambdaworks', name: 'scrypt', version: '1.4.0'
- compile group: 'com.mchange', name: 'c3p0', version: '0.9.5.2'
- compile group: 'org.bouncycastle', name: 'bcprov-jdk15on', version: '1.54'
- testCompile group: 'junit', name: 'junit', version: '4.12'
- testCompile group: 'org.powermock', name: 'powermock-module-junit4', version: '1.6.4'
- testCompile group: 'org.powermock', name: 'powermock-api-mockito', version: '1.6.4'
- }
-
- sourceSets {
- main {
- java {
- srcDirs = ['src/main/java']
- }
- }
-
- test {
- java {
- srcDirs = ['src/test/java']
- }
- }
- }
-
- test {
- testLogging {
- events "passed", "skipped", "failed"
- }
- }
}
+
+apply from: 'gradle/properties.gradle'
+apply from: 'gradle/kotlin.gradle'
+apply from: 'gradle/jacoco.gradle'
\ No newline at end of file
diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle
index 76639e17..8768ea0f 100644
--- a/buildSrc/build.gradle
+++ b/buildSrc/build.gradle
@@ -1,18 +1,5 @@
-apply plugin: 'kotlin'
apply plugin: 'groovy'
-buildscript {
- apply from: '../properties.gradle'
-
- repositories {
- mavenCentral()
- }
-
- dependencies {
- classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
- }
-}
-
repositories {
mavenLocal()
maven { url "https://repo.maven.apache.org/maven2" }
@@ -20,6 +7,4 @@ repositories {
dependencies {
compile gradleApi()
- compile group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib-jre8', version: "$kotlinVersion"
- compile group: 'org.jetbrains.kotlin', name: 'kotlin-reflect', version: "$kotlinVersion"
}
\ No newline at end of file
diff --git a/buildSrc/settings.gradle b/buildSrc/settings.gradle
new file mode 100644
index 00000000..e69de29b
diff --git a/buildSrc/src/main/groovy/org/apollo/build/plugin/ApolloPluginExtension.groovy b/buildSrc/src/main/groovy/org/apollo/build/plugin/ApolloPluginExtension.groovy
index a87c6082..aa554e47 100644
--- a/buildSrc/src/main/groovy/org/apollo/build/plugin/ApolloPluginExtension.groovy
+++ b/buildSrc/src/main/groovy/org/apollo/build/plugin/ApolloPluginExtension.groovy
@@ -47,30 +47,19 @@ class ApolloPluginExtension {
* and its scripts.
*/
def init() {
- def gameProject = project.findProject(":game")
- def pluginTestingProject = project.findProject(':game:plugin-testing')
-
project.plugins.apply('kotlin')
project.dependencies {
- def transitiveGameDeps = gameProject.configurations["compile"].dependencies
- def gameSources = gameProject.sourceSets.main
-
- transitiveGameDeps.each { dependency ->
- compile dependency
- }
-
- compile gameSources.output
- testCompile pluginTestingProject
+ implementation project.findProject(':game')
+ implementation project.findProject(':cache')
+ implementation project.findProject(':net')
+ implementation project.findProject(':util')
+ testImplementation project.findProject(':game:plugin-testing')
}
project.sourceSets {
main.kotlin.srcDirs += this.srcDir
test.kotlin.srcDirs += this.testDir
}
-
- project.tasks["compileKotlin"].kotlinOptions.freeCompilerArgs += [
- "-script-templates", "org.apollo.game.plugin.kotlin.KotlinPluginScript"
- ]
}
def getDependencies() {
diff --git a/cache/build.gradle b/cache/build.gradle
index 47511913..b8542ce7 100644
--- a/cache/build.gradle
+++ b/cache/build.gradle
@@ -1,5 +1,10 @@
+plugins {
+ id "java-library"
+}
+
description = 'Apollo Cache'
dependencies {
- compile project(':util')
+ implementation project(':util')
+ implementation group: 'com.google.guava', name: 'guava', version: guavaVersion
}
diff --git a/game/build.gradle b/game/build.gradle
index 52b8ba6f..4dfde3b3 100644
--- a/game/build.gradle
+++ b/game/build.gradle
@@ -1,44 +1,28 @@
+plugins {
+ id 'application'
+ id 'org.jetbrains.kotlin.jvm'
+ id 'org.jetbrains.kotlin.plugin.scripting'
+}
+
description = 'Apollo Game'
-
-buildscript {
- repositories {
- mavenCentral()
- }
-
- dependencies {
- classpath group: 'org.jetbrains.kotlin', name: 'kotlin-gradle-plugin', version: "$kotlinVersion"
- }
-}
-
-apply plugin: 'kotlin'
-
-allprojects {
- it.plugins.withId('kotlin') {
- kotlin { experimental { coroutines 'enable' } }
- }
-}
+mainClassName = 'org.apollo.Server'
dependencies {
compile project(':cache')
compile project(':net')
compile project(':util')
- compile group: 'io.github.lukehutch', name: 'fast-classpath-scanner', version: '2.0.21'
- compile group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib-jre8', version: "$kotlinVersion"
- compile group: 'org.jetbrains.kotlin', name: 'kotlin-script-runtime', version: "$kotlinVersion"
- compile group: 'org.jetbrains.kotlinx', name: 'kotlinx-coroutines-jdk8', version: '0.16'
- compile group: 'org.jetbrains.kotlinx', name: 'kotlinx-coroutines-core', version: '0.16'
+ compile group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib-jdk8'
+ compile group: 'org.jetbrains.kotlin', name: 'kotlin-scripting-common'
+ compile group: 'org.jetbrains.kotlinx', name: 'kotlinx-coroutines-jdk8', version: kotlinxCoroutinesVersion
+ compile group: 'org.jetbrains.kotlinx', name: 'kotlinx-coroutines-core', version: kotlinxCoroutinesVersion
- project(":game:plugin").subprojects.each { plugin ->
- runtime plugin
- }
+ implementation group: 'com.google.guava', name: 'guava', version: guavaVersion
+ implementation group: 'io.github.lukehutch', name: 'fast-classpath-scanner', version: classpathScannerVersion
+ implementation group: 'com.lambdaworks', name: 'scrypt', version: scryptVersion
- testCompile group: 'org.assertj', name: 'assertj-core', version: '3.8.0'
+ testImplementation group: 'junit', name: 'junit', version: junitVersion
+ testImplementation group: 'org.powermock', name: 'powermock-module-junit4', version: powermockVersion
+ testImplementation group: 'org.powermock', name: 'powermock-api-mockito', version: powermockVersion
+ testImplementation group: 'org.assertj', name: 'assertj-core', version: assertjVersion
}
-
-task run(type: JavaExec, dependsOn: classes) {
- main = 'org.apollo.Server'
- classpath = sourceSets.main.runtimeClasspath
- jvmArgs = ['-Xmx1750M']
- workingDir = "$rootDir"
-}
\ No newline at end of file
diff --git a/game/plugin-testing/build.gradle b/game/plugin-testing/build.gradle
index b9735b37..ce0c1592 100644
--- a/game/plugin-testing/build.gradle
+++ b/game/plugin-testing/build.gradle
@@ -1,13 +1,15 @@
-apply plugin: 'kotlin'
+plugins {
+ id 'java-library'
+ id 'org.jetbrains.kotlin.jvm'
+}
dependencies {
- compileOnly project(':game')
- compile group: 'org.assertj', name: 'assertj-core', version: '3.8.0'
+ api project(':game')
+ api project(':net')
- def gameTestConfiguration = project(':game').configurations.testCompile
- def gameTestDependencies = gameTestConfiguration.dependencies
+ api group: 'junit', name: 'junit', version: junitVersion
+ api group: 'org.powermock', name: 'powermock-api-mockito', version: powermockVersion
+ api group: 'org.assertj', name: 'assertj-core', version: assertjVersion
- gameTestDependencies.each {
- compile it
- }
+ implementation group: 'org.powermock', name: 'powermock-module-junit4', version: powermockVersion
}
\ No newline at end of file
diff --git a/game/plugin/build.gradle b/game/plugin/build.gradle
index 74cfb889..b1897a92 100644
--- a/game/plugin/build.gradle
+++ b/game/plugin/build.gradle
@@ -1,14 +1,5 @@
-buildscript {
- repositories {
- jcenter()
- mavenCentral()
-
- maven { url "https://plugins.gradle.org/m2/" }
- }
-
- dependencies {
- classpath "gradle.plugin.io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.0.0.RC4-3"
- }
+plugins {
+ id "io.gitlab.arturbosch.detekt" version "1.0.0.RC8" apply(false)
}
def detektConfig = "${project.projectDir}/detekt.yml"
@@ -18,33 +9,15 @@ subprojects { subproj ->
apply plugin: 'apollo-plugin'
apply plugin: 'io.gitlab.arturbosch.detekt'
- buildscript {
- repositories {
- jcenter()
- mavenCentral()
-
- maven { url "https://plugins.gradle.org/m2/" }
- }
-
- dependencies {
- classpath "gradle.plugin.io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.0.0.RC4-3"
- }
- }
-
- repositories {
- mavenCentral()
- maven {
- url { 'https://dl.bintray.com/kotlin/kotlinx/' }
- }
- }
-
detekt {
- version = "1.0.0.RC4-3"
-
profile("main") {
input = "${subproj.projectDir}/src"
config = detektConfig
}
}
+
+ dependencies {
+ implementation group: 'com.google.guava', name: 'guava', version: guavaVersion
+ }
}
}
diff --git a/game/plugin/skills/fishing/src/spots.kts b/game/plugin/skills/fishing/src/spots.plugin.kts
similarity index 95%
rename from game/plugin/skills/fishing/src/spots.kts
rename to game/plugin/skills/fishing/src/spots.plugin.kts
index b86b6e8f..8aa824b6 100644
--- a/game/plugin/skills/fishing/src/spots.kts
+++ b/game/plugin/skills/fishing/src/spots.plugin.kts
@@ -1,12 +1,10 @@
+
import org.apollo.game.model.Direction
import org.apollo.game.model.Position
import org.apollo.game.plugin.entity.spawn.Spawn
import org.apollo.game.plugin.entity.spawn.Spawns
import org.apollo.game.plugin.skills.fishing.FishingSpot
-import org.apollo.game.plugin.skills.fishing.FishingSpot.CAGE_HARPOON
-import org.apollo.game.plugin.skills.fishing.FishingSpot.NET_HARPOON
-import org.apollo.game.plugin.skills.fishing.FishingSpot.NET_ROD
-import org.apollo.game.plugin.skills.fishing.FishingSpot.ROD
+import org.apollo.game.plugin.skills.fishing.FishingSpot.*
// Al-Kharid
register(NET_ROD, x = 3267, y = 3148)
diff --git a/game/src/main/java/org/apollo/game/model/entity/attr/AttributeMap.java b/game/src/main/java/org/apollo/game/model/entity/attr/AttributeMap.java
index 0ee12779..c521e7b7 100644
--- a/game/src/main/java/org/apollo/game/model/entity/attr/AttributeMap.java
+++ b/game/src/main/java/org/apollo/game/model/entity/attr/AttributeMap.java
@@ -3,7 +3,6 @@ package org.apollo.game.model.entity.attr;
import java.util.HashMap;
import java.util.Map;
-import org.jruby.RubySymbol;
import com.google.common.base.Preconditions;
@@ -118,8 +117,6 @@ public final class AttributeMap {
return new NumericalAttribute((Double) value);
case STRING:
return new StringAttribute((String) value);
- case SYMBOL:
- return new StringAttribute(((RubySymbol) value).asJavaString(), true);
case BOOLEAN:
return new BooleanAttribute((Boolean) value);
}
diff --git a/game/src/main/kotlin/org/apollo/game/plugin/kotlin/KotlinPluginScript.kt b/game/src/main/kotlin/org/apollo/game/plugin/kotlin/KotlinPluginScript.kt
index a1b55151..fca5698d 100644
--- a/game/src/main/kotlin/org/apollo/game/plugin/kotlin/KotlinPluginScript.kt
+++ b/game/src/main/kotlin/org/apollo/game/plugin/kotlin/KotlinPluginScript.kt
@@ -13,11 +13,11 @@ import org.apollo.game.model.event.PlayerEvent
import org.apollo.game.plugin.PluginContext
import org.apollo.net.message.Message
import kotlin.reflect.KClass
-import kotlin.script.templates.ScriptTemplateDefinition
+import kotlin.script.experimental.annotations.KotlinScript
+import kotlin.script.experimental.annotations.KotlinScriptFileExtension
-@ScriptTemplateDefinition(
- scriptFilePattern = ".*\\.plugin\\.kts"
-)
+@KotlinScript("Apollo Plugin Script")
+@KotlinScriptFileExtension("plugin.kts")
abstract class KotlinPluginScript(private var world: World, val context: PluginContext) {
var startListener: (World) -> Unit = { _ -> }
var stopListener: (World) -> Unit = { _ -> }
diff --git a/game/src/main/resources/META-INF/kotlin/script/templates/org.apollo.game.plugin.kotlin.KotlinPluginScript b/game/src/main/resources/META-INF/kotlin/script/templates/org.apollo.game.plugin.kotlin.KotlinPluginScript
new file mode 100644
index 00000000..e69de29b
diff --git a/gradle/jacoco.gradle b/gradle/jacoco.gradle
new file mode 100644
index 00000000..9d926762
--- /dev/null
+++ b/gradle/jacoco.gradle
@@ -0,0 +1,59 @@
+apply plugin: "jacoco"
+
+allprojects {
+ tasks.withType(Test) {
+ jacoco {
+ toolVersion = '0.8.1'
+ }
+
+ afterEvaluate {
+ jacocoTestReport {
+ dependsOn tasks.test
+
+ sourceSets sourceSets.main
+ reports {
+ html.enabled = true
+ xml.enabled = true
+ csv.enabled = false
+ }
+ }
+ }
+ }
+}
+
+task jacocoTestReport(type: JacocoReport) {
+ sourceDirectories = files()
+ classDirectories = files()
+ executionData = files()
+
+ reports {
+ html.enabled = true
+ xml.enabled = true
+ csv.enabled = false
+ }
+
+ // Work-around to allow us to build list of executionData files in doFirst
+ onlyIf = {
+ true
+ }
+
+ /*
+ * Builds list of source dirs, class dirs, and executionData files
+ * when task is run, not at script evaluation time
+ */
+ doFirst {
+ subprojects.findAll { subproject ->
+ subproject.pluginManager.hasPlugin('java')
+ }.each { subproject ->
+ additionalSourceDirs files((Set) subproject.sourceSets.main.allJava.srcDirs)
+ additionalClassDirs((FileCollection) subproject.sourceSets.main.output)
+ if (subproject.pluginManager.hasPlugin('jacoco')) {
+ executionData subproject.tasks.jacocoTestReport.executionData
+ }
+ }
+
+ executionData = files(executionData.findAll {
+ it.exists()
+ })
+ }
+}
\ No newline at end of file
diff --git a/gradle/kotlin.gradle b/gradle/kotlin.gradle
new file mode 100644
index 00000000..0851617e
--- /dev/null
+++ b/gradle/kotlin.gradle
@@ -0,0 +1,5 @@
+allprojects {
+ plugins.withId('kotlin') {
+ kotlin { experimental { coroutines 'enable' } }
+ }
+}
\ No newline at end of file
diff --git a/gradle/properties.gradle b/gradle/properties.gradle
new file mode 100644
index 00000000..1eb5cd9a
--- /dev/null
+++ b/gradle/properties.gradle
@@ -0,0 +1,14 @@
+ext {
+ kotlinVersion = '1.2.60'
+ kotlinxCoroutinesVersion = '0.24.0'
+ junitVersion = '4.12'
+ powermockVersion = '1.6.4'
+ bouncycastleVersion = '1.54'
+ c3p0Version = '0.9.5.2'
+ scryptVersion = '1.4.0'
+ nettyVersion = '4.0.34.Final'
+ guavaVersion = '19.0'
+ commonsCompressVersion = '1.10'
+ assertjVersion = '3.8.0'
+ classpathScannerVersion = '2.0.21'
+}
\ No newline at end of file
diff --git a/net/build.gradle b/net/build.gradle
index b004467d..7aa134bc 100644
--- a/net/build.gradle
+++ b/net/build.gradle
@@ -1,6 +1,16 @@
+plugins {
+ id 'java-library'
+}
+
description = 'Apollo Net'
dependencies {
- compile project(':cache')
- compile project(':util')
+ api project(':cache')
+
+ implementation project(':util')
+ implementation group: 'io.netty', name: 'netty-all', version: nettyVersion
+ implementation group: 'com.google.guava', name: 'guava', version: guavaVersion
+ implementation group: 'org.bouncycastle', name: 'bcprov-jdk15on', version: bouncycastleVersion
+
+ testImplementation group: 'junit', name: 'junit', version: junitVersion
}
diff --git a/properties.gradle b/properties.gradle
deleted file mode 100644
index d44cfccf..00000000
--- a/properties.gradle
+++ /dev/null
@@ -1,3 +0,0 @@
-ext {
- kotlinVersion = '1.2.31'
-}
\ No newline at end of file
diff --git a/settings.gradle b/settings.gradle
index 25f8e47f..6f0626f1 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -34,4 +34,6 @@ def processPluginDir(Path pluginDir) {
}
}
-pluginDirs.each { processPluginDir(it) }
\ No newline at end of file
+pluginDirs.each { processPluginDir(it) }
+include 'test-plugin'
+
diff --git a/util/build.gradle b/util/build.gradle
index 80b6ad3d..f10e362c 100644
--- a/util/build.gradle
+++ b/util/build.gradle
@@ -1 +1,15 @@
+plugins {
+ id "java-library"
+}
+
description = 'Apollo Utilities'
+
+dependencies {
+ api group: 'io.netty', name: 'netty-all', version: nettyVersion
+
+ implementation group: 'org.apache.commons', name: 'commons-compress', version: commonsCompressVersion
+ implementation group: 'com.google.guava', name: 'guava', version: guavaVersion
+ implementation group: 'org.bouncycastle', name: 'bcprov-jdk15on', version: bouncycastleVersion
+
+ testImplementation group: 'junit', name: 'junit', version: junitVersion
+}
\ No newline at end of file