forked from cossacklabs/themis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
68 lines (53 loc) · 1.56 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
import org.apache.tools.ant.taskdefs.condition.Os
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.3'
}
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
minSdkVersion 16
}
sourceSets {
main {
java.srcDirs = ['src/wrappers/themis/java']
manifest.srcFile 'src/wrappers/themis/android/AndroidManifest.xml'
jniLibs.srcDirs = ['libs']
}
androidTest.setRoot('tests/themis/wrappers/android')
androidTest.java.srcDirs = ['tests/themis/wrappers/android']
androidTest.manifest.srcFile 'tests/themis/wrappers/android/AndroidManifest.xml'
}
task ndkBuild(type: Exec) {
workingDir 'jni'
commandLine getNdkBuildCmd()
if (project.hasProperty('boringssl_path')){
args = ["BORINGSSL_PATH=$boringssl_path"]
}
}
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn ndkBuild
}
task cleanNative(type: Exec) {
workingDir 'jni'
commandLine getNdkBuildCmd(), 'clean'
}
clean.dependsOn cleanNative
}
def getNdkDir() {
if (System.env.ANDROID_NDK_ROOT != null)
return System.env.ANDROID_NDK_ROOT
throw new GradleException("NDK location not found. Define location with an ANDROID_NDK_ROOT environment variable.")
}
def getNdkBuildCmd() {
def ndkbuild = getNdkDir() + "/ndk-build"
if (Os.isFamily(Os.FAMILY_WINDOWS))
ndkbuild += ".cmd"
return ndkbuild
}