-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
64 lines (55 loc) · 2.2 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
/*
* Builds the device-side library for reading sensor data on a pcDuino and
* publishing it to the cloud using IBM's Watson IoT service (MQTT).
*/
// Apply the java plugin to add support for Java
apply plugin: 'java'
apply plugin: 'eclipse'
// In this section you declare where to find the dependencies of your project
repositories {
// Use 'jcenter' for resolving your dependencies.
// You can declare any Maven/Ivy/file repository here.
mavenCentral()
maven {
url "https://repo.eclipse.org/content/repositories/paho-snapshots/"
}
}
// In this section you declare the dependencies for your production and test code
dependencies {
compile 'args4j:args4j:2.32'
compile 'com.google.code.gson:gson:2.3.1'
compile 'joda-time:joda-time:2.9.1'
compile 'com.ibm.messaging:watson-iot:0.1.3'
}
//create a single Jar with all dependencies
task fatJar(type: Jar) {
manifest {
attributes 'Implementation-Title': 'Gradle Jar File Example',
'Implementation-Version': '1.0.0',
'Main-Class': 'com.ibm.wasdev.sphere.sensors.Launcher'
}
baseName = project.name + '-all'
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}
// Runs the client on a local machine, emulating pin readings
task emulate(type: JavaExec) {
main = 'com.ibm.wasdev.sphere.sensors.Launcher'
classpath = sourceSets.main.runtimeClasspath
systemProperty "EMULATE_PINS", "true"
if (System.getProperty("iotConfig") != null)
{
def configs = System.getProperty("iotConfig").split()
def temp = File.createTempFile('iotproperties', '.conf')
temp.write('org=' + configs[0] + System.getProperty("line.separator"))
temp.append('type=pcduino' + System.getProperty("line.separator"))
temp.append('id=emulated' + System.getProperty("line.separator"))
temp.append('auth-method=token' + System.getProperty("line.separator"))
temp.append('auth-token=' + configs[1] + System.getProperty("line.separator"))
args "-c", temp.absolutePath
} else if (System.getProperty("iotConfigFile") != null)
{
args "-c", System.getProperty("iotConfigFile")
}
}
defaultTasks 'fatJar'