Update to Kotlin 1.60 and Gradle 4.9

Removes the dependency on legacy script compilation and now relies on script
discovery.  In addition, the Gradle build scripts were refactored and updated
to be compatible with Gradle 5.0 and make use of the new java-library
configurations.
This commit is contained in:
Gary Tierney
2018-08-19 19:26:51 +01:00
parent 7fee8277ab
commit 0651d535fa
20 changed files with 171 additions and 181 deletions
+18 -34
View File
@@ -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"
}
+10 -8
View File
@@ -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
}
+6 -33
View File
@@ -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
}
}
}
@@ -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)
@@ -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);
}
@@ -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 = { _ -> }