5 PROJECT_VERSION = env.get('PROJECT_VERSION')
7 TARGET_ARCH = env.get('TARGET_ARCH')
12 SECURED = env.get('SECURED')
14 target_os = env.get('TARGET_OS')
16 if env.get('WITH_CLOUD'):
21 if env.get('WITH_TCP'):
25 if env.get('MULTIPLE_OWNER'):
26 ANDROID_MULTIPLE_OWNER=1
28 ANDROID_MULTIPLE_OWNER=0
30 MQ = env.get('WITH_MQ')
34 RD_MODE = env.get('RD_MODE')
35 TARGET_TRANSPORT = env.get('TARGET_TRANSPORT')
47 if 'ALL' in TARGET_TRANSPORT:
51 print "Android Transport is ALL"
53 if 'BT' in TARGET_TRANSPORT:
55 if 'BLE' in TARGET_TRANSPORT:
57 if 'NFC' in TARGET_TRANSPORT:
60 if target_os == "android":
61 android_home = env.get('ANDROID_HOME')
62 os.environ['ANDROID_HOME'] = env.get('ANDROID_HOME')
63 os.environ['ANDROID_NDK_HOME'] = env.get('ANDROID_NDK')
64 if not os.path.exists(android_home + '/platforms/android-21') or not os.path.exists(android_home + '/build-tools/20.0.0'):
66 ***************************************** Info ********************************
67 * Either 'Android API 21' is not installed or 'Android SDK Build Tools *
68 * 20.0.0' is not installed. The Android SDK Manager will now open. Please *
69 * be sure to deselect all options, then select the following 2 packages: *
70 * 1. Under "Tools" select "Android SDK Build-tools" Revision 20. *
71 * 2. Under "Android 5.0.1 (API 21)" select "SDK Platform" *
72 * 3. Continue by selecting "Install 2 Packages" *
74 * NOTE: If you have an http proxy, please press ctrl+c now and edit/create *
75 * the following file in your $HOME directory as follows: *
77 * Edit/Create file: "$HOME/.android/androidtool.cfg" *
79 * http.proxyPort=<YOUR_PORT_NUMBER> *
80 * sdkman.monitor.density=108 *
81 * http.proxyHost=<YOUR_HTTP_PROXY_ADDRESS> *
82 * sdkman.show.update.only=true *
83 * sdkman.ask.adb.restart=false *
84 * sdkman.force.http=true *
85 * sdkman.show.updateonly=true *
87 *******************************************************************************
89 ...Opening Android SDK Manager now. Once you are finished, the build will continue.
91 os.system(android_home + '/tools/android')
93 def ensure_libs(target, source, env):
94 return target, [source, env.get('BUILD_DIR') + 'liboc.so', env.get('BUILD_DIR') + 'liboc_logger.so', env.get('BUILD_DIR') + 'libocstack-jni.so']
96 SConscript('jni/SConscript')
98 jdk_env = Environment(ENV=os.environ)
99 jdk_env['BUILDERS']['Gradle'] = Builder(action = env.get('ANDROID_GRADLE') + ' build -b ' + env.get('SRC_DIR') + '/java/iotivity-%s/build.gradle -PPROJECT_VERSION=%s -PWITH_TRANSPORT_EDR=%s -PWITH_TRANSPORT_BLE=%s -PWITH_TRANSPORT_NFC=%s -PTARGET_ARCH=%s -PRELEASE=%s -PSECURED=%s -DSECURE=%s -PWITH_CLOUD=%s -PRD_MODE=%s -PWITH_MQ_PUB=%s -PWITH_MQ_SUB=%s -PWITH_MQ_BROKER=%s -PWITH_TCP=%s -PMULTIPLE_OWNER=%s -PBUILD_DIR=%s --stacktrace' %(target_os, PROJECT_VERSION, TRANSPORT_EDR, TRANSPORT_BLE, TRANSPORT_NFC, TARGET_ARCH, RELEASE, SECURED, SECURED, CLOUD, RD_MODE, MQ_PUB, MQ_SUB, MQ_BROKER, TCP, ANDROID_MULTIPLE_OWNER, env.get('BUILD_DIR')), emitter = ensure_libs)
100 jdk_env['BUILD_DIR'] = env.get('BUILD_DIR')
101 cmdBuildApi=jdk_env.Gradle(target="base/objs", source="common/src/main/java/org/iotivity/base/OcResource.java")
103 examples_target = "java"
104 if target_os == 'android':
105 examples_target = "android"
106 jdk_env['BUILDERS']['Gradle'] = Builder(action = env.get('ANDROID_GRADLE') + ' build -b ' + 'java/examples-%s/build.gradle -PPROJECT_VERSION=%s -DWITH_TRANSPORT_EDR=%s -DWITH_TRANSPORT_BLE=%s -DWITH_TRANSPORT_NFC=%s -PTARGET_OS=%s -PTARGET_ARCH=%s -PRELEASE=%s -PSECURED=%s -DSECURE=%s -PWITH_CLOUD=%s -PRD_MODE=%s -PWITH_MQ_PUB=%s -PWITH_MQ_SUB=%s -PWITH_MQ_BROKER=%s -PWITH_TCP=%s -PMULTIPLE_OWNER=%s -PBUILD_DIR=%s --stacktrace' %(examples_target, PROJECT_VERSION, TRANSPORT_EDR, TRANSPORT_BLE, TRANSPORT_NFC, target_os, TARGET_ARCH, RELEASE, SECURED, SECURED, CLOUD, RD_MODE, MQ_PUB, MQ_SUB, MQ_BROKER, TCP, ANDROID_MULTIPLE_OWNER, env.get('BUILD_DIR')))
107 #cmdBuildExamples=jdk_env.Gradle(target="../examples-%s/devicediscoveryclient/apk" % (examples_target, ), source="examples-%s/devicediscoveryclient/src/main/java/org/iotivity/base/examples/DeviceDiscoveryClient.java" % (examples_target, ))
108 cmdBuildExamples=jdk_env.Gradle(target="examples-%s/simpleclient/jar" % (examples_target, ), source="examples-%s/simpleclient/src/main/java/org/iotivity/base/examples/SimpleClient.java" % (examples_target, ))
110 if target_os != 'android':
111 exampleAclFiles = jdk_env.Install('#java/examples-java/simpleserver/build/libs/', 'examples-java/simpleserver/src/main/assets/oic_svr_db_server.dat')
112 exampleAclFiles += jdk_env.Install('#java/examples-java/simpleclientserver/build/libs/', 'examples-java/simpleserver/src/main/assets/oic_svr_db_server.dat')
113 Depends(exampleAclFiles, cmdBuildExamples)
115 Depends(cmdBuildExamples, cmdBuildApi)
117 if target_os == 'android':
118 jdk_env.Clean(cmdBuildExamples, '#/java/iotivity-android/build/')
119 jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/build/')
120 jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/cloudprovisioningclient/build/')
121 jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/devicediscoveryclient/build/')
122 jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/devicediscoveryserver/build/')
123 jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/DirectPairing/build/')
124 jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/fridgeclient/build/')
125 jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/fridgegroupclient/build/')
126 jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/fridgegroupserver/build/')
127 jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/fridgeserver/build/')
128 jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/groupclient/build/')
129 jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/groupserver/build/')
130 jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/presenceclient/build/')
131 jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/presenceserver/build/')
132 jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/provisioningclient/build/')
133 jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/simplebase/build/')
134 jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/simpleclient/build/')
135 jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/simpleserver/build/')
136 jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/simpleclientserver/build/')
137 jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/simpleserver/build/')
139 jdk_env.Clean(cmdBuildExamples, '#/java/iotivity-linux/build/')
140 jdk_env.Clean(cmdBuildExamples, '#/java/examples-java/build/')
141 jdk_env.Clean(cmdBuildExamples, '#/java/examples-java/simpleclient/build/')
142 jdk_env.Clean(cmdBuildExamples, '#/java/examples-java/simpleclientserver/build/')
143 jdk_env.Clean(cmdBuildExamples, '#/java/examples-java/simpleserver/build/')
145 env.AppendUnique(baseAAR = cmdBuildApi)