mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-03 00:38:21 +00:00
7ffef28117
Adds gradle tasks to build all plugin scripts under data/plugins with the KotlinPluginCompiler implementation previously used for runtime code generation. In addition to .plugin.kts files, scripts can also declare API code in .kt files which will also be included on the classpath and made available to other plugins.
66 lines
1.7 KiB
Groovy
66 lines
1.7 KiB
Groovy
description = 'Apollo Game'
|
|
|
|
buildscript {
|
|
repositories {
|
|
mavenCentral()
|
|
}
|
|
|
|
dependencies {
|
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
|
|
}
|
|
}
|
|
|
|
apply plugin: 'kotlin'
|
|
|
|
sourceSets {
|
|
main.kotlin.srcDirs += 'src/kotlin'
|
|
main.kotlin.excludes += 'stub.kt'
|
|
main.kotlin.excludes += '**/*.kts'
|
|
|
|
plugins {
|
|
kotlin {
|
|
srcDir 'data/plugins'
|
|
exclude 'stub.kt'
|
|
exclude '**/*.kts'
|
|
}
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
compile project(':cache')
|
|
compile project(':net')
|
|
compile project(':util')
|
|
|
|
pluginsCompile(configurations.compile)
|
|
pluginsCompile(sourceSets.main.output)
|
|
|
|
compile group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib-jre8', version: "$kotlinVersion"
|
|
compile group: 'org.jetbrains.kotlin', name: 'kotlin-compiler', version: "$kotlinVersion"
|
|
|
|
runtime files("$buildDir/plugins")
|
|
runtime sourceSets.plugins.output
|
|
}
|
|
|
|
|
|
task('compilePluginScripts', dependsOn: [classes, pluginsClasses], type: JavaExec) {
|
|
def compilerClasspath = [
|
|
configurations.compile.asPath,
|
|
configurations.runtime.asPath,
|
|
sourceSets.main.compileClasspath.asPath,
|
|
sourceSets.main.runtimeClasspath.asPath
|
|
]
|
|
|
|
def inputDir = "$projectDir/data/plugins"
|
|
def outputDir = "$buildDir/plugins"
|
|
def manifestPath = "$buildDir/plugins/manifest.txt"
|
|
|
|
inputs.source inputDir
|
|
outputs.dir outputDir
|
|
|
|
println compilerClasspath.join(':')
|
|
classpath = sourceSets.main.compileClasspath + sourceSets.main.runtimeClasspath
|
|
main = 'org.apollo.game.plugin.kotlin.KotlinPluginCompiler'
|
|
args = [inputDir, outputDir, manifestPath, compilerClasspath.join(':')]
|
|
}
|
|
|
|
assemble.dependsOn(compilePluginScripts) |