Merge branch 'master' into easysetup & CBOR changes
[platform/upstream/iotivity.git] / android / android_api / SConscript
1 import os
2 import platform
3 Import('env')
4
5 android_home = env.get('ANDROID_HOME')
6
7 ANDROID_TARGET_ARCH = env.get('TARGET_ARCH')
8 if env.get('RELEASE'):
9         ANDROID_RELEASE="release"
10 else:
11         ANDROID_RELEASE="debug"
12
13 os.environ['ANDROID_HOME'] = env.get('ANDROID_HOME')
14 os.environ['ANDROID_NDK_HOME'] = env.get('ANDROID_NDK')
15
16 if not os.path.exists(android_home + '/platforms/android-21') or not os.path.exists(android_home + '/build-tools/20.0.0'):
17     print '''
18 ***************************************** Info ********************************
19 *   Either 'Android API 21' is not installed or 'Android SDK Build Tools      *
20 *   20.0.0' is not installed. The Android SDK Manager will now open. Please   *
21 *   be sure to deselect all options, then select the following 2 packages:    *
22 *       1. Under "Tools" select "Android SDK Build-tools" Revision 20.        *
23 *       2. Under "Android 5.0.1 (API 21)" select "SDK Platform"               *
24 *       3. Continue by selecting "Install 2 Packages"                         *
25 *                                                                             *
26 *   NOTE: If you have an http proxy, please press ctrl+c now and edit/create  *
27 *         the following file in your $HOME directory as follows:              *
28 *                                                                             *
29 * Edit/Create file: "$HOME/.android/androidtool.cfg"                          *
30 *                                                                             *
31 *    http.proxyPort=<YOUR_PORT_NUMBER>                                        *
32 *    sdkman.monitor.density=108                                               *
33 *    http.proxyHost=<YOUR_HTTP_PROXY_ADDRESS>                                 *
34 *    sdkman.show.update.only=true                                             *
35 *    sdkman.ask.adb.restart=false                                             *
36 *    sdkman.force.http=true                                                   *
37 *    sdkman.show.updateonly=true                                              *
38 *                                                                             *
39 *******************************************************************************
40
41 ...Opening Android SDK Manager now. Once you are finished, the build will continue.
42 '''
43     os.system(android_home + '/tools/android')
44
45 jdk_env = Environment(ENV=os.environ)
46 jdk_env['BUILDERS']['Gradle'] = Builder(action = env.get('ANDROID_GRADLE') + ' build -b' + os.getcwd()+'/build.gradle -PTARGET_ARCH=%s -PRELEASE=%s --stacktrace' %(ANDROID_TARGET_ARCH, ANDROID_RELEASE))
47 jdk_env.Gradle(target="base/objs", source="base/src/main/java/org/iotivity/base/OcResource.java")
48