Update the Android build to use the latest toolset
[platform/core/uifw/dali-demo.git] / build / android / app / build.gradle
1 apply plugin: 'com.android.application'
2
3 def buildType = "debug"
4 def androidABI = System.getenv('TARGET')
5 def daliDir = System.getenv('DALI_DIR')
6 def daliEnvDir = System.getenv('DALI_ENV_DIR')
7 def daliEnvLibDir = daliEnvDir + '/lib'
8 def daliEnvFilesDir = daliEnvDir + '/files'
9
10 android {
11     namespace = "com.sec.dalidemo"
12     signingConfigs {
13         config {
14             storeFile file("../key.jks")
15             storePassword "Samsung"
16             keyAlias "key0"
17             keyPassword "Samsung"
18         }
19     }
20     compileSdkVersion 28
21     defaultConfig {
22         applicationId = 'com.sec.dalidemo'
23         minSdkVersion 26
24         targetSdkVersion 26
25         versionCode 1
26         versionName "1.0"
27         externalNativeBuild {
28             cmake {
29                 cppFlags "-fexceptions -frtti -w -Wall -std=c++17"
30                 arguments '-DANDROID_STL=c++_shared'
31             }
32         }
33     }
34     aaptOptions {
35         noCompress ''
36     }
37     buildTypes {
38         debug {
39             ndk {
40                 abiFilters androidABI
41             }
42             buildType = "debug"
43         }
44         release {
45             minifyEnabled false
46             proguardFiles getDefaultProguardFile('proguard-android.txt'),
47                     'proguard-rules.pro'
48             ndk {
49                 abiFilters androidABI
50             }
51
52             signingConfig signingConfigs.config
53             buildType = "release"
54         }
55     }
56     packagingOptions {
57         if( androidABI == "arm64-v8a" )
58         {
59           pickFirst 'lib/arm64-v8a/libc++_shared.so'
60           pickFirst 'lib/arm64-v8a/libdaliview.so'
61         }
62         else
63         {
64           pickFirst 'lib/armeabi-v7a/libc++_shared.so'
65           pickFirst 'lib/armeabi-v7a/libdaliview.so'
66         }
67     }
68     sourceSets {
69         main {
70             jniLibs.srcDirs += daliEnvLibDir
71             assets.srcDirs += daliEnvFilesDir
72         }
73     }
74     lintOptions {
75         checkReleaseBuilds false
76     }
77     externalNativeBuild {
78         cmake {
79             version '3.10.2'
80             path 'src/main/cpp/CMakeLists.txt'
81         }
82     }
83     compileOptions {
84         targetCompatibility = 1.8
85         sourceCompatibility = 1.8
86     }
87 }
88
89 dependencies {
90     implementation fileTree(include: ['*.jar'], dir: 'libs')
91     implementation 'androidx.appcompat:appcompat:1.1.0'
92     implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
93 }
94
95 task buildDaliDependencies(type:Exec) {
96     environment "PREFIX", daliEnvDir
97     environment "ANDROID_ABI", androidABI
98     environment "ANDROID_PLATFORM", "26"
99     if (buildType == 'debug')
100         environment "DEBUG", "1"
101     workingDir file(daliDir + '/android-dependencies/cmake').getAbsolutePath()
102     commandLine 'sh',  './buildall.sh'
103 }
104
105 task buildDali(type:Exec) {
106     workingDir "../dali"
107     if (buildType == 'debug')
108         environment "DEBUG", "1"
109     commandLine 'sh', './build.sh'
110 }
111
112 task cleanDali(type:Exec) {
113     workingDir "../dali"
114     commandLine 'sh', './build.sh', 'clean'
115 }
116
117
118 tasks.withType(JavaCompile) {
119     options.deprecation = true
120 }
121
122 buildDali.dependsOn buildDaliDependencies
123 preBuild.dependsOn buildDali
124
125 clean.dependsOn cleanDali