-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
67 lines (54 loc) · 1.75 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
plugins {
id 'java'
}
group 'tomida'
version '1.0-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
maven {
url 'https://jade.tilab.com/maven'
}
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
// https://mvnrepository.com/artifact/com.tilab.jade/jade
compile group: 'com.tilab.jade', name: 'jade', version: '4.5.0'
}
task runGui(type: JavaExec) {
dependsOn compileJava
main = "jade.Boot"
classpath = sourceSets.main.runtimeClasspath
args('-gui')
}
task runContainer(type: JavaExec) {
dependsOn compileJava
onlyIf {
return project.hasProperty('shops') && project.hasProperty('consumers')
}
main "jade.Boot"
classpath = sourceSets.main.runtimeClasspath
final StringBuilder builder = new StringBuilder()
final int numberOfShops = project.hasProperty('shops')
? Integer.parseInt((String) project.shops) : 1
for (int i = 1; i <= numberOfShops; i++) {
builder.append("shop" + i + ":" + "tomida.agents.ShopAgent;")
builder.append("spy" + i + ":" + "tomida.agents.SpyAgent;")
}
final int numberOfConsumers = project.hasProperty('consumers')
? Integer.parseInt((String) project.consumers) : 1
for (int i = 1; i <= numberOfConsumers; i++) {
builder.append("customer" + i + ":" + "tomida.agents.ConsumerAgent;")
}
if (builder.length() > 0) {
builder.setLength(builder.length() - 1)
}
println builder.toString()
//
// numberOfShopAgents =
// project.hasProperty('tomida.agents') ? project.get
//
// if (project.hasProperty('tomida.agents')) { // "args" というプロパティが渡されていたら
args('-container', builder.toString())
// }
}