Commit 26088076 authored by Denis Arrivault's avatar Denis Arrivault

Working example

parent 78b376b0
*.iml
.gradle/*
*.class
\ No newline at end of file
#Fri Mar 01 14:09:16 CET 2019
gradle.version=4.10
This diff is collapsed.
......@@ -66,38 +66,38 @@ sourceSets.main.java.srcDir('src')
setMainClassName('Main')
//ext.visitExamples = {scripts ->
// def srcDirectoryPath = "${rootProject.projectDir}" + File.separator + "src" + File.separator
// println(srcDirectoryPath)
// def scenariFile = new File(srcDirectoryPath + "scenario")
// if (scenariFile.exists()){
// def scenari = scenariFile.text.split('\n')
// scenari.findAll {
// if (!it.startsWith('#')){
// def scenario = it.split();
// def name = scenario.take(1).join("")
// scenario = scenario.drop(1)
// def args = "["
// scenario.findAll{arg ->
// if (arg.endsWith(".java") || arg.endsWith(".topology")){
// arg = "${srcDirectoryPath}" + arg
// }
// args += "\"" + arg + "\","
// }.each{}
// args = args.substring(0,args.length()-1) + "]"
// scripts.put(name, args)
// }
// }.each{}
// }
//}
//
//def scripts = [:]
//visitExamples(scripts)
//scripts.each() { scriptName, scriptArgs ->
// tasks.create(name: 'run' + scriptName,
// type: JavaExec, group: "Application", description: "Run " + scriptName) {
// classpath sourceSets.main.runtimeClasspath
// main = 'davis.ui.UDavisX'
// args = Eval.me(scriptArgs)
// }
//}
ext.visitExamples = {scripts ->
def srcDirectoryPath = "${rootProject.projectDir}" + File.separator + "src" + File.separator
println(srcDirectoryPath)
def scenariFile = new File(srcDirectoryPath + "scenario")
if (scenariFile.exists()){
def scenari = scenariFile.text.split('\n')
scenari.findAll {
if (!it.startsWith('#')){
def scenario = it.split();
def name = scenario.take(1).join("")
scenario = scenario.drop(1)
def args = "["
scenario.findAll{arg ->
if (arg.endsWith(".java") || arg.endsWith(".topology")){
arg = "${srcDirectoryPath}" + arg
}
args += "\"" + arg + "\","
}.each{}
args = args.substring(0,args.length()-1) + "]"
scripts.put(name, args)
}
}.each{}
}
}
def scripts = [:]
visitExamples(scripts)
scripts.each() { scriptName, scriptArgs ->
tasks.create(name: 'run' + scriptName,
type: JavaExec, group: "Application", description: "Run " + scriptName) {
classpath sourceSets.main.runtimeClasspath
main = 'davis.ui.UDavisX'
args = Eval.me(scriptArgs)
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment