1 #//******************************************************************
3 #// Copyright 2016 Samsung Electronics All Rights Reserved.
5 #//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
7 #// Licensed under the Apache License, Version 2.0 (the "License");
8 #// you may not use this file except in compliance with the License.
9 #// You may obtain a copy of the License at
11 #// http://www.apache.org/licenses/LICENSE-2.0
13 #// Unless required by applicable law or agreed to in writing, software
14 #// distributed under the License is distributed on an "AS IS" BASIS,
15 #// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 #// See the License for the specific language governing permissions and
17 #// limitations under the License.
19 #//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
25 android_home = env.get('ANDROID_HOME')
27 ANDROID_TARGET_ARCH = env.get('TARGET_ARCH')
28 if env.get('RELEASE'):
29 ANDROID_RELEASE="release"
31 ANDROID_RELEASE="debug"
33 os.environ['ANDROID_HOME'] = env.get('ANDROID_HOME')
34 os.environ['ANDROID_NDK_HOME'] = env.get('ANDROID_NDK')
36 if not os.path.exists(android_home + '/platforms/android-21') or not os.path.exists(android_home + '/build-tools/20.0.0'):
38 ***************************************** Info ********************************
39 * Either 'Android API 21' is not installed or 'Android SDK Build Tools *
40 * 20.0.0' is not installed. The Android SDK Manager will now open. Please *
41 * be sure to deselect all options, then select the following 2 packages: *
42 * 1. Under "Tools" select "Android SDK Build-tools" Revision 20. *
43 * 2. Under "Android 5.0.1 (API 21)" select "SDK Platform" *
44 * 3. Continue by selecting "Install 2 Packages" *
46 * NOTE: If you have an http proxy, please press ctrl+c now and edit/create *
47 * the following file in your $HOME directory as follows: *
49 * Edit/Create file: "$HOME/.android/androidtool.cfg" *
51 * http.proxyPort=<YOUR_PORT_NUMBER> *
52 * sdkman.monitor.density=108 *
53 * http.proxyHost=<YOUR_HTTP_PROXY_ADDRESS> *
54 * sdkman.show.update.only=true *
55 * sdkman.ask.adb.restart=false *
56 * sdkman.force.http=true *
57 * sdkman.show.updateonly=true *
59 *******************************************************************************
61 ...Opening Android SDK Manager now. Once you are finished, the build will continue.
63 os.system(android_home + '/tools/android')
65 #SConscript("../../../../../../android/android_api/SConscript")
67 def ensure_libs(target, source, env):
68 return target, [source, env.get('BUILD_DIR') + 'liboc.so', env.get('BUILD_DIR') + 'liboc_logger.so']
70 jdk_env = Environment(ENV=os.environ)
71 jdk_env['BUILDERS']['Gradle'] = Builder(action = env.get('ANDROID_GRADLE') +
72 ' build -bservice/easy-setup/sampleapp/mediator/android/EasySetup/build.gradle -PTARGET_ARCH=%s -PRELEASE=%s --stacktrace' %(ANDROID_TARGET_ARCH, ANDROID_RELEASE),
73 emitter = ensure_libs)
74 jdk_env['BUILD_DIR'] = env.get('BUILD_DIR')
75 cmdBuildEasysetupApp=jdk_env.Gradle(target="EasySetup/app/apk",
76 source="EasySetup/app/src/main/java/org/iotivity/service/easysetup/EasysetupActivity.java")
78 Depends(cmdBuildEasysetupApp, env.get('baseAAR'))