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
+5 -9
View File
@@ -44,14 +44,10 @@ subprojects {
} }
} }
} }
test {
testLogging {
events "passed", "skipped", "failed"
}
} }
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']
} }
+9
View File
@@ -35,3 +35,12 @@ dependencies {
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"
}
+15 -4
View File
@@ -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,9 +85,16 @@ 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) { pluginTests.dependsOn testsTask
if (!scriptFiles.empty) {
def compileScriptsTask = task("compile${name}Scripts", type: JavaExec) {
group = "plugin-compile" group = "plugin-compile"
def outputDir = mainSources.output.classesDir.toString() def outputDir = mainSources.output.classesDir.toString()
@@ -96,8 +107,8 @@ def configurePluginTasks(String name, SourceSet mainSources, SourceSet testSourc
args = [outputDir] + scriptFiles.collect { it.absoluteFile.toString() } args = [outputDir] + scriptFiles.collect { it.absoluteFile.toString() }
} }
def testsTask = tasks["${name}Tests"] pluginClasses.dependsOn compileScriptsTask
pluginTests.dependsOn testsTask }
} }
def pluginTree = fileTree(dir: "$pluginsDir") def pluginTree = fileTree(dir: "$pluginsDir")