Commit 864f016d authored by Emmanuel Godard's avatar Emmanuel Godard

default simple davis task

parent 41278209
# Basic example of using Davis # Basic example of using Davis
## Without IDE
1. Write your java algorithm into the src folder : `MyAlgo.java`
2. Modify `args` parameters for task `davis` in `build.gradle`.
3. Run
```
./gradlew davis
```
You can collect all your examples in `scenario` file
1. Open `scr/scenario` file and add a line with 5 parameters :
`<scenarioName> <networkGeneratorFile> <scheme> <size> <algoFile : MyAlgo.java>`
3. Execute in a terminal with `./gradlew runscenarioName`
## Getting started with Intellij ## Getting started with Intellij
1. Clone the basic example repository : 1. Clone the basic example repository :
``` ```
git clone https://gitlab.lis-lab.fr/davis/basic-example.git git clone https://gitlab.lis-lab.fr/davis/basic-example.git
``` ```
2. Open IntelliJ and load project : 2. Open IntelliJ and load project :
``` ```
File/Open File/Open
``` ```
Choose the basic-example folder and click ok Choose the basic-example folder and click ok for *auto-import*.
## Write new algorithm ## Write new algorithm
1. Write your java algorithm into the src folder : MyAlgo.java 1. Write your java algorithm into the src folder : `MyAlgo.java`
2. Open scenario file and add a line with 5 parameters : 2. Open scenario file and add a line with 5 parameters :
`<testName> <networkGeneratorFile> <scheme> <size> <algoFile : MyAlgo.java>` `<testName> <networkGeneratorFile> <scheme> <size> <algoFile : MyAlgo.java>`
3. Refresh gradle panel. 3. Refresh gradle panel.
...@@ -26,12 +42,6 @@ gradle task named "runtestName" ...@@ -26,12 +42,6 @@ gradle task named "runtestName"
5. Click to execute. 5. Click to execute.
## Without Intellij
1. Write your java algorithm into the src folder : MyAlgo.java
2. Open scenario file and add a line with 5 parameters :
`<testName> <networkGeneratorFile> <scheme> <size> <algoFile : MyAlgo.java>`
3. Execute in a terminal with `./gradlew runtestName`
......
...@@ -9,6 +9,22 @@ apply plugin: "java" ...@@ -9,6 +9,22 @@ apply plugin: "java"
apply plugin: "idea" apply plugin: "idea"
apply plugin: "application" apply plugin: "application"
// Install jbotsim locally in libs/lib
task installJBotsim(type: Copy, group: "distribution", description: "Install jbotsim locally"){
dependsOn installDist
from 'build/install/basic-example/lib/'
include 'jbotsim-*'
into 'libs/lib'
}
// Basic task to launch davis with appropriate arguments :
// <network> <id> <size> <algo>
task davis(type: Exec, group: "Application", description: "Run default Davis") {
commandLine 'libs/bin/udavis','src/RingAnon2AgentsSym.java','RandomIds','18','src/randomWalkRing.java'
dependsOn installJBotsim
}
def davisFiles = "${projectDir}/libs/" def davisFiles = "${projectDir}/libs/"
println("${davisFiles}") println("${davisFiles}")
...@@ -31,6 +47,7 @@ repositories { ...@@ -31,6 +47,7 @@ repositories {
task downloadZipFile(type: Download) { task downloadZipFile(type: Download) {
src 'http://pageperso.lif.univ-mrs.fr/~emmanuel.godard/udavis-0.7rc1.zip' src 'http://pageperso.lif.univ-mrs.fr/~emmanuel.godard/udavis-0.7rc1.zip'
dest new File('libs', 'udavis-0.7rc1.zip') dest new File('libs', 'udavis-0.7rc1.zip')
overwrite false // to download only once
} }
task downloadAndUnzipFile(dependsOn: downloadZipFile, type: Copy) { task downloadAndUnzipFile(dependsOn: downloadZipFile, type: Copy) {
...@@ -58,8 +75,8 @@ dependencies { ...@@ -58,8 +75,8 @@ dependencies {
//Define integrationTest sources and ressources //Define integrationTest sources and ressources
sourceSets.main.java.srcDir('src') sourceSets.main.java.srcDir('src')
setMainClassName('Main') // Unset default MainClass
setMainClassName('')
ext.visitExamples = {scripts -> ext.visitExamples = {scripts ->
def srcDirectoryPath = "${rootProject.projectDir}" + File.separator + "src" + File.separator def srcDirectoryPath = "${rootProject.projectDir}" + File.separator + "src" + File.separator
......
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