mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-03 00:38:21 +00:00
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:
Generated
-15
@@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Kotlin2JsCompilerArguments">
|
||||
<option name="sourceMapPrefix" value="" />
|
||||
<option name="sourceMapEmbedSources" value="inlining" />
|
||||
</component>
|
||||
<component name="KotlinCommonCompilerArguments">
|
||||
<option name="apiVersion" value="1.1" />
|
||||
<option name="languageVersion" value="1.1" />
|
||||
</component>
|
||||
<component name="KotlinCompilerSettings">
|
||||
<option name="scriptTemplates" value="org.apollo.game.plugin.kotlin.KotlinPluginScript" />
|
||||
<option name="scriptTemplatesClasspath" value="$PROJECT_DIR$/game/out/production/classes" />
|
||||
</component>
|
||||
</project>
|
||||
+13
-42
@@ -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'
|
||||
@@ -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"
|
||||
}
|
||||
@@ -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() {
|
||||
|
||||
Vendored
+6
-1
@@ -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
|
||||
}
|
||||
|
||||
+18
-34
@@ -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"
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-4
@@ -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 = { _ -> }
|
||||
|
||||
@@ -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<File>) 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()
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
allprojects {
|
||||
plugins.withId('kotlin') {
|
||||
kotlin { experimental { coroutines 'enable' } }
|
||||
}
|
||||
}
|
||||
@@ -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'
|
||||
}
|
||||
+12
-2
@@ -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
|
||||
}
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
ext {
|
||||
kotlinVersion = '1.2.31'
|
||||
}
|
||||
+3
-1
@@ -34,4 +34,6 @@ def processPluginDir(Path pluginDir) {
|
||||
}
|
||||
}
|
||||
|
||||
pluginDirs.each { processPluginDir(it) }
|
||||
pluginDirs.each { processPluginDir(it) }
|
||||
include 'test-plugin'
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user