-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
80 lines (64 loc) · 2.61 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
68
69
70
71
72
73
74
75
76
77
78
79
80
group 'com.inriaspirals.gradle'
version '1.0'
apply plugin: 'groovy'
apply plugin: 'java'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compile gradleApi()
compile localGroovy()
compile 'org.mongodb:mongo-java-driver:3.4.2'
testCompile group: 'junit', name: 'junit', version: '4.11'
}
apply plugin: 'maven'
uploadArchives {
repositories {
mavenDeployer {
repository(url: uri('./Androfleet_Plugin'))
}
}
}
//-------------------------------------------------//
//Change the following values with your local paths//
//-------------------------------------------------//
def androfleetdir = "../androfleet"
def sdkpath = '/home/lakhdar/Android/Sdk'
//-------------------------------------------------//
task copyRsrc {
StringBuffer exout = new StringBuffer() //Standard output of a command
StringBuffer exerr = new StringBuffer() //Error output of a command
ext.exec = { List<String> command ->
command.execute().consumeProcessOutput(exout, exerr)
command.execute().waitForProcessOutput()
if( exout.size() > 0 ) println exout
if( exerr.size() > 0 ) println exerr
if( exout.size() > 0 ) exout.setLength(0)
if( exerr.size() > 0 ) exerr.setLength(0)
}
def local_properties = new File("${androfleetdir}/widi/local.properties")
local_properties.append("") //in order to create the file if it wasn't existing
local_properties.eachLine { def line ->
if (line.indexOf("sdk.dir") >= 0) {
ant.replace(file: local_properties, token: line, value: "")
}
}
local_properties.append("\nsdk.dir= ${sdkpath}")
doLast {
//compilation before copy
ext.exec(["${androfleetdir}/docker/build-core.py"])
ext.exec(["${androfleetdir}/widi/gradlew",'-b',"${androfleetdir}/widi/build.gradle",'-c',"${androfleetdir}/widi/settings.gradle",'-p',"${androfleetdir}/widi build"])
//copy of the needed resources to the /src/main/resources/ repository of the plugin
ant.copy(todir: "./src/main/resources/") {
ant.fileset(dir: "${androfleetdir}/docker/", includes: ["", "cleanAndrofleet.py", "experiment.py", "master.py", "node.py", "servicediscovery.py", ""])
}
ant.copy(todir: "./src/main/resources/") {
ant.fileset(dir: "${androfleetdir}/widi/widi/build/outputs/aar", includes: "widi-debug.aar")
}
ant.zip(destfile: "./src/main/resources/docker.zip") {
ant.fileset(dir: "${androfleetdir}/docker", includes: ["","build/*","avd/*",""])
}
}
}
uploadArchives.dependsOn(copyRsrc)