-
Notifications
You must be signed in to change notification settings - Fork 7
/
build.gradle
70 lines (57 loc) · 1.89 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
apply plugin: "cpp"
// The cpp plugin is required so tahat the assemble task can be set to depend on the OS appropriate google test build task
//Determine OS
//TODO: Add Windows support.
ext.osname = System.properties['os.name'].toLowerCase().toLowerCase()
ext.staticLibName = 'libgtest.a'
if (osname.contains('windows')) {
print "Too close for missiles switching to guns."
} else if (osname.contains('mac') ) {
print 'build for mac'
ext.includes='darwin'
ext.libName='osx/' + staticLibName
ext.gtestTask = 'buildGoogleTestMac'
// assemble.dependsOn buildGoogleTestMac
} else {
print 'Building for linux.'
ext.includes='linux'
ext.libName='linux/'+ staticLibName
ext.gtestTask = 'buildGoogleTest'
// assemble.dependsOn buildGoogleTest
}
ext.jniHeadersTask = ':krypto-api:GenerateJniHeaders'
ext.jarTask = ':krypto-api:jar'
if( project.hasProperty('developmentMode') && project.developmentMode ) {
ext.jniHeadersTask = ":krypto${jniHeadersTask}"
ext.jarTask = ":krypto${jarTask}"
}
ext.depends = ["${jniHeadersTask}", "${gtestTask}" , "${jarTask}"]
task wrapper(type: Wrapper) {
gradleVersion = '2.14'
}
task buildEmscripten(type: Exec) {
commandLine './buildEmscripten.sh'
}
task buildGoogleTestMac(type: Exec) {
commandLine './buildGoogleTestMac.sh'
}
task buildGoogleTest(type: Exec) {
commandLine './buildGoogleTest.sh'
}
task copyBinariesToApi(type: Copy, dependsOn: 'krypto-lib:build') {
from 'krypto-lib/build/libs/main/shared/'
into 'krypto-api/src/main/resources/'
include( '**/*.so', '**/*.dylib' )
}
task buildFullJar(dependsOn: depends ) << {
// run build lib
tasks.getByPath(':krypto-lib:build').execute()
// move libs
tasks.getByPath('copyBinariesToApi').execute()
// run jar api
tasks.getByPath(':krypto-api:jar').execute()
}
build.dependsOn buildFullJar
assemble.finalizedBy {
buildEmscripten
}