Make run task depend on plugin scripts

This commit is contained in:
Gary Tierney
2017-06-01 22:47:50 +01:00
parent eed32efcf9
commit 42fdaee8b8
3 changed files with 41 additions and 25 deletions
+6 -10
View File
@@ -44,14 +44,10 @@ subprojects {
}
}
}
}
def gameSubproject = project(':game')
task(run, dependsOn: gameSubproject.tasks['assemble'], type: JavaExec) {
def gameClasspath = gameSubproject.sourceSets.main.runtimeClasspath
main = 'org.apollo.Server'
classpath = gameClasspath
jvmArgs = ['-Xmx1750M']
test {
testLogging {
events "passed", "skipped", "failed"
}
}
}
+9
View File
@@ -34,4 +34,13 @@ dependencies {
compile group: 'org.jetbrains.kotlin', name: 'kotlin-compiler', version: "$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
View File
@@ -23,6 +23,10 @@ task pluginTests {
}
}
task pluginClasses {
group = "plugin-build"
}
check.dependsOn pluginTests
class PluginBuildData {
@@ -69,7 +73,7 @@ def configurePluginDependencies(SourceSet mainSources, SourceSet testSources,
def configurePluginTasks(String name, SourceSet mainSources, SourceSet testSources,
FileCollection scriptFiles, List<PluginBuildData> pluginDependencies) {
task("${name}Tests", type: Test) {
def testsTask = task("${name}Tests", type: Test) {
group = "plugin-verification"
testClassesDir = testSources.output.classesDir
@@ -81,23 +85,30 @@ def configurePluginTasks(String name, SourceSet mainSources, SourceSet testSourc
html.destination = "$buildDir/reports/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
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")