mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-03 00:38:21 +00:00
Make run task depend on plugin scripts
This commit is contained in:
+6
-10
@@ -44,14 +44,10 @@ subprojects {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
test {
|
||||||
def gameSubproject = project(':game')
|
testLogging {
|
||||||
|
events "passed", "skipped", "failed"
|
||||||
task(run, dependsOn: gameSubproject.tasks['assemble'], type: JavaExec) {
|
}
|
||||||
def gameClasspath = gameSubproject.sourceSets.main.runtimeClasspath
|
}
|
||||||
|
|
||||||
main = 'org.apollo.Server'
|
|
||||||
classpath = gameClasspath
|
|
||||||
jvmArgs = ['-Xmx1750M']
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,4 +34,13 @@ dependencies {
|
|||||||
compile group: 'org.jetbrains.kotlin', name: 'kotlin-compiler', version: "$kotlinVersion"
|
compile group: 'org.jetbrains.kotlin', name: 'kotlin-compiler', version: "$kotlinVersion"
|
||||||
|
|
||||||
testCompile "org.jetbrains.kotlin:kotlin-test-junit:$kotlinVersion"
|
testCompile "org.jetbrains.kotlin:kotlin-test-junit:$kotlinVersion"
|
||||||
|
}
|
||||||
|
|
||||||
|
task run(type: JavaExec, dependsOn: [classes, pluginClasses]) {
|
||||||
|
FileCollection gameClasspath = sourceSets.main.runtimeClasspath + sourceSets.main.compileClasspath
|
||||||
|
|
||||||
|
main = 'org.apollo.Server'
|
||||||
|
classpath = gameClasspath
|
||||||
|
jvmArgs = ['-Xmx1750M']
|
||||||
|
workingDir = "$rootDir"
|
||||||
}
|
}
|
||||||
+26
-15
@@ -23,6 +23,10 @@ task pluginTests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task pluginClasses {
|
||||||
|
group = "plugin-build"
|
||||||
|
}
|
||||||
|
|
||||||
check.dependsOn pluginTests
|
check.dependsOn pluginTests
|
||||||
|
|
||||||
class PluginBuildData {
|
class PluginBuildData {
|
||||||
@@ -69,7 +73,7 @@ def configurePluginDependencies(SourceSet mainSources, SourceSet testSources,
|
|||||||
def configurePluginTasks(String name, SourceSet mainSources, SourceSet testSources,
|
def configurePluginTasks(String name, SourceSet mainSources, SourceSet testSources,
|
||||||
FileCollection scriptFiles, List<PluginBuildData> pluginDependencies) {
|
FileCollection scriptFiles, List<PluginBuildData> pluginDependencies) {
|
||||||
|
|
||||||
task("${name}Tests", type: Test) {
|
def testsTask = task("${name}Tests", type: Test) {
|
||||||
group = "plugin-verification"
|
group = "plugin-verification"
|
||||||
|
|
||||||
testClassesDir = testSources.output.classesDir
|
testClassesDir = testSources.output.classesDir
|
||||||
@@ -81,23 +85,30 @@ def configurePluginTasks(String name, SourceSet mainSources, SourceSet testSourc
|
|||||||
html.destination = "$buildDir/reports/plugin-tests/$name"
|
html.destination = "$buildDir/reports/plugin-tests/$name"
|
||||||
junitXml.destination = "$buildDir/plugin-tests/$name"
|
junitXml.destination = "$buildDir/plugin-tests/$name"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
testLogging {
|
||||||
|
events "passed", "skipped", "failed"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task("compile${name}Scripts", type: JavaExec) {
|
|
||||||
group = "plugin-compile"
|
|
||||||
|
|
||||||
def outputDir = mainSources.output.classesDir.toString()
|
|
||||||
|
|
||||||
inputs.files scriptFiles
|
|
||||||
outputs.dir outputDir
|
|
||||||
|
|
||||||
classpath = sourceSets.main.compileClasspath + sourceSets.main.runtimeClasspath
|
|
||||||
main = 'org.apollo.game.plugin.kotlin.KotlinPluginCompiler'
|
|
||||||
args = [outputDir] + scriptFiles.collect { it.absoluteFile.toString() }
|
|
||||||
}
|
|
||||||
|
|
||||||
def testsTask = tasks["${name}Tests"]
|
|
||||||
pluginTests.dependsOn testsTask
|
pluginTests.dependsOn testsTask
|
||||||
|
|
||||||
|
if (!scriptFiles.empty) {
|
||||||
|
def compileScriptsTask = task("compile${name}Scripts", type: JavaExec) {
|
||||||
|
group = "plugin-compile"
|
||||||
|
|
||||||
|
def outputDir = mainSources.output.classesDir.toString()
|
||||||
|
|
||||||
|
inputs.files scriptFiles
|
||||||
|
outputs.dir outputDir
|
||||||
|
|
||||||
|
classpath = sourceSets.main.compileClasspath + sourceSets.main.runtimeClasspath
|
||||||
|
main = 'org.apollo.game.plugin.kotlin.KotlinPluginCompiler'
|
||||||
|
args = [outputDir] + scriptFiles.collect { it.absoluteFile.toString() }
|
||||||
|
}
|
||||||
|
|
||||||
|
pluginClasses.dependsOn compileScriptsTask
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def pluginTree = fileTree(dir: "$pluginsDir")
|
def pluginTree = fileTree(dir: "$pluginsDir")
|
||||||
|
|||||||
Reference in New Issue
Block a user