build: Reformat the service SConscripts 01/21001/9
authorMats Wichmann <mats@linux.com>
Sun, 4 Jun 2017 20:48:05 +0000 (14:48 -0600)
committerPhil Coval <philippe.coval@osg.samsung.com>
Wed, 28 Jun 2017 00:11:36 +0000 (00:11 +0000)
[Mats Wichmann]

These reformattings are not supposed to change any behavior,
but they are not all purely whitespace. For example, consecutive
lines of Append(LIBS=  or Append(CPPPATH= were collapsed into
one call with multiple entries in the list.

A few comments were beefed up, as were occasional informative messages.

Import of run_test moved to top (Python style), except the two scripts
where the unittest code is not isolated to a subdirectory - the import
has to be protected so it is only called for targets that support
the tests - the import fails on Tizen for some reasons.  Change this
when separate patches to isolate unit test building/running are merged.

[Philippe Coval]

Ported to 1.3-rel from master

Conflicts:
service/easy-setup/enrollee/unittests/SConscript
service/easy-setup/mediator/richsdk/unittests/SConscript
service/notification/cpp-wrapper/unittest/SConscript
service/notification/unittest/SConscript
service/resource-container/unittests/SConscript
service/resource-encapsulation/src/common/SConscript
service/resource-encapsulation/src/serverBuilder/SConscript
service/resource-encapsulation/unittests/SConscript

Change-Id: Ifaf3eb2d837e773a06e59b50132f0d3c8881fdd8
Signed-off-by: Mats Wichmann <mats@linux.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/20553
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: George Nash <george.nash@intel.com>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
Bug: https://jira.iotivity.org/browse/IOT-1745
Signed-off-by: Philippe Coval <philippe.coval@osg.samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/21001
Reviewed-by: Dan Mihai <Daniel.Mihai@microsoft.com>
58 files changed:
service/SConscript
service/coap-http-proxy/SConscript
service/coap-http-proxy/samples/SConscript
service/coap-http-proxy/unittests/SConscript
service/easy-setup/SConscript
service/easy-setup/enrollee/SConscript
service/easy-setup/enrollee/unittests/SConscript
service/easy-setup/mediator/SConscript
service/easy-setup/mediator/richsdk/SConscript
service/easy-setup/mediator/richsdk/android/SConscript
service/easy-setup/mediator/richsdk/unittests/SConscript
service/easy-setup/sampleapp/enrollee/arduino/SConscript
service/easy-setup/sampleapp/enrollee/linux/SConscript
service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/SConscript
service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/SConscript
service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/tizen/SConscript
service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/scons/SConscript
service/easy-setup/sampleapp/mediator/android/SConscript
service/easy-setup/sampleapp/mediator/linux/richsdk_sample/SConscript
service/notification/SConscript
service/notification/android/SConscript
service/notification/cpp-wrapper/SConscript
service/notification/cpp-wrapper/common/SConscript
service/notification/cpp-wrapper/consumer/SConscript
service/notification/cpp-wrapper/examples/linux/SConscript
service/notification/cpp-wrapper/provider/SConscript
service/notification/cpp-wrapper/unittest/SConscript
service/notification/examples/SConscript
service/notification/examples/android/NotiConsumerExample/SConscript
service/notification/examples/android/NotiProviderExample/SConscript
service/notification/examples/linux/SConscript
service/notification/unittest/SConscript
service/resource-container/SConscript
service/resource-container/android/SConscript
service/resource-container/examples/BMISensorBundle/src/inputSensors/HeightSensorApp/SConscript
service/resource-container/examples/BMISensorBundle/src/inputSensors/SConscript
service/resource-container/examples/BMISensorBundle/src/inputSensors/WeightSensorApp/SConscript
service/resource-container/examples/DiscomfortIndexSensorBundle/src/inputSensors/SConscript
service/resource-container/examples/DiscomfortIndexSensorBundle/src/inputSensors/THSensorApp/SConscript
service/resource-container/examples/DiscomfortIndexSensorBundle/src/inputSensors/THSensorApp1/SConscript
service/resource-container/unittests/SConscript
service/resource-encapsulation/SConscript
service/resource-encapsulation/android/SConscript
service/resource-encapsulation/examples/linux/SConscript
service/resource-encapsulation/src/common/SConscript
service/resource-encapsulation/src/resourceBroker/unittest/SConscript
service/resource-encapsulation/src/resourceCache/unittests/SConscript
service/resource-encapsulation/src/serverBuilder/SConscript
service/resource-encapsulation/unittests/SConscript
service/scene-manager/SConscript
service/scene-manager/sampleapp/SConscript
service/scene-manager/sampleapp/linux/SConscript
service/scene-manager/unittests/SConscript
service/simulator/SConscript
service/simulator/examples/client/SConscript
service/simulator/examples/server/SConscript
service/simulator/ramlparser/SConscript
service/third_party_libs.scons

index 3fd71f1..ddb3075 100755 (executable)
@@ -26,7 +26,7 @@ Import('env')
 
 target_os = env.get('TARGET_OS')
 
-if target_os not in ['arduino','darwin', 'windows']:
+if target_os not in ['arduino', 'darwin', 'windows']:
     # Build resource-encapsulation project
     SConscript('resource-encapsulation/SConscript')
 
@@ -38,7 +38,7 @@ if target_os not in ['arduino','darwin', 'windows']:
         SConscript('scene-manager/SConscript')
 
     # Build notification-service project
-    if target_os in ['linux','android','tizen','ios']:
+    if target_os in ['linux', 'android', 'tizen', 'ios']:
         SConscript('notification/SConscript')
 
     # Build simulator module
@@ -50,5 +50,5 @@ if target_os not in ['arduino','darwin', 'windows']:
         SConscript('coap-http-proxy/SConscript')
 
 # Build EasySetup module
-if target_os in ['arduino', 'android', 'ios', 'linux','tizen']:
+if target_os in ['arduino', 'android', 'ios', 'linux', 'tizen']:
     SConscript('easy-setup/SConscript')
index 49c1480..9339559 100644 (file)
@@ -26,13 +26,13 @@ import os
 local_env = env.Clone()
 
 if local_env.get('LOGGING'):
-    local_env.AppendUnique(CPPDEFINES = ['-DTB_LOG'])
+    local_env.AppendUnique(CPPDEFINES=['-DTB_LOG'])
 
 if env.get('RELEASE'):
-    local_env.AppendUnique(CCFLAGS = ['-Os'])
-    local_env.AppendUnique(CPPDEFINES = ['NDEBUG'])
+    local_env.AppendUnique(CCFLAGS=['-Os'])
+    local_env.AppendUnique(CPPDEFINES=['NDEBUG'])
 else:
-    local_env.AppendUnique(CCFLAGS = ['-g'])
+    local_env.AppendUnique(CCFLAGS=['-g'])
 
 target_os = env.get('TARGET_OS')
 src_dir = env.get('SRC_DIR')
@@ -40,33 +40,42 @@ src_dir = env.get('SRC_DIR')
 ######################################################################
 # Build flags
 ######################################################################
-local_env.AppendUnique(CPPPATH = ['include',
-                        os.path.join(src_dir, 'resource/csdk/include'),
-                        os.path.join(src_dir, 'resource/csdk/stack/include'),
-                        os.path.join(src_dir, 'resource/csdk/connectivity/common/inc/'),
-                        os.path.join(src_dir, 'resource/csdk/security/include'),
-                        os.path.join(src_dir, 'extlibs/cjson'),
-               ])
+local_env.AppendUnique(CPPPATH=[
+    'include',
+    os.path.join(src_dir, 'resource/csdk/include'),
+    os.path.join(src_dir, 'resource/csdk/stack/include'),
+    os.path.join(src_dir, 'resource/csdk/connectivity/common/inc/'),
+    os.path.join(src_dir, 'resource/csdk/security/include'),
+    os.path.join(src_dir, 'extlibs/cjson'),
+])
 
 with_upstream_libcoap = local_env.get('WITH_UPSTREAM_LIBCOAP')
 if with_upstream_libcoap == '1':
-    local_env.AppendUnique(CPPPATH = ['#extlibs/libcoap/libcoap/include'])
+    local_env.AppendUnique(CPPPATH=['#/extlibs/libcoap/libcoap/include'])
 else:
-    local_env.AppendUnique(CPPPATH = ['#resource/csdk/connectivity/lib/libcoap-4.1.1/include'])
-
-local_env.PrependUnique(LIBS = ['cjson', 'oc', 'octbstack', 'oc_logger', 'connectivity_abstraction', 'coap'])
+    local_env.AppendUnique(
+        CPPPATH=['#/resource/csdk/connectivity/lib/libcoap-4.1.1/include'])
+
+local_env.PrependUnique(LIBS=[
+    'cjson',
+    'oc',
+    'octbstack',
+    'oc_logger',
+    'connectivity_abstraction',
+    'coap',
+])
 if target_os not in ['windows']:
-    local_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-Wextra'])
+    local_env.AppendUnique(CXXFLAGS=['-O2', '-g', '-Wall', '-Wextra'])
 
 if target_os in ['linux', 'tizen']:
-    local_env.AppendUnique(LIBS = ['pthread', 'curl', 'm'])
+    local_env.AppendUnique(LIBS=['pthread', 'curl', 'm'])
 
 if target_os == 'android':
-    local_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
-    local_env.AppendUnique(LIBS = ['gnustl_static'])
+    local_env.AppendUnique(CXXFLAGS=['-frtti', '-fexceptions'])
+    local_env.AppendUnique(LIBS=['gnustl_static'])
 
     if not env.get('RELEASE'):
-        local_env.AppendUnique(LIBS = ['log'])
+        local_env.AppendUnique(LIBS=['log'])
 ######################################################################
 # Source files and Targets
 ######################################################################
@@ -74,25 +83,25 @@ if target_os == 'android':
 # Link with gcov if building in debug mode
 if target_os in ['linux']:
     if not env.get('RELEASE'):
-        local_env.PrependUnique(LIBS = ['gcov'])
-        local_env.AppendUnique(CXXFLAGS = ['--coverage'])
-        local_env.AppendUnique(CFLAGS = ['--coverage'])
+        local_env.PrependUnique(LIBS=['gcov'])
+        local_env.AppendUnique(CXXFLAGS=['--coverage'])
+        local_env.AppendUnique(CFLAGS=['--coverage'])
 
 proxy_src = [
-       './src/CoapHttpHandler.c',
-       './src/CoapHttpMap.c',
-       './src/CoapHttpParser.c',
+    './src/CoapHttpHandler.c',
+    './src/CoapHttpMap.c',
+    './src/CoapHttpParser.c',
 ]
 
-if target_os in ['tizen'] :
+if target_os in ['tizen']:
     proxysdk = local_env.SharedLibrary('coap_http_proxy', proxy_src)
-else :
+else:
     proxysdk = local_env.StaticLibrary('coap_http_proxy', proxy_src)
 
 local_env.InstallTarget(proxysdk, 'coap_http_proxy')
 local_env.UserInstallTargetLib(proxysdk, 'coap_http_proxy')
-local_env.UserInstallTargetHeader('include/CoapHttpHandler.h', 'service/coap-http-proxy', 'CoapHttpHandler.h')
-
+local_env.UserInstallTargetHeader(
+    'include/CoapHttpHandler.h', 'service/coap-http-proxy', 'CoapHttpHandler.h')
 
 ######################################################################
 # Samples for the proxy
index c93f5ce..34641ee 100644 (file)
@@ -33,24 +33,34 @@ target_os = env.get('TARGET_OS')
 ######################################################################
 # Build flags
 ######################################################################
-proxy_sample_app_env.AppendUnique(CPPPATH = ['../include'])
+proxy_sample_app_env.AppendUnique(CPPPATH=['../include'])
 
 if target_os not in ['windows']:
-    proxy_sample_app_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-Wextra', '-std=c++0x'])
+    proxy_sample_app_env.AppendUnique(
+        CXXFLAGS=['-O2', '-g', '-Wall', '-Wextra', '-std=c++0x'])
 else:
-    proxy_sample_app_env.PrependUnique(LIBS = ['m'])
+    proxy_sample_app_env.PrependUnique(LIBS=['m'])
 
 if target_os in ['linux']:
     if not env.get('RELEASE'):
-        proxy_sample_app_env.PrependUnique(LIBS = ['gcov'])
+        proxy_sample_app_env.PrependUnique(LIBS=['gcov'])
 
-proxy_sample_app_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
-proxy_sample_app_env.AppendUnique(RPATH = [env.get('BUILD_DIR')])
-proxy_sample_app_env.PrependUnique(LIBS = ['coap_http_proxy', 'oc', 'octbstack', 'curl', 'connectivity_abstraction', 'cjson', 'm'])
-proxy_sample_app_env.AppendUnique(CPPPATH = ['#resource/csdk/security/include'])
+proxy_sample_app_env.AppendUnique(LIBPATH=[env.get('BUILD_DIR')])
+proxy_sample_app_env.AppendUnique(RPATH=[env.get('BUILD_DIR')])
+proxy_sample_app_env.PrependUnique(LIBS=[
+    'coap_http_proxy',
+    'oc',
+    'octbstack',
+    'curl',
+    'connectivity_abstraction',
+    'cjson',
+    'm'
+])
+proxy_sample_app_env.AppendUnique(CPPPATH=['#/resource/csdk/security/include'])
 
 if env.get('SECURED') == '1':
-    proxy_sample_app_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509', 'mbedcrypto'])
+    proxy_sample_app_env.AppendUnique(
+        LIBS=['mbedtls', 'mbedx509', 'mbedcrypto'])
 
 ####################################################################
 # Source files and Targets
@@ -62,9 +72,17 @@ Alias("coap_http_proxy", [proxy_server])
 env.AppendTarget('coap_http_proxy')
 
 if env.get('SECURED') == '1':
-    proxy_sample_src_dir = proxy_sample_app_env.get('SRC_DIR') + '/service/coap-http-proxy/samples/'
-    proxy_sample_build_dir = proxy_sample_app_env.get('BUILD_DIR') +'/service/coap-http-proxy/samples'
-    proxy_sample_app_env.Alias("install", proxy_sample_app_env.Install( proxy_sample_build_dir,
-        proxy_sample_src_dir + 'oic_svr_db_server.dat'))
-    proxy_sample_app_env.Alias("install", proxy_sample_app_env.Install( proxy_sample_build_dir,
-        proxy_sample_src_dir + 'oic_svr_db_client_devowner.dat'))
\ No newline at end of file
+    proxy_sample_src_dir = proxy_sample_app_env.get(
+        'SRC_DIR') + '/service/coap-http-proxy/samples/'
+    proxy_sample_build_dir = proxy_sample_app_env.get(
+        'BUILD_DIR') + '/service/coap-http-proxy/samples'
+    proxy_sample_app_env.Alias(
+        "install",
+        proxy_sample_app_env.Install(
+            proxy_sample_build_dir,
+            proxy_sample_src_dir + 'oic_svr_db_server.dat'))
+    proxy_sample_app_env.Alias(
+        "install",
+        proxy_sample_app_env.Install(
+            proxy_sample_build_dir,
+            proxy_sample_src_dir + 'oic_svr_db_client_devowner.dat'))
index a2c00d7..6d73c86 100644 (file)
@@ -20,6 +20,7 @@
 
 import os
 import os.path
+from tools.scons.RunTest import run_test
 
 ##
 # CoAP-HTTP Proxy Unit Test build script
@@ -29,13 +30,13 @@ gtest_env = SConscript('#extlibs/gtest/SConscript')
 CoAP_test_env = gtest_env.Clone()
 
 if CoAP_test_env.get('RELEASE'):
-    CoAP_test_env.AppendUnique(CCFLAGS = ['-Os'])
-    CoAP_test_env.AppendUnique(CPPDEFINES = ['NDEBUG'])
+    CoAP_test_env.AppendUnique(CCFLAGS=['-Os'])
+    CoAP_test_env.AppendUnique(CPPDEFINES=['NDEBUG'])
 else:
-    CoAP_test_env.AppendUnique(CCFLAGS = ['-g'])
+    CoAP_test_env.AppendUnique(CCFLAGS=['-g'])
 
 if CoAP_test_env.get('LOGGING'):
-    CoAP_test_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
+    CoAP_test_env.AppendUnique(CPPDEFINES=['TB_LOG'])
 
 #SConscript('#service/third_party_libs.scons', 'lib_env')
 
@@ -49,43 +50,57 @@ target_os = CoAP_test_env.get('TARGET_OS')
 # Build flags 'coap_http_proxy','oc', 'octbstack', 'oc_logger', 'connectivity_abstraction', 'coap', 'cjson'])
 ######################################################################
 
-CoAP_test_env.AppendUnique(LIBPATH = [CoAP_test_env.get('BUILD_DIR')])
-CoAP_test_env.AppendUnique(LIBS = ['coap_http_proxy', 'octbstack', 'connectivity_abstraction', 'coap', 'cjson'])
+CoAP_test_env.AppendUnique(LIBPATH=[CoAP_test_env.get('BUILD_DIR')])
+CoAP_test_env.AppendUnique(LIBS=[
+    'coap_http_proxy',
+    'octbstack',
+    'connectivity_abstraction',
+    'coap',
+    'cjson',
+])
 
 if target_os not in ['windows']:
-    CoAP_test_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0'])
+    CoAP_test_env.AppendUnique(
+        CXXFLAGS=['-O2', '-g', '-Wall', '-fmessage-length=0'])
 
 if not CoAP_test_env.get('RELEASE'):
-    CoAP_test_env.PrependUnique(LIBS = ['gcov'])
-    CoAP_test_env.AppendUnique(CXXFLAGS = ['--coverage'])
-
-CoAP_test_env.AppendUnique(CPPPATH = ['#/extlibs/hippomocks/hippomocks',
-                        '../include',
-                        '#/resource/csdk/include',
-                        '#/resource/csdk/stack/include',
-                        '#/resource/csdk/connectivity/common/inc/',
-                        '#/resource/csdk/connectivity/lib/libcoap-4.1.1',
-                        '#/extlibs/cjson',
-                ])
+    CoAP_test_env.PrependUnique(LIBS=['gcov'])
+    CoAP_test_env.AppendUnique(CXXFLAGS=['--coverage'])
+
+CoAP_test_env.AppendUnique(CPPPATH=[
+    '#/extlibs/hippomocks/hippomocks',
+    '../include',
+    '#/resource/csdk/include',
+    '#/resource/csdk/stack/include',
+    '#/resource/csdk/connectivity/common/inc/',
+    '#/resource/csdk/connectivity/lib/libcoap-4.1.1',
+    '#/extlibs/cjson',
+])
 
 if CoAP_test_env.get('SECURED') == '1':
-    CoAP_test_env.AppendUnique(CPPPATH = ['#/resource/csdk/security/include/'])
+    CoAP_test_env.AppendUnique(CPPPATH=['#/resource/csdk/security/include/'])
 
 with_upstream_libcoap = CoAP_test_env.get('WITH_UPSTREAM_LIBCOAP')
 if with_upstream_libcoap == '1':
-    CoAP_test_env.AppendUnique(CPPPATH = ['#/extlibs/libcoap/libcoap/include'])
+    CoAP_test_env.AppendUnique(CPPPATH=['#/extlibs/libcoap/libcoap/include'])
 else:
-    CoAP_test_env.AppendUnique(CPPPATH = ['#/resource/csdk/connectivity/lib/libcoap-4.1.1/include'])
+    CoAP_test_env.AppendUnique(
+        CPPPATH=['#/resource/csdk/connectivity/lib/libcoap-4.1.1/include'])
 
 #CoAP_test_env.AppendUnique(CPPPATH = ['#/service/resource-encapsulation/include'])
 #CoAP_test_env.AppendUnique(CPPPATH = ['../../resource-encapsulation/src/common/primitiveResource/include'])
-CoAP_test_env.AppendUnique(CPPPATH = ['#/service/resource-encapsulation/src/common/utils/include'])
+CoAP_test_env.AppendUnique(
+    CPPPATH=['#/service/resource-encapsulation/src/common/utils/include'])
 
 if target_os in ['linux']:
-    CoAP_test_env.AppendUnique(LIBS = ['pthread', 'curl'])
+    CoAP_test_env.AppendUnique(LIBS=['pthread', 'curl'])
 
 if CoAP_test_env.get('SECURED') == '1':
-    CoAP_test_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509', 'mbedcrypto',])
+    CoAP_test_env.AppendUnique(LIBS=[
+        'mbedtls',
+        'mbedx509',
+        'mbedcrypto',
+    ])
 ######################################################################
 # Build Test
 ######################################################################
@@ -98,8 +113,6 @@ CoAP_test_env.InstallTarget(CoAP_unit_test, 'CoAP_unit_test')
 
 if CoAP_test_env.get('TEST') == '1':
     if target_os in ['linux']:
-        from tools.scons.RunTest import run_test
-        run_test(CoAP_test_env,
-                 '',
+        run_test(CoAP_test_env, '',
                  'service/coap-http-proxy/unittests/CoAP_unit_test',
                  CoAP_unit_test)
index af7a6eb..6e9b1dd 100644 (file)
@@ -23,7 +23,7 @@
 ######################################################################
 Import('env')
 
-es_target = env.get ('TARGET_OS')
+es_target = env.get('TARGET_OS')
 service_easy_setup_env = env.Clone()
 
 if es_target in ['android', 'ios', 'linux', 'tizen']:
@@ -33,4 +33,5 @@ if es_target in ['linux', 'tizen']:
     SConscript('enrollee/SConscript')
 
 if es_target in ['android', 'linux', 'tizen']:
-    service_easy_setup_env.UserInstallTargetHeader('inc/escommon.h', 'service/easy-setup', 'escommon.h')
+    service_easy_setup_env.UserInstallTargetHeader(
+        'inc/escommon.h', 'service/easy-setup', 'escommon.h')
index 083d5de..ef24090 100644 (file)
@@ -27,78 +27,97 @@ enrollee_env = env.Clone()
 target_os = enrollee_env.get('TARGET_OS')
 
 if enrollee_env.get('RELEASE'):
-    enrollee_env.AppendUnique(CCFLAGS = ['-Os'])
-    enrollee_env.AppendUnique(CPPDEFINES = ['NDEBUG'])
+    enrollee_env.AppendUnique(CCFLAGS=['-Os'])
+    enrollee_env.AppendUnique(CPPDEFINES=['NDEBUG'])
 else:
-    enrollee_env.AppendUnique(CCFLAGS = ['-g'])
+    enrollee_env.AppendUnique(CCFLAGS=['-g'])
 
 if enrollee_env.get('LOGGING'):
-    enrollee_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
+    enrollee_env.AppendUnique(CPPDEFINES=['TB_LOG'])
 
 ######################################################################
 # Build flags
 ######################################################################
-enrollee_env.PrependUnique(CPPPATH = [
-        '#/resource/c_common/oic_malloc/include',
-        '#/resource/include',
-        '#/resource/csdk/logger/include',
-        '#/resource/oc_logger/include',
-        '#/resource/csdk/include',
-        '#/resource/csdk/stack/include',
-        '#/resource/csdk/logger/include',
-        '#/resource/csdk/security/include',
-        '#/resource/csdk/connectivity/api',
-        '#/extlibs/cjson',
-        '#/service/easy-setup/inc',
-        '#/service/easy-setup/enrollee/inc',
-        '#/service/easy-setup/enrollee/src'])
+enrollee_env.PrependUnique(CPPPATH=[
+    '#/resource/c_common/oic_malloc/include',
+    '#/resource/include',
+    '#/resource/csdk/logger/include',
+    '#/resource/oc_logger/include',
+    '#/resource/csdk/include',
+    '#/resource/csdk/stack/include',
+    '#/resource/csdk/logger/include',
+    '#/resource/csdk/security/include',
+    '#/resource/csdk/connectivity/api',
+    '#/extlibs/cjson',
+    '#/service/easy-setup/inc',
+    '#/service/easy-setup/enrollee/inc',
+    '#/service/easy-setup/enrollee/src'
+])
 
 if target_os not in ['linux', 'tizen']:
-    enrollee_env.PrependUnique(CPPPATH = [
-        '#extlibs/sqlite3'])
+    enrollee_env.PrependUnique(CPPPATH=['#extlibs/sqlite3'])
 
 if enrollee_env.get('SECURED') == '1':
-    enrollee_env.AppendUnique(CPPPATH = [
+    enrollee_env.AppendUnique(CPPPATH=[
         '#/resource/csdk/security/provisioning/include',
         '#/resource/csdk/security/provisioning/include/internal',
-        '#/resource/csdk/security/provisioning/include/oxm'])
-    enrollee_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509', 'mbedcrypto'])
+        '#/resource/csdk/security/provisioning/include/oxm'
+    ])
+    enrollee_env.AppendUnique(LIBS=['mbedtls', 'mbedx509', 'mbedcrypto'])
 
 if target_os not in ['windows']:
-    enrollee_env.AppendUnique(CXXFLAGS = ['-Wall', '-std=c++0x'])
+    enrollee_env.AppendUnique(CXXFLAGS=['-Wall', '-std=c++0x'])
 
 if not env.get('RELEASE'):
-    enrollee_env.PrependUnique(LIBS = ['gcov'])
-    enrollee_env.AppendUnique(CCFLAGS = ['--coverage'])
+    enrollee_env.PrependUnique(LIBS=['gcov'])
+    enrollee_env.AppendUnique(CCFLAGS=['--coverage'])
 
 ######################################################################
 # Linux Enrollee
 ######################################################################
 if target_os in ['linux']:
-    enrollee_env.AppendUnique(LIBS = ['pthread', 'dl'])
-    enrollee_env.AppendUnique(LIBPATH = [enrollee_env.get('BUILD_DIR')])
-    enrollee_env.AppendUnique(RPATH = [enrollee_env.get('BUILD_DIR')])
-    enrollee_env.AppendUnique(CXXFLAGS = ['-pthread'])
-    enrollee_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'pthread', 'connectivity_abstraction'])
+    enrollee_env.AppendUnique(LIBS=['pthread', 'dl'])
+    enrollee_env.AppendUnique(LIBPATH=[enrollee_env.get('BUILD_DIR')])
+    enrollee_env.AppendUnique(RPATH=[enrollee_env.get('BUILD_DIR')])
+    enrollee_env.AppendUnique(CXXFLAGS=['-pthread'])
+    enrollee_env.PrependUnique(LIBS=[
+        'oc',
+        'octbstack',
+        'oc_logger',
+        'pthread',
+        'connectivity_abstraction',
+    ])
     if enrollee_env.get('SECURED') == '1':
-        enrollee_env.PrependUnique(LIBS = ['ocprovision', 'ocpmapi'])
+        enrollee_env.PrependUnique(LIBS=['ocprovision', 'ocpmapi'])
 
 ######################################################################
 # Tizen Enrollee
 ######################################################################
 if target_os == 'tizen':
-   enrollee_env.AppendUnique(LIBPATH = [enrollee_env.get('BUILD_DIR')])
-   enrollee_env.AppendUnique(RPATH = [enrollee_env.get('BUILD_DIR')])
-   enrollee_env.AppendUnique(CXXFLAGS = ['-pthread'])
-   enrollee_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'pthread', 'connectivity_abstraction'])
+    enrollee_env.AppendUnique(LIBPATH=[enrollee_env.get('BUILD_DIR')])
+    enrollee_env.AppendUnique(RPATH=[enrollee_env.get('BUILD_DIR')])
+    enrollee_env.AppendUnique(CXXFLAGS=['-pthread'])
+    enrollee_env.PrependUnique(LIBS=[
+        'oc',
+        'octbstack',
+        'oc_logger',
+        'pthread',
+        'connectivity_abstraction',
+    ])
 
 ######################################################################
 # Arduino Enrollee
 ######################################################################
 if target_os == 'arduino':
-    enrollee_env.AppendUnique(LIBPATH = [enrollee_env.get('BUILD_DIR')])
-    enrollee_env.AppendUnique(RPATH = [enrollee_env.get('BUILD_DIR')])
-    enrollee_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'pthread', 'connectivity_abstraction'])
+    enrollee_env.AppendUnique(LIBPATH=[enrollee_env.get('BUILD_DIR')])
+    enrollee_env.AppendUnique(RPATH=[enrollee_env.get('BUILD_DIR')])
+    enrollee_env.PrependUnique(LIBS=[
+        'oc',
+        'octbstack',
+        'oc_logger',
+        'pthread',
+        'connectivity_abstraction',
+    ])
 
 ######################################################################
 # Source files and Targets
@@ -106,17 +125,24 @@ if target_os == 'arduino':
 es_enrollee_src = None
 
 if target_os in ['linux', 'tizen']:
-    es_enrollee_common_src = ['./src/easysetup.c','./src/resourcehandler.c']
-    enrollee_sdk_shared = enrollee_env.SharedLibrary('ESEnrolleeSDK', es_enrollee_common_src)
-    enrollee_sdk_static = enrollee_env.StaticLibrary('ESEnrolleeSDK', es_enrollee_common_src)
-    enrollee_env.InstallTarget([enrollee_sdk_shared, enrollee_sdk_static], 'libESEnrollee')
-    enrollee_env.UserInstallTargetLib([enrollee_sdk_shared, enrollee_sdk_static], 'libESEnrollee')
-    enrollee_env.UserInstallTargetHeader('inc/ESEnrolleeCommon.h', 'service/easy-setup', 'ESEnrolleeCommon.h')
-    enrollee_env.UserInstallTargetHeader('inc/easysetup.h', 'service/easy-setup', 'easysetup.h')
+    es_enrollee_common_src = ['./src/easysetup.c', './src/resourcehandler.c']
+    enrollee_sdk_shared = enrollee_env.SharedLibrary('ESEnrolleeSDK',
+                                                     es_enrollee_common_src)
+    enrollee_sdk_static = enrollee_env.StaticLibrary('ESEnrolleeSDK',
+                                                     es_enrollee_common_src)
+    enrollee_env.InstallTarget([enrollee_sdk_shared, enrollee_sdk_static],
+                               'libESEnrollee')
+    enrollee_env.UserInstallTargetLib(
+        [enrollee_sdk_shared, enrollee_sdk_static], 'libESEnrollee')
+    enrollee_env.UserInstallTargetHeader(
+        'inc/ESEnrolleeCommon.h', 'service/easy-setup', 'ESEnrolleeCommon.h')
+    enrollee_env.UserInstallTargetHeader('inc/easysetup.h',
+                                         'service/easy-setup', 'easysetup.h')
 
 if target_os == 'arduino':
-    es_enrollee_common_src = ['./src/easysetup.c','./src/resourcehandler.c']
-    enrollee_sdk_static = enrollee_env.StaticLibrary('ESEnrolleeSDK', es_enrollee_common_src)
+    es_enrollee_common_src = ['./src/easysetup.c', './src/resourcehandler.c']
+    enrollee_sdk_static = enrollee_env.StaticLibrary('ESEnrolleeSDK',
+                                                     es_enrollee_common_src)
     enrollee_env.InstallTarget(enrollee_sdk_static, 'libESEnrolleeSDK')
     enrollee_env.UserInstallTargetLib(enrollee_sdk_static, 'libESEnrollee')
 
@@ -129,4 +155,3 @@ if target_os in ['linux']:
     #Build UnitTestcases for Enrollee
     if enrollee_env.get('SECURED') == '0':
         SConscript('../enrollee/unittests/SConscript')
-
index 6bf777d..f1a8b60 100644 (file)
 # Notification Unit Test build script
 ##
 
-from tools.scons.RunTest import run_test;
+from tools.scons.RunTest import run_test
+
 Import('env')
 
 if env.get('RELEASE'):
-       env.AppendUnique(CCFLAGS = ['-Os'])
-       env.AppendUnique(CPPDEFINES = ['NDEBUG'])
+    env.AppendUnique(CCFLAGS=['-Os'])
+    env.AppendUnique(CPPDEFINES=['NDEBUG'])
 else:
-       env.AppendUnique(CCFLAGS = ['-g'])
+    env.AppendUnique(CCFLAGS=['-g'])
 
 if env.get('LOGGING'):
-       env.AppendUnique(CPPDEFINES = ['TB_LOG'])
+    env.AppendUnique(CPPDEFINES=['TB_LOG'])
 
 lib_env = SConscript('#extlibs/gtest/SConscript')
 rd_mode = env.get('RD_MODE')
@@ -50,18 +51,23 @@ target_os = env.get('TARGET_OS')
 ######################################################################
 # Build flags
 ######################################################################
-easysetup_test_env.AppendUnique(LIBPATH = [lib_env.get('BUILD_DIR')])
-easysetup_test_env.PrependUnique(LIBS = [
-    'connectivity_abstraction', 'oc', 'octbstack', 'oc_logger', 'coap',
+easysetup_test_env.AppendUnique(LIBPATH=[lib_env.get('BUILD_DIR')])
+easysetup_test_env.PrependUnique(LIBS=[
+    'connectivity_abstraction',
+    'oc',
+    'octbstack',
+    'oc_logger',
+    'coap',
 ])
 
 if target_os not in ['windows', 'winrt']:
-    easysetup_test_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x'])
+    easysetup_test_env.AppendUnique(
+        CXXFLAGS=['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x'])
 
-easysetup_test_env.AppendUnique(CXXFLAGS = ['-pthread'])
-easysetup_test_env.AppendUnique(LIBS = ['pthread'])
+easysetup_test_env.AppendUnique(CXXFLAGS=['-pthread'])
+easysetup_test_env.AppendUnique(LIBS=['pthread'])
 
-easysetup_test_env.PrependUnique(CPPPATH = [
+easysetup_test_env.PrependUnique(CPPPATH=[
     '#/extlibs/hippomocks/hippomocks',
     '#/resource/include',
     '#/resource/csdk/connectivity/api',
@@ -74,26 +80,27 @@ easysetup_test_env.PrependUnique(CPPPATH = [
 ])
 
 if easysetup_test_env.get('SECURED') == '1':
-    easysetup_test_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509', 'mbedcrypto'])
+    easysetup_test_env.AppendUnique(LIBS=['mbedtls', 'mbedx509', 'mbedcrypto'])
 
 ######################################################################
 # Build Test
 ######################################################################
 
 easysetup_enrollee_test_env = easysetup_test_env.Clone()
-easysetup_enrollee_test_env.AppendUnique(LIBS = ['ESEnrolleeSDK', 'ESMediatorRich'])
+easysetup_enrollee_test_env.AppendUnique(
+    LIBS=['ESEnrolleeSDK', 'ESMediatorRich'])
 
 easysetup_enrollee_test_src = env.Glob('./ESEnrolleeTest.cpp')
-easysetup_enrollee_test = easysetup_enrollee_test_env.Program('easysetup_enrollee_test', easysetup_enrollee_test_src)
+easysetup_enrollee_test = easysetup_enrollee_test_env.Program(
+    'easysetup_enrollee_test', easysetup_enrollee_test_src)
 Alias("easysetup_enrollee_test", easysetup_enrollee_test)
 env.AppendTarget('easysetup_enrollee_test')
 
 if env.get('TEST') == '1':
     if target_os in ['linux'] and env.get('SECURED') != '1':
-        from tools.scons.RunTest import run_test
-        run_test(easysetup_enrollee_test_env,
-#      temporary blocking until valigrind error resolved in /resource layer
-#                'service_easy-setup_enrollee_unittests_easysetup_enrollee_test.memcheck',
-                 '',
-                 'service/easy-setup/enrollee/unittests/easysetup_enrollee_test',
-                 easysetup_enrollee_test)
+        run_test(
+            easysetup_enrollee_test_env,
+            # 'service_easy-setup_enrollee_unittests_easysetup_enrollee_test.memcheck',
+            '',  # TODO enable previous line when valigrind error resolved in resource layer
+            'service/easy-setup/enrollee/unittests/easysetup_enrollee_test',
+            easysetup_enrollee_test)
index 060afac..16478b8 100644 (file)
@@ -27,5 +27,3 @@ target_os = env.get('TARGET_OS')
 
 # Build easy-setup Mediator Rich [C++] SDK
 SConscript('richsdk/SConscript')
-
-
index 5f66bf3..6829e9e 100644 (file)
@@ -27,13 +27,13 @@ Import('env')
 easysetup_path = os.curdir
 
 if env.get('RELEASE'):
-    env.AppendUnique(CCFLAGS = ['-Os'])
-    env.AppendUnique(CPPDEFINES = ['NDEBUG'])
+    env.AppendUnique(CCFLAGS=['-Os'])
+    env.AppendUnique(CPPDEFINES=['NDEBUG'])
 else:
-    env.AppendUnique(CCFLAGS = ['-g'])
+    env.AppendUnique(CCFLAGS=['-g'])
 
 if env.get('LOGGING'):
-    env.AppendUnique(CPPDEFINES = ['TB_LOG'])
+    env.AppendUnique(CPPDEFINES=['TB_LOG'])
 
 # Easysetup provides reference implemenation of Arduino Enrollee.
 # Mediator applications developed on different platforms will be default defining the
@@ -43,9 +43,9 @@ if env.get('LOGGING'):
 ##### The following lines must be uncommented, if target Enrollee is not Arduino
 target_enrollee = env.get('ES_TARGET_ENROLLEE')
 if target_enrollee == 'arduino':
-       print "REMOTE_ARDUINO_ENROLEE flag is defined."
-       print "The Mediator application will be working only with Arduino Enrollee."
-       env.AppendUnique(CPPDEFINES = ['REMOTE_ARDUINO_ENROLEE'])
+    print "REMOTE_ARDUINO_ENROLEE flag is defined."
+    print "The Mediator application will be working only with Arduino Enrollee."
+    env.AppendUnique(CPPDEFINES=['REMOTE_ARDUINO_ENROLEE'])
 
 # Add third party libraries
 lib_env = env.Clone()
@@ -57,7 +57,7 @@ target_os = env.get('TARGET_OS')
 ######################################################################
 # Build flags
 ######################################################################
-easy_setup_env.AppendUnique(CPPPATH = [
+easy_setup_env.AppendUnique(CPPPATH=[
     'inc',
     'src',
     '../../inc',
@@ -65,96 +65,128 @@ easy_setup_env.AppendUnique(CPPPATH = [
     '#/resource/csdk/include',
     '#/resource/csdk/stack/include',
     '#/resource/oc_logger/include'
-    ])
+])
 
 if target_os not in ['windows']:
-    easy_setup_env.AppendUnique(CXXFLAGS = ['-Wall', '-std=c++0x'])
+    easy_setup_env.AppendUnique(CXXFLAGS=['-Wall', '-std=c++0x'])
 
-if target_os in ['linux','tizen']:
-   easy_setup_env.AppendUnique(LIBS = ['pthread', 'dl', 'coap'])
+if target_os in ['linux', 'tizen']:
+    easy_setup_env.AppendUnique(LIBS=['pthread', 'dl', 'coap'])
 
 if target_os in ['android']:
-       easy_setup_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
-       if env.get('SECURED') == '1':
-               easy_setup_env.AppendUnique(LIBPATH = [env.get('SRC_DIR')+'/java/iotivity-android/build/native-libs/armeabi'])
-       easy_setup_env.AppendUnique(RPATH = [env.get('BUILD_DIR')])
-       easy_setup_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
-       easy_setup_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'connectivity_abstraction', 'gnustl_shared'])
-       if env.get('SECURED') == '1':
-               easy_setup_env.AppendUnique(LIBS = ['ocpmapi','ocprovision'])
-       if not env.get('RELEASE'):
-               easy_setup_env.AppendUnique(LIBS = ['log'])
-
-if target_os in ['linux','tizen']:
-       easy_setup_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
-       easy_setup_env.AppendUnique(RPATH = [env.get('BUILD_DIR')])
-       easy_setup_env.AppendUnique(CXXFLAGS = ['-pthread'])
-       easy_setup_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger'])
-       if env.get('SECURED') == '1':
-               easy_setup_env.AppendUnique(LIBS = ['ocpmapi', 'ocprovision'])
-
-if target_os in ['android','ios','linux','tizen']:
-       easy_setup_env.PrependUnique(CPPPATH = [
-               env.get('SRC_DIR') + '/resource/c_common/oic_malloc/include',
-               env.get('SRC_DIR') + '/resource/include',
-               env.get('SRC_DIR') + '/resource/csdk/logger/include',
-               env.get('SRC_DIR') + '/resource/csdk/include',
-               env.get('SRC_DIR') + '/resource/csdk/stack/include',
-               env.get('SRC_DIR') + '/resource/csdk/logger/include',
-               env.get('SRC_DIR') + '/resource/csdk/security/include',
-               env.get('SRC_DIR') + '/extlibs/cjson',
-               env.get('SRC_DIR') + '/service/easy-setup/inc'])
-       if target_os not in ['linux', 'tizen']:
-               easy_setup_env.PrependUnique(CPPPATH = [env.get('SRC_DIR') + '/extlibs/sqlite3'])
-       if env.get('SECURED') == '1':
-               with_upstream_libcoap = easy_setup_env.get('WITH_UPSTREAM_LIBCOAP')
-               if with_upstream_libcoap == '1':
-                       easy_setup_env.AppendUnique(CPPPATH = ['#extlibs/libcoap/libcoap/include'])
-               else:
-                       easy_setup_env.AppendUnique(CPPPATH = [env.get('SRC_DIR') + '/resource/csdk/connectivity/lib/libcoap-4.1.1/include'])
-               easy_setup_env.AppendUnique(CPPPATH = [
-                       env.get('SRC_DIR') + '/resource/csdk/security/provisioning/include',
-                       env.get('SRC_DIR') + '/resource/csdk/security/include/internal',
-                       env.get('SRC_DIR') + '/resource/csdk/connectivity/api/',
-                       env.get('SRC_DIR') + '/resource/csdk/security/provisioning/include/internal',
-                       env.get('SRC_DIR') + '/resource/csdk/security/provisioning/include/cloud',
-                       env.get('SRC_DIR') + '/resource/csdk/security/provisioning/include/oxm'])
-               easy_setup_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509', 'mbedcrypto'])
+    easy_setup_env.AppendUnique(LIBPATH=[env.get('BUILD_DIR')])
+    if env.get('SECURED') == '1':
+        easy_setup_env.AppendUnique(LIBPATH=[
+            env.get('SRC_DIR') +
+            '/java/iotivity-android/build/native-libs/armeabi'
+        ])
+    easy_setup_env.AppendUnique(RPATH=[env.get('BUILD_DIR')])
+    easy_setup_env.AppendUnique(CXXFLAGS=['-frtti', '-fexceptions'])
+    easy_setup_env.PrependUnique(LIBS=[
+        'oc',
+        'octbstack',
+        'oc_logger',
+        'connectivity_abstraction',
+        'gnustl_shared'
+    ])
+    if env.get('SECURED') == '1':
+        easy_setup_env.AppendUnique(LIBS=['ocpmapi', 'ocprovision'])
+    if not env.get('RELEASE'):
+        easy_setup_env.AppendUnique(LIBS=['log'])
+
+if target_os in ['linux', 'tizen']:
+    easy_setup_env.AppendUnique(LIBPATH=[env.get('BUILD_DIR')])
+    easy_setup_env.AppendUnique(RPATH=[env.get('BUILD_DIR')])
+    easy_setup_env.AppendUnique(CXXFLAGS=['-pthread'])
+    easy_setup_env.PrependUnique(LIBS=[
+        'oc',
+        'octbstack',
+        'oc_logger',
+    ])
+    if env.get('SECURED') == '1':
+        easy_setup_env.AppendUnique(LIBS=['ocpmapi', 'ocprovision'])
+
+if target_os in ['android', 'ios', 'linux', 'tizen']:
+    easy_setup_env.PrependUnique(CPPPATH=[
+        env.get('SRC_DIR') + '/resource/c_common/oic_malloc/include',
+        env.get('SRC_DIR') + '/resource/include',
+        env.get('SRC_DIR') + '/resource/csdk/logger/include',
+        env.get('SRC_DIR') + '/resource/csdk/include',
+        env.get('SRC_DIR') + '/resource/csdk/stack/include',
+        env.get('SRC_DIR') + '/resource/csdk/logger/include',
+        env.get('SRC_DIR') + '/resource/csdk/security/include',
+        env.get('SRC_DIR') + '/extlibs/cjson',
+        env.get('SRC_DIR') + '/service/easy-setup/inc'
+    ])
+    if target_os not in ['linux', 'tizen']:
+        easy_setup_env.PrependUnique(
+            CPPPATH=[env.get('SRC_DIR') + '/extlibs/sqlite3'])
+    if env.get('SECURED') == '1':
+        with_upstream_libcoap = easy_setup_env.get('WITH_UPSTREAM_LIBCOAP')
+        if with_upstream_libcoap == '1':
+            easy_setup_env.AppendUnique(
+                CPPPATH=['#extlibs/libcoap/libcoap/include'])
+        else:
+            easy_setup_env.AppendUnique(CPPPATH=[
+                env.get('SRC_DIR') +
+                '/resource/csdk/connectivity/lib/libcoap-4.1.1/include'
+            ])
+        easy_setup_env.AppendUnique(CPPPATH=[
+            env.get('SRC_DIR') + '/resource/csdk/security/provisioning/include',
+            env.get('SRC_DIR') + '/resource/csdk/security/include/internal',
+            env.get('SRC_DIR') + '/resource/csdk/connectivity/api/',
+            env.get('SRC_DIR') + '/resource/csdk/security/provisioning/include/internal',
+            env.get('SRC_DIR') + '/resource/csdk/security/provisioning/include/cloud',
+            env.get('SRC_DIR') + '/resource/csdk/security/provisioning/include/oxm'
+        ])
+        easy_setup_env.AppendUnique(LIBS=['mbedtls', 'mbedx509', 'mbedcrypto'])
 
 if not env.get('RELEASE') and target_os not in ['ios']:
-    easy_setup_env.PrependUnique(LIBS = ['gcov'])
-    easy_setup_env.AppendUnique(CCFLAGS = ['--coverage'])
+    easy_setup_env.PrependUnique(LIBS=['gcov'])
+    easy_setup_env.AppendUnique(CCFLAGS=['--coverage'])
 
 ######################################################################
 # Source files and Targets
 ######################################################################
 
-print"easysetup_path %s" % easysetup_path
+print "easysetup_path %s" % easysetup_path
 
 es_src = None
 
-if target_os in ['android','ios','linux','tizen']:
-       if env.get('SECURED') == '1':
-               env.AppendUnique(es_src = [os.path.join(easysetup_path, 'src/EnrolleeSecurity.cpp')])
-
-       es_common_src = ['src/RemoteEnrollee.cpp',
-               'src/EnrolleeResource.cpp',
-               'src/CloudResource.cpp',
-               'src/EasySetup.cpp',
-               'src/ESException.cpp']
-
-       env.AppendUnique(es_src = es_common_src)
-
-       es_sdk_static = easy_setup_env.StaticLibrary('ESMediatorRich', env.get('es_src'))
-       easy_setup_env.InstallTarget(es_sdk_static, 'libESMediatorRich')
-       if target_os not in ['ios']:
-               es_sdk_shared = easy_setup_env.SharedLibrary('ESMediatorRich', env.get('es_src'))
-               easy_setup_env.UserInstallTargetLib(es_sdk_shared, 'libESMediatorRich')
-               easy_setup_env.AppendUnique(LINKFLAGS = ['-Wl,-soname,libESMediatorRich.so'])
-
-filenames = [ 'ESException.h', 'ESRichCommon.h', 'EasySetup.hpp', 'RemoteEnrollee.h' ]
+if target_os in ['android', 'ios', 'linux', 'tizen']:
+    if env.get('SECURED') == '1':
+        env.AppendUnique(
+            es_src=[os.path.join(easysetup_path, 'src/EnrolleeSecurity.cpp')])
+
+    es_common_src = [
+        'src/RemoteEnrollee.cpp',
+        'src/EnrolleeResource.cpp',
+        'src/CloudResource.cpp',
+        'src/EasySetup.cpp',
+        'src/ESException.cpp',
+    ]
+
+    env.AppendUnique(es_src=es_common_src)
+
+    es_sdk_static = easy_setup_env.StaticLibrary('ESMediatorRich',
+                                                 env.get('es_src'))
+    easy_setup_env.InstallTarget(es_sdk_static, 'libESMediatorRich')
+    if target_os not in ['ios']:
+        es_sdk_shared = easy_setup_env.SharedLibrary('ESMediatorRich',
+                                                     env.get('es_src'))
+        easy_setup_env.UserInstallTargetLib(es_sdk_shared, 'libESMediatorRich')
+        easy_setup_env.AppendUnique(
+            LINKFLAGS=['-Wl,-soname,libESMediatorRich.so'])
+
+filenames = [
+    'ESException.h',
+    'ESRichCommon.h',
+    'EasySetup.hpp',
+    'RemoteEnrollee.h'
+]
 for filename in filenames:
-       easy_setup_env.UserInstallTargetHeader('inc/' + filename, "service/easy-setup", filename)
+    easy_setup_env.UserInstallTargetHeader(
+        'inc/' + filename, "service/easy-setup", filename)
 
 print "Files path is %s" % env.get('es_src')
 
@@ -163,23 +195,21 @@ print "Files path is %s" % env.get('es_src')
 ################################################ ######################
 
 if target_os in ['android']:
-       SConscript('android/SConscript')
+    SConscript('android/SConscript')
 
 ######################################################################
 # Build RichSDK Mediator Sample App
 ################################################ ######################
 if target_os in ['linux']:
-       SConscript('../../sampleapp/mediator/linux/richsdk_sample/SConscript')
+    SConscript('../../sampleapp/mediator/linux/richsdk_sample/SConscript')
 
  
 if target_os in ['android']:
-       SConscript('../../sampleapp/mediator/android/SConscript')
-
+    SConscript('../../sampleapp/mediator/android/SConscript')
 
 ######################################################################
 #Build UnitTestcases for Mediator[RichSDK]
 ################################################ ######################
 if env.get('SECURED') == '0':
-   if target_os == 'linux':
-       SConscript('unittests/SConscript')
-
+    if target_os == 'linux':
+        SConscript('unittests/SConscript')
index 0e6ebb6..f7e2bee 100644 (file)
@@ -26,14 +26,16 @@ android_home = env.get('ANDROID_HOME')
 
 ANDROID_TARGET_ARCH = env.get('TARGET_ARCH')
 if env.get('RELEASE'):
-       ANDROID_RELEASE="release"
+    ANDROID_RELEASE = "release"
 else:
-       ANDROID_RELEASE="debug"
+    ANDROID_RELEASE = "debug"
 
 os.environ['ANDROID_HOME'] = env.get('ANDROID_HOME')
 os.environ['ANDROID_NDK_HOME'] = env.get('ANDROID_NDK')
 
-if not os.path.exists(android_home + '/platforms/android-21') or not os.path.exists(android_home + '/build-tools/20.0.0'):
+if not os.path.exists(android_home +
+                      '/platforms/android-21') or not os.path.exists(
+                          android_home + '/build-tools/20.0.0'):
     print '''
 ***************************************** Info ********************************
 *   Either 'Android API 21' is not installed or 'Android SDK Build Tools      *
@@ -64,20 +66,33 @@ if not os.path.exists(android_home + '/platforms/android-21') or not os.path.exi
 
 #SConscript("../../../../../../android/android_api/SConscript")
 
+
 def ensure_libs(target, source, env):
-    return target, [source, env.get('BUILD_DIR') + 'liboc.so',
-                            env.get('BUILD_DIR') + 'liboc_logger.so',
-                            env.get('BUILD_DIR') + 'libESMediatorRich.so']
+    return target, [
+        source,
+        env.get('BUILD_DIR') + 'liboc.so',
+        env.get('BUILD_DIR') + 'liboc_logger.so',
+        env.get('BUILD_DIR') + 'libESMediatorRich.so'
+    ]
+
 
 jdk_env = Environment(ENV=os.environ)
-jdk_env['BUILDERS']['Gradle'] = Builder(action = env.get('ANDROID_GRADLE') +
-    ' build -bservice/easy-setup/mediator/richsdk/android/build.gradle -PTARGET_ARCH=%s -PRELEASE=%s --stacktrace' %(ANDROID_TARGET_ARCH, ANDROID_RELEASE),
-    emitter = ensure_libs)
+jdk_env['BUILDERS']['Gradle'] = Builder(
+    action=env.get('ANDROID_GRADLE') +
+    ' build -bservice/easy-setup/mediator/richsdk/android/build.gradle -PTARGET_ARCH=%s -PRELEASE=%s --stacktrace'
+    % (ANDROID_TARGET_ARCH, ANDROID_RELEASE),
+    emitter=ensure_libs)
 jdk_env['BUILD_DIR'] = env.get('BUILD_DIR')
-cmdBuildEasysetup=jdk_env.Gradle(target="EasySetupCore/objs",
-    source="EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EasySetup.java")
-jdk_env.Clean(cmdBuildEasysetup, Dir('#/service/easy-setup/mediator/richsdk/android/build/'))
-jdk_env.Clean(cmdBuildEasysetup, Dir('#/service/easy-setup/mediator/richsdk/android/EasySetupCore/build/'))
+cmdBuildEasysetup = jdk_env.Gradle(
+    target="EasySetupCore/objs",
+    source=
+    "EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EasySetup.java"
+)
+jdk_env.Clean(cmdBuildEasysetup,
+              Dir('#/service/easy-setup/mediator/richsdk/android/build/'))
+jdk_env.Clean(
+    cmdBuildEasysetup,
+    Dir('#/service/easy-setup/mediator/richsdk/android/EasySetupCore/build/'))
 Depends(cmdBuildEasysetup, env.get('baseAAR'))
 
-env.AppendUnique(easysetupAAR = cmdBuildEasysetup)
\ No newline at end of file
+env.AppendUnique(easysetupAAR=cmdBuildEasysetup)
index 341acb4..fdf5097 100644 (file)
 # Notification Unit Test build script
 ##
 
+from tools.scons.RunTest import run_test
+
 Import('env')
 
 if env.get('RELEASE'):
-    env.AppendUnique(CCFLAGS = ['-Os'])
-    env.AppendUnique(CPPDEFINES = ['NDEBUG'])
+    env.AppendUnique(CCFLAGS=['-Os'])
+    env.AppendUnique(CPPDEFINES=['NDEBUG'])
 else:
-    env.AppendUnique(CCFLAGS = ['-g'])
+    env.AppendUnique(CCFLAGS=['-g'])
 
 if env.get('LOGGING'):
-    env.AppendUnique(CPPDEFINES = ['TB_LOG'])
+    env.AppendUnique(CPPDEFINES=['TB_LOG'])
 
 gtest_env = SConscript('#extlibs/gtest/SConscript')
 lib_env = gtest_env.Clone()
@@ -48,18 +50,23 @@ target_os = env.get('TARGET_OS')
 # Build flags
 ######################################################################
 
-easysetup_test_env.AppendUnique(LIBPATH = [lib_env.get('BUILD_DIR')])
-easysetup_test_env.PrependUnique(LIBS = [
-    'connectivity_abstraction', 'oc', 'octbstack', 'oc_logger', 'coap',
+easysetup_test_env.AppendUnique(LIBPATH=[lib_env.get('BUILD_DIR')])
+easysetup_test_env.PrependUnique(LIBS=[
+    'connectivity_abstraction',
+    'oc',
+    'octbstack',
+    'oc_logger',
+    'coap',
 ])
 
 if target_os not in ['windows', 'winrt']:
-    easysetup_test_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x'])
+    easysetup_test_env.AppendUnique(
+        CXXFLAGS=['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x'])
 
-easysetup_test_env.AppendUnique(CXXFLAGS = ['-pthread'])
-easysetup_test_env.AppendUnique(LIBS = ['pthread'])
+easysetup_test_env.AppendUnique(CXXFLAGS=['-pthread'])
+easysetup_test_env.AppendUnique(LIBS=['pthread'])
 
-easysetup_test_env.PrependUnique(CPPPATH = [
+easysetup_test_env.PrependUnique(CPPPATH=[
     '#/extlibs/hippomocks/hippomocks',
     '#/resource/csdk/include',
     '#/resource/csdk/connectivity/api',
@@ -73,25 +80,29 @@ easysetup_test_env.PrependUnique(CPPPATH = [
 
 if env.get('SECURED') == '1':
     if env.get('WITH_TCP') == True:
-        easysetup_test_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509', 'mbedcrypto'])
+        easysetup_test_env.AppendUnique(
+            LIBS=['mbedtls', 'mbedx509', 'mbedcrypto'])
 ######################################################################
 # Build Test
 ######################################################################
 
 easysetup_mediator_test_env = easysetup_test_env.Clone()
-easysetup_mediator_test_env.AppendUnique(LIBS = ['ESEnrolleeSDK', 'ESMediatorRich'])
-
-easysetup_mediator_test_src = env.Glob(src_dir + '/service/easy-setup/mediator/richsdk/unittests/ESMediatorTest.cpp')
-easysetup_mediator_test = easysetup_mediator_test_env.Program('easysetup_mediator_test', easysetup_mediator_test_src)
+easysetup_mediator_test_env.AppendUnique(
+    LIBS=['ESEnrolleeSDK', 'ESMediatorRich'])
+
+easysetup_mediator_test_src = env.Glob(
+    src_dir +
+    '/service/easy-setup/mediator/richsdk/unittests/ESMediatorTest.cpp')
+easysetup_mediator_test = easysetup_mediator_test_env.Program(
+    'easysetup_mediator_test', easysetup_mediator_test_src)
 Alias("easysetup_mediator_test", easysetup_mediator_test)
 env.AppendTarget('easysetup_mediator_test')
 
-# TODO: fix this test on supported configurations and remove commented lines
 if env.get('TEST') == '1':
     if target_os in ['linux'] and env.get('SECURED') != '1':
-        from tools.scons.RunTest import run_test
-        run_test(easysetup_mediator_test_env,
-#                'service_easy-setup_mediator_richsdk_unittests_easysetup_mediator_test.memcheck',
-                 '',
-                 'service/easy-setup/mediator/richsdk/unittests/easysetup_mediator_test',
-                 easysetup_mediator_test)
+        run_test(
+            easysetup_mediator_test_env,
+            # 'service_easy-setup_mediator_richsdk_unittests_easysetup_mediator_test.memcheck',
+            '',  # TODO: fix this test and enable previous line
+            'service/easy-setup/mediator/richsdk/unittests/easysetup_mediator_test',
+            easysetup_mediator_test)
index e390759..9bbbc5d 100644 (file)
@@ -32,22 +32,29 @@ transport = enrollee_env.get('TARGET_TRANSPORT')
 ######################################################################
 # Build flags
 ######################################################################
-enrollee_env.PrependUnique(CPPPATH = [
-        env.get('SRC_DIR') + '/resource/oc_logger/include',
-        env.get('SRC_DIR') + '/resource/csdk/logger/include',
-        env.get('SRC_DIR') + '/resource/csdk/include',
-        env.get('SRC_DIR') + '/resource/csdk/stack/include',
-               env.get('SRC_DIR') + '/extlibs/cjson',
-               env.get('SRC_DIR') + '/service/easy-setup/inc',
-               env.get('SRC_DIR') + '/service/easy-setup/enrollee/arduino/wifi',
-               env.get('SRC_DIR') + '/service/easy-setup/enrollee/inc',
-               env.get('SRC_DIR') + '/service/easy-setup/enrollee/src'])
-
-enrollee_env.AppendUnique(CPPDEFINES = ['TB_LOG', 'ESWIFI'])
-
-enrollee_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
-
-enrollee_env.PrependUnique(LIBS = ['octbstack','ocsrm','connectivity_abstraction','coap', 'ESEnrolleeSDK'])
+enrollee_env.PrependUnique(CPPPATH=[
+    env.get('SRC_DIR') + '/resource/oc_logger/include',
+    env.get('SRC_DIR') + '/resource/csdk/logger/include',
+    env.get('SRC_DIR') + '/resource/csdk/include',
+    env.get('SRC_DIR') + '/resource/csdk/stack/include',
+    env.get('SRC_DIR') + '/extlibs/cjson',
+    env.get('SRC_DIR') + '/service/easy-setup/inc',
+    env.get('SRC_DIR') + '/service/easy-setup/enrollee/arduino/wifi',
+    env.get('SRC_DIR') + '/service/easy-setup/enrollee/inc',
+    env.get('SRC_DIR') + '/service/easy-setup/enrollee/src'
+])
+
+enrollee_env.AppendUnique(CPPDEFINES=['TB_LOG', 'ESWIFI'])
+
+enrollee_env.AppendUnique(LIBPATH=[env.get('BUILD_DIR')])
+
+enrollee_env.PrependUnique(LIBS=[
+    'octbstack',
+    'ocsrm',
+    'connectivity_abstraction',
+    'coap',
+    'ESEnrolleeSDK',
+])
 enrollee = enrollee_env.Program('enrollee', 'enrolleewifi.cpp')
 env.CreateBin('enrollee')
 
@@ -56,8 +63,9 @@ i_enrollee = enrollee_env.Install(env.get('BUILD_DIR'), enrollee)
 Alias('enrollee', i_enrollee)
 env.AppendTarget('enrollee')
 
-if(enrollee_env['UPLOAD'] == True):
-       if sys.platform.startswith("linux"):
-               enrollee_env.Upload(env.get('BUILD_DIR') + '/service/easy-setup/sampleapp/enrollee/arduino/enrollee.hex')
-       else:
-               print 'Please use appropriate install method for your development machine. Linux is the only supported platform right now.'
+if (enrollee_env['UPLOAD'] == True):
+    if sys.platform.startswith("linux"):
+        enrollee_env.Upload(
+            env.get('BUILD_DIR') + '/service/easy-setup/sampleapp/enrollee/arduino/enrollee.hex')
+    else:
+        print 'Please use appropriate install method for your developing machine. Linux is the only supported platform right now.'
index 96781e5..b9cf40c 100644 (file)
@@ -32,46 +32,60 @@ transport = enrollee_env.get('TARGET_TRANSPORT')
 ######################################################################
 # Build flags
 ######################################################################
-enrollee_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
-enrollee_env.AppendUnique(CXXFLAGS = ['-Wall', '-std=c++0x'])
+enrollee_env.AppendUnique(LIBPATH=[env.get('BUILD_DIR')])
+enrollee_env.AppendUnique(CXXFLAGS=['-Wall', '-std=c++0x'])
 
 if env.get('RELEASE'):
-    enrollee_env.AppendUnique(CCFLAGS = ['-Os'])
-    enrollee_env.AppendUnique(CPPDEFINES = ['NDEBUG'])
+    enrollee_env.AppendUnique(CCFLAGS=['-Os'])
+    enrollee_env.AppendUnique(CPPDEFINES=['NDEBUG'])
 else:
-    enrollee_env.AppendUnique(CCFLAGS = ['-g'])
+    enrollee_env.AppendUnique(CCFLAGS=['-g'])
 
 if env.get('LOGGING'):
-    env.AppendUnique(CPPDEFINES = ['TB_LOG'])
+    env.AppendUnique(CPPDEFINES=['TB_LOG'])
 
-enrollee_env.PrependUnique(CPPPATH = [
-        env.get('SRC_DIR') + '/resource/include',
-        env.get('SRC_DIR') + '/resource/oc_logger/include',
-        env.get('SRC_DIR') + '/resource/csdk/logger/include',
-        env.get('SRC_DIR') + '/resource/csdk/include',
-        env.get('SRC_DIR') + '/resource/csdk/security/include',
-        env.get('SRC_DIR') + '/resource/csdk/stack/include',
-        env.get('SRC_DIR') + '/extlibs/cjson',
-        env.get('SRC_DIR') + '/service/easy-setup/inc',
-        env.get('SRC_DIR') + '/service/easy-setup/enrollee/linux/wifi',
-        env.get('SRC_DIR') + '/service/easy-setup/enrollee/inc',
-        env.get('SRC_DIR') + '/service/easy-setup/enrollee/src'])
+enrollee_env.PrependUnique(CPPPATH=[
+    env.get('SRC_DIR') + '/resource/include',
+    env.get('SRC_DIR') + '/resource/oc_logger/include',
+    env.get('SRC_DIR') + '/resource/csdk/logger/include',
+    env.get('SRC_DIR') + '/resource/csdk/include',
+    env.get('SRC_DIR') + '/resource/csdk/security/include',
+    env.get('SRC_DIR') + '/resource/csdk/stack/include',
+    env.get('SRC_DIR') + '/extlibs/cjson',
+    env.get('SRC_DIR') + '/service/easy-setup/inc',
+    env.get('SRC_DIR') + '/service/easy-setup/enrollee/linux/wifi',
+    env.get('SRC_DIR') + '/service/easy-setup/enrollee/inc',
+    env.get('SRC_DIR') + '/service/easy-setup/enrollee/src'
+])
 
-enrollee_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'ocsrm', 'pthread', 'connectivity_abstraction','coap', 'ESEnrolleeSDK'])
+enrollee_env.PrependUnique(LIBS=[
+    'oc',
+    'octbstack',
+    'oc_logger',
+    'ocsrm',
+    'pthread',
+    'connectivity_abstraction',
+    'coap',
+    'ESEnrolleeSDK',
+])
 if enrollee_env.get('SECURED') == '1':
-    enrollee_env.PrependUnique(LIBS = ['ocpmapi', 'ocprovision'])
-    enrollee_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509', 'mbedcrypto'])
+    enrollee_env.PrependUnique(LIBS=['ocpmapi', 'ocprovision'])
+    enrollee_env.AppendUnique(LIBS=['mbedtls', 'mbedx509', 'mbedcrypto'])
 
-enrollee = enrollee_env.Program('enrollee', ['enrolleewifi.c', 'easysetup_x.c'])
+enrollee = enrollee_env.Program('enrollee',
+                                ['enrolleewifi.c', 'easysetup_x.c'])
 
 i_enrollee = enrollee_env.Install(env.get('BUILD_DIR'), enrollee)
 
-justworksdat = enrollee_env.Install(env.get('BUILD_DIR') + '/service/easy-setup/sampleapp/enrollee/linux/',
-                                    env.get('SRC_DIR') + '/service/easy-setup/sampleapp/enrollee/linux/oic_svr_db_server.dat')
-
-MOTdat = enrollee_env.Install(env.get('BUILD_DIR') + '/service/easy-setup/sampleapp/enrollee/linux/',
-                                    env.get('SRC_DIR') + '/service/easy-setup/sampleapp/enrollee/linux/oic_svr_db_server_MOT.dat')
+justworksdat = enrollee_env.Install(
+    env.get('BUILD_DIR') + '/service/easy-setup/sampleapp/enrollee/linux/',
+    env.get('SRC_DIR') +
+    '/service/easy-setup/sampleapp/enrollee/linux/oic_svr_db_server.dat')
 
+MOTdat = enrollee_env.Install(
+    env.get('BUILD_DIR') + '/service/easy-setup/sampleapp/enrollee/linux/',
+    env.get('SRC_DIR') +
+    '/service/easy-setup/sampleapp/enrollee/linux/oic_svr_db_server_MOT.dat')
 
 Alias('enrollee', [i_enrollee, justworksdat, MOTdat])
 env.AppendTarget('enrollee')
index 0a28e4d..a3a90e3 100644 (file)
 ##
 # This script includes generic build options:
 #    release/debug, target os, target arch, cross toolchain, build environment etc
+#
+# Note to maintainers: this script borrows elements from the top-level 
+# build_common/SConscript. The borrowed elements should be kept in sync, 
+# but there is no current way to do that automatically.
+# Since it appears in a target-themed directory (tizen-sdb), it is not
+# clear that it ought to borrow quite so much.
 ##
 import os
 import platform
@@ -32,20 +38,29 @@ host_target_map = {
     'linux': ['linux', 'android', 'arduino', 'yocto', 'tizen'],
     'windows': ['windows', 'android', 'arduino'],
     'darwin': ['darwin', 'ios', 'android', 'arduino'],
-    'msys_nt' :['msys_nt'],
+    'msys_nt'['msys_nt'],
 }
 
 # Map of os and allowed archs (os: allowed archs)
 os_arch_map = {
-    'linux': ['x86', 'x86_64', 'arm', 'arm-v7a', 'armeabi-v7a', 'arm64', 'mips', 'mipsel', 'mips64', 'mips64el', 'i386', 'powerpc', 'sparc', 'aarch64'],
+    'linux': [
+        'x86', 'x86_64', 'arm', 'arm-v7a', 'armeabi-v7a', 'arm64', 'mips',
+        'mipsel', 'mips64', 'mips64el', 'i386', 'powerpc', 'sparc', 'aarch64'
+    ],
     'tizen': ['x86', 'x86_64', 'arm', 'arm-v7a', 'armeabi-v7a', 'arm64'],
-    'android': ['x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'armeabi-v7a-hard', 'arm64-v8a'],
+    'android': [
+        'x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'armeabi-v7a-hard',
+        'arm64-v8a'
+    ],
     'windows': ['x86', 'amd64', 'arm'],
-    'msys_nt':['x86', 'x86_64'],
+    'msys_nt': ['x86', 'x86_64'],
     'darwin': ['i386', 'x86_64'],
     'ios': ['i386', 'x86_64', 'armv7', 'armv7s', 'arm64'],
     'arduino': ['avr', 'arm'],
-    'yocto': ['i586', 'i686', 'x86_64', 'arm', 'aarch64', 'powerpc', 'powerpc64', 'mips', 'mipsel'],
+    'yocto': [
+        'i586', 'i686', 'x86_64', 'arm', 'aarch64', 'powerpc', 'powerpc64',
+        'mips', 'mipsel'
+    ],
 }
 
 host = platform.system().lower()
@@ -62,10 +77,11 @@ if host not in host_target_map:
 ######################################################################
 # Get build options (the optins from command line)
 ######################################################################
-target_os = ARGUMENTS.get('TARGET_OS', host).lower() # target os
+target_os = ARGUMENTS.get('TARGET_OS', host).lower()  # target os
 
 if target_os not in host_target_map[host]:
-    print "\nError: Unknown target os: %s (Allow values: %s)\n" % (target_os, host_target_map[host])
+    print "\nError: Unsupported target os: %s (supported values: %s)\n" % (
+        target_os, host_target_map[host])
     Exit(1)
 
 if target_os == 'android':
@@ -75,7 +91,7 @@ else:
     if target_os == 'windows':
         default_arch = default_arch.lower()
 
-target_arch = ARGUMENTS.get('TARGET_ARCH', default_arch) # target arch
+target_arch = ARGUMENTS.get('TARGET_ARCH', default_arch)  # target arch
 
 # True if binary needs to be installed on board. (Might need root permissions)
 # set to 'no', 'false' or 0 for only compilation
@@ -90,15 +106,19 @@ if ARGUMENTS.get('TEST'):
     logging_default = False
 else:
     release_mode = False
-    if ARGUMENTS.get('RELEASE', True) in ['y', 'yes', 'true', 't', '1', 'on', 'all', True]:
+    if ARGUMENTS.get('RELEASE', True) in [
+            'y', 'yes', 'true', 't', '1', 'on', 'all', True
+    ]:
         release_mode = True
     logging_default = (release_mode == False)
 
 # targets that do not support the DTLS build (SECURED=1 build option)
-targets_without_dtls_support = ['arduino'];
-if ARGUMENTS.get('SECURED') == '1' and target_os in targets_without_dtls_support:
-       print "\nError: DTLS not supported on target os: %s MUST build with SECURED=0\n" % (target_os)
-       Exit(1)
+targets_without_dtls_support = ['arduino']
+if ARGUMENTS.get(
+        'SECURED') == '1' and target_os in targets_without_dtls_support:
+    print "\nError: DTLS not supported on target os: %s MUST build with SECURED=0\n" % (
+        target_os)
+    Exit(1)
 
 ######################################################################
 # Common build options (release, target os, target arch)
@@ -110,63 +130,134 @@ help_vars = Variables()
 help_vars.Add('PROJECT_VERSION', 'The version of IoTivity', project_version)
 
 help_vars.Add(BoolVariable('VERBOSE', 'Show compilation', False))
-help_vars.Add(BoolVariable('RELEASE', 'Build for release?', True)) # set to 'no', 'false' or 0 for debug
-help_vars.Add(EnumVariable('TARGET_OS', 'Target platform', host, host_target_map[host]))
+help_vars.Add(BoolVariable('RELEASE', 'Build for release?',
+                           True))  # set to 'no', 'false' or 0 for debug
+help_vars.Add(
+    EnumVariable('TARGET_OS', 'Target platform', host, host_target_map[host]))
 
-
-help_vars.Add(BoolVariable('WITH_RA', 'Build with Remote Access module', False))
+help_vars.Add(
+    BoolVariable('WITH_RA', 'Build with Remote Access module', False))
 help_vars.Add(BoolVariable('WITH_TCP', 'Build with TCP adapter', False))
 help_vars.Add(BoolVariable('WITH_PROXY', 'Build with CoAP-HTTP Proxy', False))
-help_vars.Add(ListVariable('WITH_MQ', 'Build with MQ publisher/broker', 'OFF', ['OFF', 'SUB', 'PUB', 'BROKER']))
-help_vars.Add(BoolVariable('WITH_CLOUD', 'Build including AccountManager class and Cloud Client sample', False))
-help_vars.Add(ListVariable('RD_MODE', 'Resource Directory build mode', 'CLIENT', ['CLIENT', 'SERVER']))
+help_vars.Add(
+    ListVariable('WITH_MQ', 'Build with MQ publisher/broker', 'OFF',
+                 ['OFF', 'SUB', 'PUB', 'BROKER']))
+help_vars.Add(
+    BoolVariable(
+        'WITH_CLOUD',
+        'Build including AccountManager class and Cloud Client sample', False))
+help_vars.Add(
+    ListVariable('RD_MODE', 'Resource Directory build mode', 'CLIENT',
+                 ['CLIENT', 'SERVER']))
 
 help_vars.Add(BoolVariable('SIMULATOR', 'Build with simulator module', False))
 
-help_vars.Add(BoolVariable('WITH_RA_IBB', 'Build with Remote Access module(workssys)', False))
-
+help_vars.Add(
+    BoolVariable('WITH_RA_IBB', 'Build with Remote Access module(workssys)',
+                 False))
 
 if target_os in targets_disallow_multitransport:
-    help_vars.Add(ListVariable('TARGET_TRANSPORT', 'Target transport', 'IP', ['BT', 'BLE', 'IP', 'NFC']))
+    help_vars.Add(
+        ListVariable('TARGET_TRANSPORT', 'Target transport', 'IP',
+                     ['BT', 'BLE', 'IP', 'NFC']))
 else:
-    help_vars.Add(ListVariable('TARGET_TRANSPORT', 'Target transport', 'ALL', ['ALL', 'BT', 'BLE', 'IP', 'NFC']))
+    help_vars.Add(
+        ListVariable('TARGET_TRANSPORT', 'Target transport', 'ALL',
+                     ['ALL', 'BT', 'BLE', 'IP', 'NFC']))
 
-help_vars.Add(EnumVariable('TARGET_ARCH', 'Target architecture', default_arch, os_arch_map[target_os]))
+help_vars.Add(
+    EnumVariable('TARGET_ARCH', 'Target architecture', default_arch,
+                 os_arch_map[target_os]))
 if target_os in targets_without_dtls_support:
-    help_vars.Add(EnumVariable('SECURED', 'Build with DTLS', '0', allowed_values=('0', '1')))
+    help_vars.Add(
+        EnumVariable(
+            'SECURED', 'Build with DTLS', '0', allowed_values=('0', '1')))
 else:
-    help_vars.Add(EnumVariable('SECURED', 'Build with DTLS', '1', allowed_values=('0', '1')))
-help_vars.Add(EnumVariable('MULTIPLE_OWNER', 'Enable multiple owner', '0', allowed_values=('0', '1')))
-help_vars.Add(EnumVariable('EXC_PROV_SUPPORT', 'Except OCPMAPI library(libocpmapi.so)', '0', allowed_values=('0', '1')))
-help_vars.Add(EnumVariable('TEST', 'Run unit tests', '0', allowed_values=('0', '1')))
+    help_vars.Add(
+        EnumVariable(
+            'SECURED', 'Build with DTLS', '1', allowed_values=('0', '1')))
+help_vars.Add(
+    EnumVariable(
+        'MULTIPLE_OWNER',
+        'Enable multiple owner',
+        '0',
+        allowed_values=('0', '1')))
+help_vars.Add(
+    EnumVariable(
+        'EXC_PROV_SUPPORT',
+        'Except OCPMAPI library(libocpmapi.so)',
+        '0',
+        allowed_values=('0', '1')))
+help_vars.Add(
+    EnumVariable('TEST', 'Run unit tests', '0', allowed_values=('0', '1')))
 help_vars.Add(BoolVariable('LOGGING', 'Enable stack logging', logging_default))
-help_vars.Add(EnumVariable('LOG_LEVEL', 'Enable stack logging level', 'DEBUG', allowed_values=('DEBUG', 'INFO', 'ERROR', 'WARNING', 'FATAL')))
-help_vars.Add(BoolVariable('UPLOAD', 'Upload binary ? (For Arduino)', require_upload))
-help_vars.Add(EnumVariable('ROUTING', 'Enable routing', 'EP', allowed_values=('GW', 'EP')))
-help_vars.Add(EnumVariable('BUILD_SAMPLE', 'Build with sample', 'ON', allowed_values=('ON', 'OFF')))
-help_vars.AddVariables(('DEVICE_NAME', 'Network display name for device (For Arduino)', device_name, None, None),)
-help_vars.Add(PathVariable('ANDROID_NDK', 'Android NDK path', None, PathVariable.PathAccept))
-help_vars.Add(PathVariable('ANDROID_HOME', 'Android SDK path', None, PathVariable.PathAccept))
-help_vars.Add(PathVariable('ANDROID_GRADLE', 'Gradle binary file', None, PathVariable.PathIsFile))
-help_vars.Add(EnumVariable('WITH_UPSTREAM_LIBCOAP', 'Use latest stable version of LibCoAP downloaded from github', default_with_upstream_libcoap, allowed_values=('0','1')))
-help_vars.Add(BoolVariable('WITH_ENV', 'Use compiler options from environment', False))
+help_vars.Add(
+    EnumVariable(
+        'LOG_LEVEL',
+        'Enable stack logging level',
+        'DEBUG',
+        allowed_values=('DEBUG', 'INFO', 'ERROR', 'WARNING', 'FATAL')))
+help_vars.Add(
+    BoolVariable('UPLOAD', 'Upload binary ? (For Arduino)', require_upload))
+help_vars.Add(
+    EnumVariable(
+        'ROUTING', 'Enable routing', 'EP', allowed_values=('GW', 'EP')))
+help_vars.Add(
+    EnumVariable(
+        'BUILD_SAMPLE',
+        'Build with sample',
+        'ON',
+        allowed_values=('ON', 'OFF')))
+help_vars.AddVariables(
+    ('DEVICE_NAME', 'Network display name for device (For Arduino)',
+     device_name, None, None), )
+help_vars.Add(
+    PathVariable('ANDROID_NDK', 'Android NDK path', None,
+                 PathVariable.PathAccept))
+help_vars.Add(
+    PathVariable('ANDROID_HOME', 'Android SDK path', None,
+                 PathVariable.PathAccept))
+help_vars.Add(
+    PathVariable('ANDROID_GRADLE', 'Gradle binary file', None,
+                 PathVariable.PathIsFile))
+help_vars.Add(
+    EnumVariable(
+        'WITH_UPSTREAM_LIBCOAP',
+        'Use latest stable version of LibCoAP downloaded from github',
+        default_with_upstream_libcoap,
+        allowed_values=('0', '1')))
+help_vars.Add(
+    BoolVariable('WITH_ENV', 'Use compiler options from environment', False))
 
 if target_os == 'windows':
-       # For VS2013, MSVC_VERSION is '12.0'. For VS2015, MSVC_VERSION is '14.0'.
-       # Default value is None, meaning that SCons has to choose automatically a VS version.
-       help_vars.Add(EnumVariable('MSVC_VERSION', 'MSVC compiler version - Windows', None, allowed_values=('12.0', '14.0')))
+    # For VS2013, MSVC_VERSION is '12.0'. For VS2015, MSVC_VERSION is '14.0'.
+    # Default value is None, meaning that SCons has to choose automatically a VS version.
+    help_vars.Add(
+        EnumVariable(
+            'MSVC_VERSION',
+            'MSVC compiler version - Windows',
+            None,
+            allowed_values=('12.0', '14.0')))
 
 help_vars.Add(BoolVariable('BUILD_JAVA', 'Build Java bindings', False))
-help_vars.Add(PathVariable('JAVA_HOME', 'JDK directory', os.environ.get('JAVA_HOME'), PathVariable.PathAccept))
-help_vars.Add(EnumVariable('OIC_SUPPORT_TIZEN_TRACE', 'Tizen Trace(T-trace) api availability', 'False', allowed_values=('True', 'False')))
-
-AddOption('--prefix',
-                  dest='prefix',
-                  type='string',
-                  nargs=1,
-                  action='store',
-                  metavar='DIR',
-                  help='installation prefix')
+help_vars.Add(
+    PathVariable('JAVA_HOME', 'JDK directory',
+                 os.environ.get('JAVA_HOME'), PathVariable.PathAccept))
+help_vars.Add(
+    EnumVariable(
+        'OIC_SUPPORT_TIZEN_TRACE',
+        'Tizen Trace(T-trace) api availability',
+        'False',
+        allowed_values=('True', 'False')))
+
+AddOption(
+    '--prefix',
+    dest='prefix',
+    type='string',
+    nargs=1,
+    action='store',
+    metavar='DIR',
+    help='installation prefix')
 
 ######################################################################
 # Platform(build target) specific options: SDK/NDK & toolchain
@@ -175,21 +266,31 @@ targets_support_cc = ['linux', 'arduino', 'tizen']
 
 if target_os in targets_support_cc:
     # Set cross compile toolchain
-    help_vars.Add('TC_PREFIX', "Toolchain prefix (Generally only be required for cross-compiling)", os.environ.get('TC_PREFIX'))
-    help_vars.Add(PathVariable('TC_PATH',
+    help_vars.Add(
+        'TC_PREFIX',
+        "Toolchain prefix (Generally only be required for cross-compiling)",
+        os.environ.get('TC_PREFIX'))
+    help_vars.Add(
+        PathVariable(
+            'TC_PATH',
             'Toolchain path (Generally only be required for cross-compiling)',
             os.environ.get('TC_PATH')))
 
-if target_os in ['android', 'arduino']: # Android/Arduino always uses GNU compiler regardless of the host
-    env = Environment(variables = help_vars,
-            tools = ['gnulink', 'gcc', 'g++', 'ar', 'as', 'textfile']
-            )
+if target_os in [
+        'android', 'arduino'
+]:  # Android/Arduino always uses GNU compiler regardless of the host
+    env = Environment(
+        variables=help_vars,
+        tools=['gnulink', 'gcc', 'g++', 'ar', 'as', 'textfile'])
 else:
-    env = Environment(variables = help_vars, tools = ['default', 'textfile'],
-            TARGET_ARCH = target_arch, TARGET_OS = target_os,
-            PREFIX = GetOption('prefix'),
-            LIB_INSTALL_DIR = ARGUMENTS.get('LIB_INSTALL_DIR') #for 64bit build
-            )
+    env = Environment(
+        variables=help_vars,
+        tools=['default', 'textfile'],
+        TARGET_ARCH=target_arch,
+        TARGET_OS=target_os,
+        PREFIX=GetOption('prefix'),
+        LIB_INSTALL_DIR=ARGUMENTS.get('LIB_INSTALL_DIR')  #for 64bit build
+    )
 Help(help_vars.GenerateHelpText(env))
 
 if env.get('WITH_ENV'):
@@ -237,17 +338,17 @@ if target_os in targets_support_cc:
     prefix = env.get('TC_PREFIX')
     tc_path = env.get('TC_PATH')
     if prefix:
-        env.Replace(CC = prefix + env.get('CC', 'gcc'))
-        env.Replace(CXX = prefix + env.get('CXX', 'g++'))
-        env.Replace(AR = prefix + env.get('AR', 'ar'))
-        env.Replace(AS = prefix + env.get('AS', 'as'))
-        env.Replace(RANLIB = prefix + env.get('RANLIB', 'ranlib'))
+        env.Replace(CC=prefix + env.get('CC', 'gcc'))
+        env.Replace(CXX=prefix + env.get('CXX', 'g++'))
+        env.Replace(AR=prefix + env.get('AR', 'ar'))
+        env.Replace(AS=prefix + env.get('AS', 'as'))
+        env.Replace(RANLIB=prefix + env.get('RANLIB', 'ranlib'))
 
     if tc_path:
         env.PrependENVPath('PATH', tc_path)
         sys_root = os.path.abspath(tc_path + '/../')
-        env.AppendUnique(CCFLAGS = ['--sysroot=' + sys_root])
-        env.AppendUnique(LINKFLAGS = ['--sysroot=' + sys_root])
+        env.AppendUnique(CCFLAGS=['--sysroot=' + sys_root])
+        env.AppendUnique(LINKFLAGS=['--sysroot=' + sys_root])
 
     if prefix or tc_path:
         print tc_set_msg
@@ -260,11 +361,13 @@ else:
 
 if env['CONFIG_ENVIRONMENT_IMPORT'] == True:
     print "warning: importing some environment variables for OS: %s" % target_os
-    for ev in ['PATH', 'PKG_CONFIG', 'PKG_CONFIG_PATH', 'PKG_CONFIG_SYSROOT_DIR']:
+    for ev in [
+            'PATH', 'PKG_CONFIG', 'PKG_CONFIG_PATH', 'PKG_CONFIG_SYSROOT_DIR'
+    ]:
         if os.environ.get(ev) != None:
             env['ENV'][ev] = os.environ.get(ev)
     if os.environ['LDFLAGS'] != None:
-        env.AppendUnique(LINKFLAGS = Split(os.environ['LDFLAGS']))
+        env.AppendUnique(LINKFLAGS=Split(os.environ['LDFLAGS']))
 
 # Ensure scons be able to change its working directory
 env.SConscriptChdir(1)
@@ -277,6 +380,7 @@ env.SConscriptChdir(1)
 #   env.get('SRC_DIR')
 #   env.get('BUILD_DIR')
 
+
 def __set_dir(env, dir):
     if not os.path.exists(dir + '/SConstruct'):
         print '''
@@ -293,19 +397,22 @@ def __set_dir(env, dir):
         build_dir = dir + '/out/' + target_os + '/' + target_arch + '/debug/'
     env.VariantDir(build_dir, dir, duplicate=0)
 
-    env.Replace(BUILD_DIR = build_dir)
-    env.Replace(SRC_DIR = dir)
+    env.Replace(BUILD_DIR=build_dir)
+    env.Replace(SRC_DIR=dir)
 
-def __src_to_obj(env, src, home = ''):
+
+def __src_to_obj(env, src, home=''):
     obj = env.get('BUILD_DIR') + src.replace(home, '')
     if env.get('OBJSUFFIX'):
         obj += env.get('OBJSUFFIX')
     return env.Object(obj, src)
 
+
 def __install(ienv, targets, name):
     i_n = ienv.Install(env.get('BUILD_DIR'), targets)
     Alias(name, i_n)
-    env.AppendUnique(TS = [name])
+    env.AppendUnique(TS=[name])
+
 
 def __installlib(ienv, targets, name):
     user_prefix = env.get('PREFIX')
@@ -320,20 +427,24 @@ def __installlib(ienv, targets, name):
         i_n = ienv.Install(env.get('BUILD_DIR'), targets)
     ienv.Alias("install", i_n)
 
+
 def __installbin(ienv, targets, name):
     user_prefix = env.get('PREFIX')
     if user_prefix:
         i_n = ienv.Install(user_prefix + '/bin', targets)
         ienv.Alias("install", i_n)
 
+
 def __installheader(ienv, targets, dir, name):
     user_prefix = env.get('PREFIX')
     if user_prefix:
-        i_n = ienv.Install(user_prefix + '/include/' + dir ,targets)
+        i_n = ienv.Install(user_prefix + '/include/' + dirtargets)
     else:
-        i_n = ienv.Install(os.path.join(env.get('BUILD_DIR'), 'include', dir), targets)
+        i_n = ienv.Install(
+            os.path.join(env.get('BUILD_DIR'), 'include', dir), targets)
     ienv.Alias("install", i_n)
 
+
 def __installpcfile(ienv, targets, name):
     user_prefix = env.get('PREFIX')
     if user_prefix:
@@ -346,10 +457,12 @@ def __installpcfile(ienv, targets, name):
         i_n = ienv.Install(env.get('BUILD_DIR') + 'lib/pkgconfig', targets)
     ienv.Alias("install", i_n)
 
-def __append_target(ienv, name, targets = None):
+
+def __append_target(ienv, name, targets=None):
     if targets:
         env.Alias(name, targets)
-    env.AppendUnique(TS = [name])
+    env.AppendUnique(TS=[name])
+
 
 def __print_targets(env):
     Help('''
@@ -364,6 +477,7 @@ Targets:\n    ''')
 ===============================================================================
 ''')
 
+
 env.AddMethod(__set_dir, 'SetDir')
 env.AddMethod(__print_targets, 'PrintTargets')
 env.AddMethod(__src_to_obj, 'SrcToObj')
@@ -374,7 +488,7 @@ env.AddMethod(__installbin, 'UserInstallTargetBin')
 env.AddMethod(__installheader, 'UserInstallTargetHeader')
 env.AddMethod(__installpcfile, 'UserInstallTargetPCFile')
 env.SetDir(env.GetLaunchDir())
-env['ROOT_DIR']=env.GetLaunchDir()+'/..'
+env['ROOT_DIR'] = env.GetLaunchDir() + '/..'
 
 Export('env')
 
@@ -421,7 +535,7 @@ pc_vars = {
     '\@LIBS\@': " ".join(libs)
 }
 
-env.Substfile(pc_file, SUBST_DICT = pc_vars)
+env.Substfile(pc_file, SUBST_DICT=pc_vars)
 
 ######################################################################
 # Setting global compiler flags
@@ -433,118 +547,126 @@ with_tcp = env.get('WITH_TCP')
 rd_mode = env.get('RD_MODE')
 with_ra_ibb = env.get('WITH_RA_IBB')
 
-env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
+env.AppendUnique(LIBPATH=[env.get('BUILD_DIR')])
 
 if (env.get('WITH_UPSTREAM_LIBCOAP') == '1'):
-    env.AppendUnique(CPPDEFINES = ['WITH_UPSTREAM_LIBCOAP'])
+    env.AppendUnique(CPPDEFINES=['WITH_UPSTREAM_LIBCOAP'])
 
 if (target_os not in ['arduino', 'windows']):
-    env.AppendUnique(CPPDEFINES = ['WITH_POSIX'])
+    env.AppendUnique(CPPDEFINES=['WITH_POSIX'])
 
-if (target_os in ['darwin','ios']):
-    env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
+if (target_os in ['darwin', 'ios']):
+    env.AppendUnique(CPPDEFINES=['_DARWIN_C_SOURCE'])
 
 if (env.get('SECURED') == '1'):
-    env.AppendUnique(CPPDEFINES = ['__WITH_DTLS__'])
+    env.AppendUnique(CPPDEFINES=['__WITH_DTLS__'])
 
 if ((env.get('SECURED') == '1') and with_tcp):
-    env.AppendUnique(CPPDEFINES = ['__WITH_TLS__'])
+    env.AppendUnique(CPPDEFINES=['__WITH_TLS__'])
 
 if (env.get('MULTIPLE_OWNER') == '1'):
     env.AppendUnique(CPPDEFINES=['MULTIPLE_OWNER'])
 
 if (env.get('ROUTING') == 'GW'):
-    env.AppendUnique(CPPDEFINES = ['ROUTING_GATEWAY'])
+    env.AppendUnique(CPPDEFINES=['ROUTING_GATEWAY'])
 elif (env.get('ROUTING') == 'EP'):
-    env.AppendUnique(CPPDEFINES = ['ROUTING_EP'])
+    env.AppendUnique(CPPDEFINES=['ROUTING_EP'])
 
 if (target_os == 'arduino'):
-    env.AppendUnique(CPPDEFINES = ['SINGLE_THREAD'])
-    env.AppendUnique(CPPDEFINES = ['WITH_ARDUINO'])
+    env.AppendUnique(CPPDEFINES=['SINGLE_THREAD'])
+    env.AppendUnique(CPPDEFINES=['WITH_ARDUINO'])
 elif (('IP' in target_transport) or ('ALL' in target_transport)):
-        env.AppendUnique(CPPDEFINES = ['WITH_BWT'])
+    env.AppendUnique(CPPDEFINES=['WITH_BWT'])
 
 if (target_os in ['linux', 'tizen', 'android'] and with_tcp):
-    env.AppendUnique(CPPDEFINES = ['WITH_TCP'])
+    env.AppendUnique(CPPDEFINES=['WITH_TCP'])
 
 if (target_os in ['linux', 'tizen', 'android', 'arduino', 'ios']):
-    if (('BLE' in target_transport) or ('BT' in target_transport) or ('ALL' in target_transport)):
-        env.AppendUnique(CPPDEFINES = ['WITH_TCP'])
+    if (('BLE' in target_transport) or ('BT' in target_transport) or
+        ('ALL' in target_transport)):
+        env.AppendUnique(CPPDEFINES=['WITH_TCP'])
 
 if 'ALL' in target_transport:
     if with_ra:
-        env.AppendUnique(CPPDEFINES = ['RA_ADAPTER'])
+        env.AppendUnique(CPPDEFINES=['RA_ADAPTER'])
     if with_tcp:
-        env.AppendUnique(CPPDEFINES = ['TCP_ADAPTER'])
+        env.AppendUnique(CPPDEFINES=['TCP_ADAPTER'])
     if (target_os in ['linux', 'yocto']):
-        env.AppendUnique(CPPDEFINES = ['IP_ADAPTER', 'NO_EDR_ADAPTER', 'LE_ADAPTER'])
+        env.AppendUnique(
+            CPPDEFINES=['IP_ADAPTER', 'NO_EDR_ADAPTER', 'LE_ADAPTER'])
     elif (target_os == 'android'):
-        env.AppendUnique(CPPDEFINES = ['IP_ADAPTER', 'EDR_ADAPTER', 'LE_ADAPTER', 'NFC_ADAPTER'])
-    elif (target_os in['darwin', 'ios', 'msys_nt', 'windows']):
-        env.AppendUnique(CPPDEFINES = ['IP_ADAPTER', 'NO_EDR_ADAPTER', 'NO_LE_ADAPTER'])
+        env.AppendUnique(CPPDEFINES=[
+            'IP_ADAPTER', 'EDR_ADAPTER', 'LE_ADAPTER', 'NFC_ADAPTER'
+        ])
+    elif (target_os in ['darwin', 'ios', 'msys_nt', 'windows']):
+        env.AppendUnique(
+            CPPDEFINES=['IP_ADAPTER', 'NO_EDR_ADAPTER', 'NO_LE_ADAPTER'])
     else:
-        env.AppendUnique(CPPDEFINES = ['IP_ADAPTER', 'EDR_ADAPTER', 'LE_ADAPTER'])
+        env.AppendUnique(
+            CPPDEFINES=['IP_ADAPTER', 'EDR_ADAPTER', 'LE_ADAPTER'])
 else:
     if ('BT' in target_transport):
         if (target_os == 'linux'):
             print "CA Transport BT is not supported "
             Exit(1)
         else:
-            env.AppendUnique(CPPDEFINES = ['EDR_ADAPTER'])
+            env.AppendUnique(CPPDEFINES=['EDR_ADAPTER'])
     else:
-        env.AppendUnique(CPPDEFINES = ['NO_EDR_ADAPTER'])
+        env.AppendUnique(CPPDEFINES=['NO_EDR_ADAPTER'])
 
     if ('BLE' in target_transport):
-        env.AppendUnique(CPPDEFINES = ['LE_ADAPTER'])
+        env.AppendUnique(CPPDEFINES=['LE_ADAPTER'])
     else:
-        env.AppendUnique(CPPDEFINES = ['NO_LE_ADAPTER'])
+        env.AppendUnique(CPPDEFINES=['NO_LE_ADAPTER'])
 
     if ('IP' in target_transport):
-        env.AppendUnique(CPPDEFINES = ['IP_ADAPTER'])
+        env.AppendUnique(CPPDEFINES=['IP_ADAPTER'])
     else:
-        env.AppendUnique(CPPDEFINES = ['NO_IP_ADAPTER'])
+        env.AppendUnique(CPPDEFINES=['NO_IP_ADAPTER'])
 
     if with_tcp:
-        if (target_os in ['linux', 'tizen', 'android', 'arduino', 'ios', 'windows']):
-            env.AppendUnique(CPPDEFINES = ['TCP_ADAPTER', 'WITH_TCP'])
+        if (target_os in [
+                'linux', 'tizen', 'android', 'arduino', 'ios', 'windows'
+        ]):
+            env.AppendUnique(CPPDEFINES=['TCP_ADAPTER', 'WITH_TCP'])
         else:
             print "CA Transport TCP is not supported "
             Exit(1)
     else:
-        env.AppendUnique(CPPDEFINES = ['NO_TCP_ADAPTER'])
+        env.AppendUnique(CPPDEFINES=['NO_TCP_ADAPTER'])
 
     if ('NFC' in target_transport):
         if (target_os == 'android'):
-            env.AppendUnique(CPPDEFINES = ['NFC_ADAPTER'])
+            env.AppendUnique(CPPDEFINES=['NFC_ADAPTER'])
         else:
             print "CA Transport NFC is not supported "
             Exit(1)
     else:
-        env.AppendUnique(CPPDEFINES = ['NO_NFC_ADAPTER'])
+        env.AppendUnique(CPPDEFINES=['NO_NFC_ADAPTER'])
 
 if ('SUB' in with_mq):
-    env.AppendUnique(CPPDEFINES = ['MQ_SUBSCRIBER', 'WITH_MQ'])
+    env.AppendUnique(CPPDEFINES=['MQ_SUBSCRIBER', 'WITH_MQ'])
 
 if ('PUB' in with_mq):
-    env.AppendUnique(CPPDEFINES = ['MQ_PUBLISHER', 'WITH_MQ'])
+    env.AppendUnique(CPPDEFINES=['MQ_PUBLISHER', 'WITH_MQ'])
 
 if ('BROKER' in with_mq):
-    env.AppendUnique(CPPDEFINES = ['MQ_BROKER', 'WITH_MQ'])
+    env.AppendUnique(CPPDEFINES=['MQ_BROKER', 'WITH_MQ'])
 
 if env.get('LOGGING'):
-    env.AppendUnique(CPPDEFINES = ['TB_LOG'])
+    env.AppendUnique(CPPDEFINES=['TB_LOG'])
 
 if env.get('WITH_CLOUD') and with_tcp:
-    env.AppendUnique(CPPDEFINES = ['WITH_CLOUD'])
+    env.AppendUnique(CPPDEFINES=['WITH_CLOUD'])
 
 if 'CLIENT' in rd_mode:
-    env.AppendUnique(CPPDEFINES = ['RD_CLIENT'])
+    env.AppendUnique(CPPDEFINES=['RD_CLIENT'])
 
 if 'SERVER' in rd_mode:
-    env.AppendUnique(CPPDEFINES = ['RD_SERVER'])
+    env.AppendUnique(CPPDEFINES=['RD_SERVER'])
 
 if with_ra_ibb:
-    env.AppendUnique(CPPDEFINES = ['RA_ADAPTER_IBB'])
+    env.AppendUnique(CPPDEFINES=['RA_ADAPTER_IBB'])
 ######################################################################
 # Link scons to Yocto cross-toolchain ONLY when target_os is yocto
 ######################################################################
@@ -558,20 +680,22 @@ if target_os == "yocto":
     try:
         CC = os.environ['CC']
         target_prefix = CC.split()[0]
-        target_prefix = target_prefix[:len(target_prefix)-3]
-        tools = {"CC" : target_prefix+"gcc",
-                "CXX" : target_prefix+"g++",
-                "AS" : target_prefix+"as",
-                "LD" : target_prefix+"ld",
-                "GDB" : target_prefix+"gdb",
-                "STRIP" : target_prefix+"strip",
-                "RANLIB" : target_prefix+"ranlib",
-                "OBJCOPY" : target_prefix+"objcopy",
-                "OBJDUMP" : target_prefix+"objdump",
-                "AR" : target_prefix+"ar",
-                "NM" : target_prefix+"nm",
-                "M4" : "m4",
-                "STRINGS": target_prefix+"strings"}
+        target_prefix = target_prefix[:len(target_prefix) - 3]
+        tools = {
+            "CC": target_prefix + "gcc",
+            "CXX": target_prefix + "g++",
+            "AS": target_prefix + "as",
+            "LD": target_prefix + "ld",
+            "GDB": target_prefix + "gdb",
+            "STRIP": target_prefix + "strip",
+            "RANLIB": target_prefix + "ranlib",
+            "OBJCOPY": target_prefix + "objcopy",
+            "OBJDUMP": target_prefix + "objdump",
+            "AR": target_prefix + "ar",
+            "NM": target_prefix + "nm",
+            "M4": "m4",
+            "STRINGS": target_prefix + "strings"
+        }
         PATH = os.environ['PATH'].split(os.pathsep)
         for tool in tools:
             if tool in os.environ:
@@ -592,16 +716,20 @@ if target_os == "yocto":
     We want to preserve debug symbols to allow BitBake to generate both DEBUG and
     RELEASE packages for OIC.
     '''
-    env.AppendUnique(CCFLAGS = ['-g'])
+    env.AppendUnique(CCFLAGS=['-g'])
     '''
     Additional flags to pass to the Yocto toolchain.
     '''
     if env.get('RELEASE'):
-        env.AppendUnique(CPPDEFINES = ['NDEBUG'])
-    env.AppendUnique(CPPDEFINES = ['__linux__', '_GNU_SOURCE'])
-    env.AppendUnique(CFLAGS = ['-std=gnu99'])
-    env.AppendUnique(CCFLAGS = ['-Wall', '-Wextra', '-fPIC'])
-    env.AppendUnique(LIBS = ['dl', 'pthread', 'uuid'])
+        env.AppendUnique(CPPDEFINES=['NDEBUG'])
+    env.AppendUnique(CPPDEFINES=['__linux__', '_GNU_SOURCE'])
+    env.AppendUnique(CFLAGS=['-std=gnu99'])
+    env.AppendUnique(CCFLAGS=['-Wall', '-Wextra', '-fPIC'])
+    env.AppendUnique(LIBS=[
+        'dl',
+        'pthread',
+        'uuid'
+    ])
     Export('env')
 else:
     '''
@@ -627,11 +755,8 @@ if env.GetOption('clean'):
 import iotivityconfig
 from iotivityconfig import *
 
-conf = Configure(env,
-        custom_tests =
-        {
-            'CheckPThreadsSupport' : iotivityconfig.check_pthreads
-        } )
+conf = Configure(
+    env, custom_tests={'CheckPThreadsSupport': iotivityconfig.check_pthreads})
 
 # Identify whether we have pthreads support, which is necessary for
 # threading and mutexes.  This will set the environment variable
index f7fb133..9637efd 100644 (file)
@@ -1,53 +1,62 @@
 ##
 # This script includes generic build options:
 #    release/debug, target os, target arch, cross toolchain, build environment etc
+#
+# Note to maintainers: this script borrows elements from the top-level 
+# build_common/SConscript. The borrowed elements should be kept in sync, 
+# but there is no current way to do that automatically.
+# Since it appears in a target-themed directory (tizen-sdb), it is not
+# clear that it ought to borrow quite so much.
 ##
 import os
 import platform
 
 # Map of host os and allowed target os (host: allowed target os)
 host_target_map = {
-               'linux': ['linux', 'android', 'arduino', 'yocto', 'tizen'],
-               'windows': ['windows', 'android', 'arduino'],
-               'darwin': ['darwin', 'ios', 'android', 'arduino'],
-               }
+    'linux': ['linux', 'android', 'arduino', 'yocto', 'tizen'],
+    'windows': ['windows', 'android', 'arduino'],
+    'darwin': ['darwin', 'ios', 'android', 'arduino'],
+}
 
 # Map of os and allowed archs (os: allowed archs)
 os_arch_map = {
-               'linux': ['x86', 'x86_64', 'arm', 'arm64'],
-               'tizen': ['x86', 'x86_64', 'arm', 'arm64'],
-               'android': ['x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'armeabi-v7a-hard', 'arm64-v8a'],
-               'windows': ['x86', 'amd64', 'arm'],
-               'darwin': ['i386', 'x86_64'],
-               'ios': ['i386', 'x86_64', 'armv7', 'armv7s', 'arm64'],
-               'arduino': ['avr', 'arm'],
-                'yocto': ['i586', 'x86_64', 'arm', 'powerpc', 'powerpc64', 'mips', 'mipsel'],
-               }
-
-es_target_enrollee_map = {
-               'arduino', 'tizen', 'linux'
-               }
+    'linux': ['x86', 'x86_64', 'arm', 'arm64'],
+    'tizen': ['x86', 'x86_64', 'arm', 'arm64'],
+    'android': [
+        'x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'armeabi-v7a-hard',
+        'arm64-v8a'
+    ],
+    'windows': ['x86', 'amd64', 'arm'],
+    'darwin': ['i386', 'x86_64'],
+    'ios': ['i386', 'x86_64', 'armv7', 'armv7s', 'arm64'],
+    'arduino': ['avr', 'arm'],
+    'yocto':
+    ['i586', 'x86_64', 'arm', 'powerpc', 'powerpc64', 'mips', 'mipsel'],
+}
+
+es_target_enrollee_map = {'arduino', 'tizen', 'linux'}
 
 host = platform.system().lower()
 
 if host not in host_target_map:
-       print "\nError: Current system (%s) isn't supported\n" % host
-       Exit(1)
+    print "\nError: Current system (%s) isn't supported\n" % host
+    Exit(1)
 
 ######################################################################
 # Get build options (the optins from command line)
 ######################################################################
-target_os = ARGUMENTS.get('TARGET_OS', host).lower() # target os
+target_os = ARGUMENTS.get('TARGET_OS', host).lower()  # target os
 
 if target_os not in host_target_map[host]:
-       print "\nError: Unknown target os: %s (Allow values: %s)\n" % (target_os, host_target_map[host])
-       Exit(1)
+    print "\nError: Unsupported target os: %s (supported values: %s)\n" % (
+        target_os, host_target_map[host])
+    Exit(1)
 
 default_arch = platform.machine()
 if default_arch not in os_arch_map[target_os]:
-       default_arch = os_arch_map[target_os][0].lower()
+    default_arch = os_arch_map[target_os][0].lower()
 
-target_arch = ARGUMENTS.get('TARGET_ARCH', default_arch) # target arch
+target_arch = ARGUMENTS.get('TARGET_ARCH', default_arch)  # target arch
 
 # True if binary needs to be installed on board. (Might need root permissions)
 # set to 'no', 'false' or 0 for only compilation
@@ -60,37 +69,63 @@ device_name = ARGUMENTS.get('DEVICE_NAME', "OIC-DEVICE")
 es_target_enrollee = ARGUMENTS.get('ES_TARGET_ENROLLEE')
 
 if es_target_enrollee not in es_target_enrollee_map:
-       print "\nError: Unknown ES_TARGET_ENROLLEE: %s (Allow values: %s)\n" % (es_target_enrollee, es_target_enrollee_map)
-       Exit(1)
-
+    print "\nError: Unknown ES_TARGET_ENROLLEE: %s (Allow values: %s)\n" % (
+        es_target_enrollee, es_target_enrollee_map)
+    Exit(1)
 
 ######################################################################
 # Common build options (release, target os, target arch)
 ######################################################################
 help_vars = Variables()
-help_vars.Add(BoolVariable('RELEASE', 'Build for release?', True)) # set to 'no', 'false' or 0 for debug
+help_vars.Add(BoolVariable('RELEASE', 'Build for release?',
+                           True))  # set to 'no', 'false' or 0 for debug
 help_vars.Add(BoolVariable('LOGGING', 'Enable stack logging', False))
-help_vars.Add(EnumVariable('TARGET_OS', 'Target platform', host, host_target_map[host]))
-help_vars.Add(ListVariable('TARGET_TRANSPORT', 'Target transport', 'ALL', ['ALL', 'BT', 'BLE', 'IP', 'TCP']))
-help_vars.Add(EnumVariable('TARGET_ARCH', 'Target architecture', default_arch, os_arch_map[target_os]))
-help_vars.Add(EnumVariable('SECURED', 'Build with DTLS', '1', allowed_values=('0', '1')))
-help_vars.Add(BoolVariable('UPLOAD', 'Upload binary ? (For Arduino)', require_upload))
-help_vars.Add(EnumVariable('ROUTING', 'Enable routing', 'EP', allowed_values=('GW', 'EP')))
-help_vars.Add(EnumVariable('BUILD_SAMPLE', 'Build with sample', 'ON', allowed_values=('ON', 'OFF')))
+help_vars.Add(
+    EnumVariable('TARGET_OS', 'Target platform', host, host_target_map[host]))
+help_vars.Add(
+    ListVariable('TARGET_TRANSPORT', 'Target transport', 'ALL',
+                 ['ALL', 'BT', 'BLE', 'IP', 'TCP']))
+help_vars.Add(
+    EnumVariable('TARGET_ARCH', 'Target architecture', default_arch,
+                 os_arch_map[target_os]))
+help_vars.Add(
+    EnumVariable('SECURED', 'Build with DTLS', '1', allowed_values=('0', '1')))
+help_vars.Add(
+    BoolVariable('UPLOAD', 'Upload binary ? (For Arduino)', require_upload))
+help_vars.Add(
+    EnumVariable(
+        'ROUTING', 'Enable routing', 'EP', allowed_values=('GW', 'EP')))
+help_vars.Add(
+    EnumVariable(
+        'BUILD_SAMPLE',
+        'Build with sample',
+        'ON',
+        allowed_values=('ON', 'OFF')))
 help_vars.Add(BoolVariable('WITH_TCP', 'Build with TCP adapter', False))
-help_vars.Add(BoolVariable('WITH_CLOUD', 'Build including AccountManager class and Cloud Client sample', False))
-help_vars.AddVariables(('DEVICE_NAME', 'Network display name for device', 'OIC-DEVICE', None, None),)
+help_vars.Add(
+    BoolVariable(
+        'WITH_CLOUD',
+        'Build including AccountManager class and Cloud Client sample', False))
+help_vars.AddVariables(
+    ('DEVICE_NAME', 'Network display name for device', 'OIC-DEVICE', None,
+     None), )
 
 #ES_TARGET_ENROLLEE is for specifying what is our target enrollee (Arduino or rest of platforms which support Multicast)
-help_vars.Add(EnumVariable('ES_TARGET_ENROLLEE', 'Target Enrollee', 'arduino', allowed_values=('arduino', 'tizen', 'linux')))
-
-AddOption('--prefix',
-                  dest='prefix',
-                  type='string',
-                  nargs=1,
-                  action='store',
-                  metavar='DIR',
-                  help='installation prefix')
+help_vars.Add(
+    EnumVariable(
+        'ES_TARGET_ENROLLEE',
+        'Target Enrollee',
+        'arduino',
+        allowed_values=('arduino', 'tizen', 'linux')))
+
+AddOption(
+    '--prefix',
+    dest='prefix',
+    type='string',
+    nargs=1,
+    action='store',
+    metavar='DIR',
+    help='installation prefix')
 
 ######################################################################
 # Platform(build target) specific options: SDK/NDK & toolchain
@@ -98,23 +133,35 @@ AddOption('--prefix',
 targets_support_cc = ['linux', 'arduino', 'tizen']
 
 if target_os in targets_support_cc:
-       # Set cross compile toolchain
-       help_vars.Add('TC_PREFIX', "Toolchain prefix (Generally only be required for cross-compiling)", os.environ.get('TC_PREFIX'))
-       help_vars.Add(PathVariable('TC_PATH',
-                       'Toolchain path (Generally only be required for cross-compiling)',
-                       os.environ.get('TC_PATH')))
-
-if target_os in ['android', 'arduino']: # Android/Arduino always uses GNU compiler regardless of the host
-       env = Environment(variables = help_vars,
-                       tools = ['gnulink', 'gcc', 'g++', 'ar', 'as']
-                       )
+    # Set cross compile toolchain
+    help_vars.Add(
+        'TC_PREFIX',
+        "Toolchain prefix (Generally only be required for cross-compiling)",
+        os.environ.get('TC_PREFIX'))
+    help_vars.Add(
+        PathVariable(
+            'TC_PATH',
+            'Toolchain path (Generally only be required for cross-compiling)',
+            os.environ.get('TC_PATH')))
+
+if target_os in [
+        'android', 'arduino'
+]:  # Android/Arduino always uses GNU compiler regardless of the host
+    env = Environment(
+        variables=help_vars, tools=['gnulink', 'gcc', 'g++', 'ar', 'as'])
 else:
-       env = Environment(variables = help_vars, TARGET_ARCH = target_arch, TARGET_OS = target_os, ES_TARGET_ENROLLEE = es_target_enrollee, ESPREFIX = GetOption('prefix'))
+    env = Environment(
+        variables=help_vars,
+        TARGET_ARCH=target_arch,
+        TARGET_OS=target_os,
+        ES_TARGET_ENROLLEE=es_target_enrollee,
+        ESPREFIX=GetOption('prefix'))
 
 Help(help_vars.GenerateHelpText(env))
 
 # Set device name to __OIC_DEVICE_NAME__
-env.AppendUnique(CPPDEFINES = ['-D__OIC_DEVICE_NAME__=' + "\'\"" + device_name + "\"\'"])
+env.AppendUnique(
+    CPPDEFINES=['-D__OIC_DEVICE_NAME__=' + "\'\"" + device_name + "\"\'"])
 
 tc_set_msg = '''
 ************************************ Warning **********************************
@@ -125,24 +172,24 @@ tc_set_msg = '''
 '''
 
 if target_os in targets_support_cc:
-       prefix = env.get('TC_PREFIX')
-       tc_path = env.get('TC_PATH')
-       if prefix:
-               env.Replace(CC = prefix + 'gcc')
-               env.Replace(CXX = prefix + 'g++')
-               env.Replace(AR = prefix + 'ar')
-               env.Replace(AS = prefix + 'as')
-               env.Replace(LINK = prefix + 'ld')
-               env.Replace(RANLIB = prefix + 'ranlib')
-
-       if tc_path:
-               env.PrependENVPath('PATH', tc_path)
-               sys_root = os.path.abspath(tc_path + '/../')
-               env.AppendUnique(CCFLAGS = ['--sysroot=' + sys_root])
-               env.AppendUnique(LINKFLAGS = ['--sysroot=' + sys_root])
-
-       if prefix or tc_path:
-               print tc_set_msg
+    prefix = env.get('TC_PREFIX')
+    tc_path = env.get('TC_PATH')
+    if prefix:
+        env.Replace(CC=prefix + 'gcc')
+        env.Replace(CXX=prefix + 'g++')
+        env.Replace(AR=prefix + 'ar')
+        env.Replace(AS=prefix + 'as')
+        env.Replace(LINK=prefix + 'ld')
+        env.Replace(RANLIB=prefix + 'ranlib')
+
+    if tc_path:
+        env.PrependENVPath('PATH', tc_path)
+        sys_root = os.path.abspath(tc_path + '/../')
+        env.AppendUnique(CCFLAGS=['--sysroot=' + sys_root])
+        env.AppendUnique(LINKFLAGS=['--sysroot=' + sys_root])
+
+    if prefix or tc_path:
+        print tc_set_msg
 
 # Ensure scons be able to change its working directory
 env.SConscriptChdir(1)
@@ -155,68 +202,76 @@ env.SConscriptChdir(1)
 #   env.get('SRC_DIR')
 #   env.get('BUILD_DIR')
 
+
 def __set_dir(env, dir):
-       if not os.path.exists(dir + '/SConstruct'):
-               print '''
+    if not os.path.exists(dir + '/SConstruct'):
+        print '''
 *************************************** Error *********************************
 * The directory(%s) seems isn't a source code directory, no SConstruct file is
 * found. *
 *******************************************************************************
 ''' % dir
-               Exit(1)
+        Exit(1)
+
+    if env.get('RELEASE'):
+        build_dir = dir + '/out/' + target_os + '/' + target_arch + '/release/'
+    else:
+        build_dir = dir + '/out/' + target_os + '/' + target_arch + '/debug/'
+    env.VariantDir(build_dir, dir, duplicate=0)
+
+    env.Replace(BUILD_DIR=build_dir)
+    env.Replace(SRC_DIR=dir)
 
-       if env.get('RELEASE'):
-               build_dir = dir + '/out/' + target_os + '/' + target_arch + '/release/'
-       else:
-               build_dir = dir + '/out/' + target_os + '/' + target_arch + '/debug/'
-       env.VariantDir(build_dir, dir, duplicate=0)
 
-       env.Replace(BUILD_DIR = build_dir)
-       env.Replace(SRC_DIR = dir)
+def __src_to_obj(env, src, home=''):
+    obj = env.get('BUILD_DIR') + src.replace(home, '')
+    if env.get('OBJSUFFIX'):
+        obj += env.get('OBJSUFFIX')
+    return env.Object(obj, src)
 
-def __src_to_obj(env, src, home = ''):
-       obj = env.get('BUILD_DIR') + src.replace(home, '')
-       if env.get('OBJSUFFIX'):
-               obj += env.get('OBJSUFFIX')
-       return env.Object(obj, src)
 
 def __install(ienv, targets, name):
-       i_n = ienv.Install(env.get('BUILD_DIR'), targets)
-       Alias(name, i_n)
-       env.AppendUnique(TS = [name])
+    i_n = ienv.Install(env.get('BUILD_DIR'), targets)
+    Alias(name, i_n)
+    env.AppendUnique(TS=[name])
+
 
 def __installlib(ienv, targets, name):
-       user_prefix = env.get('PREFIX')
-       if user_prefix:
-               i_n = ienv.Install(user_prefix + '/lib', targets)
-       else:
-               i_n = ienv.Install(env.get('BUILD_DIR'), targets)
-       ienv.Alias("install", i_n)
+    user_prefix = env.get('PREFIX')
+    if user_prefix:
+        i_n = ienv.Install(user_prefix + '/lib', targets)
+    else:
+        i_n = ienv.Install(env.get('BUILD_DIR'), targets)
+    ienv.Alias("install", i_n)
+
 
 def __installbin(ienv, targets, name):
-       user_prefix = env.get('PREFIX')
-       if user_prefix:
-               i_n = ienv.Install(user_prefix + '/bin', targets)
-       else:
-               i_n = ienv.Install(env.get('BUILD_DIR'), targets)
-       ienv.Alias("install", i_n)
+    user_prefix = env.get('PREFIX')
+    if user_prefix:
+        i_n = ienv.Install(user_prefix + '/bin', targets)
+    else:
+        i_n = ienv.Install(env.get('BUILD_DIR'), targets)
+    ienv.Alias("install", i_n)
+
 
 def __append_target(ienv, target):
-       env.AppendUnique(TS = [target])
+    env.AppendUnique(TS=[target])
+
 
 def __print_targets(env):
-       Help('''
+    Help('''
 ===============================================================================
 Targets:\n    ''')
-       for t in env.get('TS'):
-               Help(t + ' ')
-       Help('''
+    for t in env.get('TS'):
+        Help(t + ' ')
+    Help('''
 \nDefault all targets will be built. You can specify the target to build:
 
     $ scons [options] [target]
 ===============================================================================
 ''')
 
+
 env.AddMethod(__set_dir, 'SetDir')
 env.AddMethod(__print_targets, 'PrintTargets')
 env.AddMethod(__src_to_obj, 'SrcToObj')
@@ -225,17 +280,17 @@ env.AddMethod(__install, 'InstallTarget')
 env.AddMethod(__installlib, 'UserInstallTargetLib')
 env.AddMethod(__installbin, 'UserInstallTargetBin')
 env.SetDir(env.GetLaunchDir())
-env['ROOT_DIR']=env.GetLaunchDir()+'/..'
+env['ROOT_DIR'] = env.GetLaunchDir() + '/..'
 
 Export('env')
 
 # Delete the temp files of configuration
 if env.GetOption('clean'):
-       dir = env.get('SRC_DIR')
+    dir = env.get('SRC_DIR')
 
-       if os.path.exists(dir + '/config.log'):
-               Execute(Delete(dir + '/config.log'))
-               Execute(Delete(dir + '/.sconsign.dblite'))
-               Execute(Delete(dir + '/.sconf_temp'))
+    if os.path.exists(dir + '/config.log'):
+        Execute(Delete(dir + '/config.log'))
+        Execute(Delete(dir + '/.sconsign.dblite'))
+        Execute(Delete(dir + '/.sconf_temp'))
 
 Return('env')
index 149f05f..620f537 100644 (file)
@@ -2,7 +2,9 @@
 # Enrollee sample build script
 ##
 
-SConscript('./service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/SConscript')
+SConscript(
+    './service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/SConscript'
+)
 
 Import('env')
 
@@ -20,10 +22,12 @@ print "Given Transport is %s" % transport
 print "Given OS is %s" % target_os
 print "Given es_target_enrollee is %s" % es_target_enrollee
 print "Given tcp option is %s" % with_tcp
-print "Given cloud option is %s" %with_cloud
+print "Given cloud option is %s" % with_cloud
 
 if target_os == 'tizen':
-       command = "sh service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/tizen/gbsbuild.sh %s %s %s %s %s %s %s %s" % (transport, secured, routing, release_mode, logging, es_target_enrollee, with_tcp, with_cloud)
-       print "Created Command is %s" % command
-       gbs_script = env.Command('gbs_build', None, command)
-       AlwaysBuild ('gbs_script')
\ No newline at end of file
+    command = "sh service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/tizen/gbsbuild.sh %s %s %s %s %s %s %s %s" % (
+        transport, secured, routing, release_mode, logging, es_target_enrollee,
+        with_tcp, with_cloud)
+    print "Created Command is %s" % command
+    gbs_script = env.Command('gbs_build', None, command)
+    AlwaysBuild('gbs_script')
index afe5304..fb8b528 100644 (file)
@@ -29,24 +29,46 @@ root_dir = env.get('ROOT_DIR')
 build_dir = env.get('BUILD_DIR')
 sample_dir = build_dir
 
-env.ParseConfig("pkg-config --cflags --libs capi-network-wifi dlog gobject-2.0 gio-2.0 gthread-2.0 glib-2.0 iotivity")
-env.AppendUnique(CPPFLAGS = ['-fPIC', '-D__TIZEN__','-DWITH_POSIX', '-Wall', '-DSLP_SDK_LOG', '-g','-D_GNU_SOURCE','-DTIZEN_DEBUG_ENABLE', '-DTB_LOG','`pkg-config', '--cflags', '--libs', 'iotivity', 'dlog','capi-network-wifi',
-                'gobject-2.0', 'gio-2.0', 'gthread-2.0', 'glib-2.0`'])
+env.ParseConfig(
+    "pkg-config --cflags --libs capi-network-wifi dlog gobject-2.0 gio-2.0 gthread-2.0 glib-2.0 iotivity"
+)
+env.AppendUnique(CPPFLAGS=[
+    '-fPIC', '-D__TIZEN__', '-DWITH_POSIX', '-Wall', '-DSLP_SDK_LOG', '-g',
+    '-D_GNU_SOURCE', '-DTIZEN_DEBUG_ENABLE', '-DTB_LOG', '`pkg-config',
+    '--cflags', '--libs', 'iotivity', 'dlog', 'capi-network-wifi',
+    'gobject-2.0', 'gio-2.0', 'gthread-2.0', 'glib-2.0`'
+])
 
-env.AppendUnique(CPPDEFINES = ['TB_LOG'])
+env.AppendUnique(CPPDEFINES=['TB_LOG'])
 
-env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
+env.AppendUnique(LIBPATH=[env.get('BUILD_DIR')])
 
 if routing == 'GW':
-       env.AppendUnique(CPPDEFINES = ['ROUTING_GATEWAY'])
+    env.AppendUnique(CPPDEFINES=['ROUTING_GATEWAY'])
 elif routing == 'EP':
-       env.AppendUnique(CPPDEFINES = ['ROUTING_EP'])
+    env.AppendUnique(CPPDEFINES=['ROUTING_EP'])
 
-env.Append(LIBS=['-lgobject-2.0', '-lglib-2.0', '-lgio-2.0', '-lgthread-2.0'])
-env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'connectivity_abstraction','coap','rt','libESEnrolleeSDK','pthread'])
+env.Append(LIBS=[
+    'gobject-2.0',
+    'glib-2.0',
+    'gio-2.0',
+    'gthread-2.0'
+])
+env.PrependUnique(LIBS=[
+    'oc',
+    'octbstack',
+    'oc_logger',
+    'connectivity_abstraction',
+    'coap',
+    'rt',
+    'libESEnrolleeSDK',
+    'pthread',
+])
 
 if secured == '1':
-       env.PrependUnique(CPPPATH = [root_dir + '/external/inc/'])
-       env.AppendUnique(CPPDEFINES = ['__WITH_DTLS__'])
+    env.PrependUnique(CPPPATH=[root_dir + '/external/inc/'])
+    env.AppendUnique(CPPDEFINES=['__WITH_DTLS__'])
 
-env.Program('enrollee_wifi', [sample_dir + 'enrolleewifi.cpp', sample_dir + 'easysetup_wifi_conn.c'])
\ No newline at end of file
+env.Program('enrollee_wifi', [
+    sample_dir + 'enrolleewifi.cpp', sample_dir + 'easysetup_wifi_conn.c'
+])
index eb79c7f..8484738 100644 (file)
@@ -26,14 +26,16 @@ android_home = env.get('ANDROID_HOME')
 
 ANDROID_TARGET_ARCH = env.get('TARGET_ARCH')
 if env.get('RELEASE'):
-       ANDROID_RELEASE="release"
+    ANDROID_RELEASE = "release"
 else:
-       ANDROID_RELEASE="debug"
+    ANDROID_RELEASE = "debug"
 
 os.environ['ANDROID_HOME'] = env.get('ANDROID_HOME')
 os.environ['ANDROID_NDK_HOME'] = env.get('ANDROID_NDK')
 
-if not os.path.exists(android_home + '/platforms/android-21') or not os.path.exists(android_home + '/build-tools/20.0.0'):
+if not os.path.exists(android_home +
+                      '/platforms/android-21') or not os.path.exists(
+                          android_home + '/build-tools/20.0.0'):
     print '''
 ***************************************** Info ********************************
 *   Either 'Android API 21' is not installed or 'Android SDK Build Tools      *
@@ -64,16 +66,31 @@ if not os.path.exists(android_home + '/platforms/android-21') or not os.path.exi
 
 #SConscript("../../../../../../android/android_api/SConscript")
 
+
 def ensure_libs(target, source, env):
-    return target, [source, env.get('BUILD_DIR') + 'liboc.so', env.get('BUILD_DIR') + 'liboc_logger.so']                        
+    return target, [
+        source,
+        env.get('BUILD_DIR') + 'liboc.so',
+        env.get('BUILD_DIR') + 'liboc_logger.so'
+    ]
+
 
 jdk_env = Environment(ENV=os.environ)
-jdk_env['BUILDERS']['Gradle'] = Builder(action = env.get('ANDROID_GRADLE') + 
-    ' build -bservice/easy-setup/sampleapp/mediator/android/EasySetup/build.gradle -PTARGET_ARCH=%s -PRELEASE=%s --stacktrace' %(ANDROID_TARGET_ARCH, ANDROID_RELEASE),
-    emitter = ensure_libs)
+jdk_env['BUILDERS']['Gradle'] = Builder(
+    action=env.get('ANDROID_GRADLE') +
+    ' build -bservice/easy-setup/sampleapp/mediator/android/EasySetup/build.gradle -PTARGET_ARCH=%s -PRELEASE=%s --stacktrace'
+    % (ANDROID_TARGET_ARCH, ANDROID_RELEASE),
+    emitter=ensure_libs)
 jdk_env['BUILD_DIR'] = env.get('BUILD_DIR')
-cmdBuildEasysetupApp=jdk_env.Gradle(target="EasySetup/app/apk", 
-    source="EasySetup/app/src/main/java/org/iotivity/service/easysetup/EasysetupActivity.java")
-jdk_env.Clean(cmdBuildEasysetupApp, '#/service/easy-setup/sampleapp/mediator/android/EasySetup/build')
-jdk_env.Clean(cmdBuildEasysetupApp, '#/service/easy-setup/sampleapp/mediator/android/EasySetup/app/build')
-Depends(cmdBuildEasysetupApp, env.get('easysetupAAR'))
\ No newline at end of file
+cmdBuildEasysetupApp = jdk_env.Gradle(
+    target="EasySetup/app/apk",
+    source=
+    "EasySetup/app/src/main/java/org/iotivity/service/easysetup/EasysetupActivity.java"
+)
+jdk_env.Clean(
+    cmdBuildEasysetupApp,
+    '#/service/easy-setup/sampleapp/mediator/android/EasySetup/build')
+jdk_env.Clean(
+    cmdBuildEasysetupApp,
+    '#/service/easy-setup/sampleapp/mediator/android/EasySetup/app/build')
+Depends(cmdBuildEasysetupApp, env.get('easysetupAAR'))
index f8cfc76..7a50f60 100644 (file)
@@ -27,57 +27,73 @@ target_os = env.get('TARGET_OS')
 ######################################################################
 # Build flags
 ######################################################################
-mediator_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
+mediator_env.AppendUnique(LIBPATH=[env.get('BUILD_DIR')])
 
 if env.get('RELEASE'):
-    mediator_env.AppendUnique(CCFLAGS = ['-Os'])
-    mediator_env.AppendUnique(CPPDEFINES = ['NDEBUG'])
+    mediator_env.AppendUnique(CCFLAGS=['-Os'])
+    mediator_env.AppendUnique(CPPDEFINES=['NDEBUG'])
 else:
-    mediator_env.AppendUnique(CCFLAGS = ['-g'])
+    mediator_env.AppendUnique(CCFLAGS=['-g'])
 
 if env.get('LOGGING'):
-    env.AppendUnique(CPPDEFINES = ['TB_LOG'])
+    env.AppendUnique(CPPDEFINES=['TB_LOG'])
 
-env.AppendUnique(CPPDEFINES = ['CPP_MEDIATOR'])
+env.AppendUnique(CPPDEFINES=['CPP_MEDIATOR'])
 
 if target_os not in ['windows']:
-    mediator_env.AppendUnique(CXXFLAGS = ['-Wall', '-std=c++0x'])
-
-mediator_env.PrependUnique(CPPPATH = [
-            env.get('SRC_DIR') + '/resource/include',
-            env.get('SRC_DIR') + '/resource/oc_logger/include',
-                       env.get('SRC_DIR') + '/resource/c_common/oic_malloc/include',
-                       env.get('SRC_DIR') + '/resource/csdk/include',
-                       env.get('SRC_DIR') + '/resource/csdk/stack/include',
-                       env.get('SRC_DIR') + '/resource/csdk/security/provisioning/include',
-                       env.get('SRC_DIR') + '/resource/csdk/security/provisioning/include/internal',
-                       env.get('SRC_DIR') + '/resource/csdk/logger/include',
-                       env.get('SRC_DIR') + '/resource/csdk/security/include',
-                       env.get('SRC_DIR') + '/resource/csdk/connectivity/api',
-                       env.get('SRC_DIR') + '/extlibs/cjson',
-                       env.get('SRC_DIR') + '/service/easy-setup/mediator/richsdk/inc',
-                       env.get('SRC_DIR') + '/service/easy-setup/mediator/richsdk/src',
-                       env.get('SRC_DIR') + '/service/easy-setup/inc'])
+    mediator_env.AppendUnique(CXXFLAGS=['-Wall', '-std=c++0x'])
+
+mediator_env.PrependUnique(CPPPATH=[
+    env.get('SRC_DIR') + '/resource/include',
+    env.get('SRC_DIR') + '/resource/oc_logger/include',
+    env.get('SRC_DIR') + '/resource/c_common/oic_malloc/include',
+    env.get('SRC_DIR') + '/resource/csdk/include',
+    env.get('SRC_DIR') + '/resource/csdk/stack/include',
+    env.get('SRC_DIR') + '/resource/csdk/security/provisioning/include',
+    env.get('SRC_DIR') +
+    '/resource/csdk/security/provisioning/include/internal',
+    env.get('SRC_DIR') + '/resource/csdk/logger/include',
+    env.get('SRC_DIR') + '/resource/csdk/security/include',
+    env.get('SRC_DIR') + '/resource/csdk/connectivity/api',
+    env.get('SRC_DIR') + '/extlibs/cjson',
+    env.get('SRC_DIR') + '/service/easy-setup/mediator/richsdk/inc',
+    env.get('SRC_DIR') + '/service/easy-setup/mediator/richsdk/src',
+    env.get('SRC_DIR') + '/service/easy-setup/inc'
+])
 
 if env.get('SECURED') == '1':
-       mediator_env.PrependUnique(LIBS = ['mbedtls', 'mbedx509','mbedcrypto'])
+    mediator_env.PrependUnique(LIBS=['mbedtls', 'mbedx509', 'mbedcrypto'])
 
-mediator_env.PrependUnique(LIBS = ['ESMediatorRich', 'oc', 'octbstack', 'oc_logger', 'connectivity_abstraction'])
+mediator_env.PrependUnique(LIBS=[
+    'ESMediatorRich',
+    'oc',
+    'octbstack',
+    'oc_logger',
+    'connectivity_abstraction',
+])
 
 if env.get('SECURED') == '1':
-       mediator_env.PrependUnique(LIBS = ['ocpmapi', 'ocprovision'])
+    mediator_env.PrependUnique(LIBS=['ocpmapi', 'ocprovision'])
 
 mediator = mediator_env.Program('mediator', 'mediator.cpp')
 submediator = mediator_env.Program('submediator', 'submediator.cpp')
 
-i_mediator = mediator_env.Install(env.get('BUILD_DIR'), [mediator, submediator])
-
-clientdat = mediator_env.Install(env.get('BUILD_DIR') + '/service/easy-setup/sampleapp/mediator/linux/richsdk_sample',
-                                    env.get('SRC_DIR') + '/service/easy-setup/sampleapp/mediator/linux/richsdk_sample/oic_svr_db_client.dat')
-
-subclientdat = mediator_env.Install(env.get('BUILD_DIR') + '/service/easy-setup/sampleapp/mediator/linux/richsdk_sample',
-                                    env.get('SRC_DIR') + '/service/easy-setup/sampleapp/mediator/linux/richsdk_sample/oic_svr_db_subclient.dat')
-
+i_mediator = mediator_env.Install(
+    env.get('BUILD_DIR'), [mediator, submediator])
+
+clientdat = mediator_env.Install(
+    env.get('BUILD_DIR') +
+    '/service/easy-setup/sampleapp/mediator/linux/richsdk_sample',
+    env.get('SRC_DIR') +
+    '/service/easy-setup/sampleapp/mediator/linux/richsdk_sample/oic_svr_db_client.dat'
+)
+
+subclientdat = mediator_env.Install(
+    env.get('BUILD_DIR') +
+    '/service/easy-setup/sampleapp/mediator/linux/richsdk_sample',
+    env.get('SRC_DIR') +
+    '/service/easy-setup/sampleapp/mediator/linux/richsdk_sample/oic_svr_db_subclient.dat'
+)
 
 Alias('mediator_rich', [i_mediator, clientdat, subclientdat])
 env.AppendTarget('mediator_rich')
index d6d0fdf..4c369dc 100644 (file)
@@ -26,124 +26,147 @@ import platform
 Import('env')
 
 if env.get('RELEASE'):
-       env.AppendUnique(CCFLAGS = ['-Os'])
-       env.AppendUnique(CPPDEFINES = ['NDEBUG'])
+    env.AppendUnique(CCFLAGS=['-Os'])
+    env.AppendUnique(CPPDEFINES=['NDEBUG'])
 else:
-       env.AppendUnique(CCFLAGS = ['-g'])
+    env.AppendUnique(CCFLAGS=['-g'])
 
 if env.get('LOGGING'):
-       env.AppendUnique(CPPDEFINES = ['TB_LOG'])
+    env.AppendUnique(CPPDEFINES=['TB_LOG'])
 
 lib_env = env.Clone()
 SConscript(env.get('SRC_DIR') + '/service/third_party_libs.scons', 'lib_env')
 notification_env = lib_env.Clone()
 
 target_os = env.get('TARGET_OS')
+
 ######################################################################
 # Build flags
 ######################################################################
-notification_env.AppendUnique(CPPPATH = ['include'])
-notification_env.AppendUnique(CPPPATH = ['src/common'])
-notification_env.AppendUnique(CPPPATH = ['src/provider'])
-notification_env.AppendUnique(CPPPATH = ['src/consumer'])
-notification_env.AppendUnique(CPPPATH = ['#/resource/csdk/include'])
-notification_env.AppendUnique(CPPPATH = ['#/resource/csdk/security/include'])
-notification_env.AppendUnique(CPPPATH = ['#/resource/csdk/stack/include'])
-notification_env.AppendUnique(CPPPATH = ['#/resource/csdk/resource-directory/include'])
-notification_env.AppendUnique(CPPPATH = ['#/resource/csdk/connectivity/api'])
-
-notification_env.PrependUnique(LIBS = [
-       'octbstack',
-       'oc_logger',
-       'connectivity_abstraction',
-       'libcoap',
-       'resource_directory'
-       ])
+
+notification_env.AppendUnique(CPPPATH=[
+    'include',
+    'src/common',
+    'src/provider',
+    'src/consumer',
+    '#/resource/csdk/include',
+    '#/resource/csdk/security/include',
+    '#/resource/csdk/stack/include',
+    '#/resource/csdk/resource-directory/include',
+    '#/resource/csdk/connectivity/api',
+])
+
+notification_env.PrependUnique(LIBS=[
+    'octbstack',
+    'oc_logger',
+    'connectivity_abstraction',
+    'libcoap',
+    'resource_directory'
+])
 
 if target_os not in ['windows', 'winrt']:
-       notification_env.AppendUnique(CCFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0'])
+    notification_env.AppendUnique(
+        CCFLAGS=['-O2', '-g', '-Wall', '-fmessage-length=0'])
 
 if target_os not in ['darwin', 'ios', 'windows', 'winrt']:
-       notification_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
+    notification_env.AppendUnique(LINKFLAGS=['-Wl,--no-undefined'])
 
 if target_os == 'linux':
-       notification_env.AppendUnique(LIBS = ['pthread'])
-       if not env.get('RELEASE'):
-               notification_env.PrependUnique(LIBS = ['gcov'])
-               notification_env.AppendUnique(CCFLAGS = ['--coverage'])
+    notification_env.AppendUnique(LIBS=['pthread'])
+    if not env.get('RELEASE'):
+        notification_env.PrependUnique(LIBS=['gcov'])
+        notification_env.AppendUnique(CCFLAGS=['--coverage'])
 
 if target_os == 'android':
-       notification_env.AppendUnique(CCFLAGS = ['-frtti', '-fexceptions'])
-       notification_env.AppendUnique(LIBS = ['gnustl_shared','log'])
+    notification_env.AppendUnique(CCFLAGS=['-frtti', '-fexceptions'])
+    notification_env.AppendUnique(LIBS=['gnustl_shared', 'log'])
 
-       if not env.get('RELEASE'):
-               notification_env.AppendUnique(LIBS = ['log'])
+    if not env.get('RELEASE'):
+        notification_env.AppendUnique(LIBS=['log'])
 
 if target_os == 'tizen':
-       notification_env.AppendUnique(CPPDEFINES = ['__TIZEN__'])
-       # notification_env.ParseConfig('pkg-config --cflags --libs sqlite3')
+    notification_env.AppendUnique(CPPDEFINES=['__TIZEN__'])
+    # notification_env.ParseConfig('pkg-config --cflags --libs sqlite3')
 
 if env.get('WITH_CLOUD') == True:
-       notification_env.AppendUnique(CPPDEFINES = ['WITH_CLOUD'])
+    notification_env.AppendUnique(CPPDEFINES=['WITH_CLOUD'])
 
 if env.get('SECURED') == '1':
-       notification_env.AppendUnique(CPPDEFINES = ['SECURED'])
-       
+    notification_env.AppendUnique(CPPDEFINES=['SECURED'])
+
 with_mq = env.get('WITH_MQ')
 if 'SUB' in with_mq:
-    notification_env.AppendUnique(CPPDEFINES = ['MQ_SUBSCRIBER', 'WITH_MQ'])
+    notification_env.AppendUnique(CPPDEFINES=['MQ_SUBSCRIBER', 'WITH_MQ'])
     print "MQ SUB support"
 
 if 'PUB' in with_mq:
-    notification_env.AppendUnique(CPPDEFINES = ['MQ_PUBLISHER', 'WITH_MQ'])
+    notification_env.AppendUnique(CPPDEFINES=['MQ_PUBLISHER', 'WITH_MQ'])
     print "MQ PUB support"
 
 if 'BROKER' in with_mq:
-    notification_env.AppendUnique(CPPDEFINES = ['MQ_BROKER', 'WITH_MQ'])
+    notification_env.AppendUnique(CPPDEFINES=['MQ_BROKER', 'WITH_MQ'])
     print "MQ Broker support"
 
-
 ######################################################################
 # Source files and Targets
 ######################################################################
+
 notification_provider_env = notification_env.Clone()
 notification_consumer_env = notification_env.Clone()
 
 if target_os == 'android':
-       notification_provider_env.AppendUnique(LINKFLAGS = ['-Wl,-soname,libnotification_provider.so'])
+    notification_provider_env.AppendUnique(
+        LINKFLAGS=['-Wl,-soname,libnotification_provider.so'])
 if target_os == 'android':
-       notification_consumer_env.AppendUnique(LINKFLAGS = ['-Wl,-soname,libnotification_consumer.so'])
+    notification_consumer_env.AppendUnique(
+        LINKFLAGS=['-Wl,-soname,libnotification_consumer.so'])
 
-notification_common_obj = notification_provider_env.SharedObject(env.Glob('src/common/*.c'))
+notification_common_obj = notification_provider_env.SharedObject(
+    env.Glob('src/common/*.c'))
 
 notification_provider_src = [
-       env.Glob('src/provider/*.c'), notification_common_obj]
+    env.Glob('src/provider/*.c'),
+    notification_common_obj
+]
 notification_consumer_src = [
-       env.Glob('src/consumer/*.c'), notification_common_obj]
+    env.Glob('src/consumer/*.c'),
+    notification_common_obj
+]
 
 if target_os not in ['ios']:
-       providersdk = notification_provider_env.SharedLibrary('notification_provider', notification_provider_src)
-       notification_provider_env.InstallTarget(providersdk, 'libnotification_provider')
-       notification_provider_env.UserInstallTargetLib(providersdk, 'libnotification_provider')
-       consumersdk = notification_consumer_env.SharedLibrary('notification_consumer', notification_consumer_src)
-       notification_consumer_env.InstallTarget(consumersdk, 'libnotification_consumer')
-       notification_consumer_env.UserInstallTargetLib(consumersdk, 'libnotification_consumer')
-
-providersdk = notification_provider_env.StaticLibrary('notification_provider', notification_provider_src)
-notification_provider_env.InstallTarget(providersdk, 'libnotification_provider')
-notification_provider_env.UserInstallTargetLib(providersdk, 'libnotification_provider')
-
-consumersdk = notification_consumer_env.StaticLibrary('notification_consumer', notification_consumer_src)
-notification_consumer_env.InstallTarget(consumersdk, 'libnotification_consumer')
-notification_consumer_env.UserInstallTargetLib(consumersdk, 'libnotification_consumer')
-
-notification_provider_env.UserInstallTargetHeader('include/NSProviderInterface.h',\
-       'service/notification', 'NSProviderInterface.h')
-notification_consumer_env.UserInstallTargetHeader('include/NSConsumerInterface.h',\
-       'service/notification', 'NSConsumerInterface.h')
-notification_consumer_env.UserInstallTargetHeader('include/NSCommon.h',\
-       'service/notification', 'NSCommon.h')
-
+    providersdk = notification_provider_env.SharedLibrary(
+        'notification_provider', notification_provider_src)
+    notification_provider_env.InstallTarget(
+        providersdk, 'libnotification_provider')
+    notification_provider_env.UserInstallTargetLib(
+        providersdk, 'libnotification_provider')
+    consumersdk = notification_consumer_env.SharedLibrary(
+        'notification_consumer', notification_consumer_src)
+    notification_consumer_env.InstallTarget(
+        consumersdk, 'libnotification_consumer')
+    notification_consumer_env.UserInstallTargetLib(
+        consumersdk, 'libnotification_consumer')
+
+providersdk = notification_provider_env.StaticLibrary(
+    'notification_provider', notification_provider_src)
+notification_provider_env.InstallTarget(
+    providersdk, 'libnotification_provider')
+notification_provider_env.UserInstallTargetLib(
+    providersdk, 'libnotification_provider')
+
+consumersdk = notification_consumer_env.StaticLibrary(
+    'notification_consumer', notification_consumer_src)
+notification_consumer_env.InstallTarget(
+    consumersdk, 'libnotification_consumer')
+notification_consumer_env.UserInstallTargetLib(
+    consumersdk, 'libnotification_consumer')
+
+notification_provider_env.UserInstallTargetHeader(
+    'include/NSProviderInterface.h', 'service/notification', 'NSProviderInterface.h')
+notification_consumer_env.UserInstallTargetHeader(
+    'include/NSConsumerInterface.h', 'service/notification', 'NSConsumerInterface.h')
+notification_consumer_env.UserInstallTargetHeader(
+    'include/NSCommon.h', 'service/notification', 'NSCommon.h')
 
 # Go to build Unit test
 if target_os in ['linux']:
index 531db6f..e392edb 100644 (file)
@@ -6,14 +6,16 @@ android_home = env.get('ANDROID_HOME')
 
 ANDROID_TARGET_ARCH = env.get('TARGET_ARCH')
 if env.get('RELEASE'):
-       ANDROID_RELEASE="release"
+    ANDROID_RELEASE = "release"
 else:
-       ANDROID_RELEASE="debug"
+    ANDROID_RELEASE = "debug"
 
 os.environ['ANDROID_HOME'] = env.get('ANDROID_HOME')
 os.environ['ANDROID_NDK_HOME'] = env.get('ANDROID_NDK')
 
-if not os.path.exists(android_home + '/platforms/android-21') or not os.path.exists(android_home + '/build-tools/20.0.0'):
+if not os.path.exists(android_home +
+                      '/platforms/android-21') or not os.path.exists(
+                          android_home + '/build-tools/20.0.0'):
     print '''
 ***************************************** Info ********************************
 *   Either 'Android API 21' is not installed or 'Android SDK Build Tools      *
@@ -44,22 +46,31 @@ if not os.path.exists(android_home + '/platforms/android-21') or not os.path.exi
 
 
 def ensure_libs(target, source, env):
-    return target, [source, env.get('BUILD_DIR') + 'liboc.so',
-                            env.get('BUILD_DIR') + 'liboc_logger.so',
-                            env.get('BUILD_DIR') + 'libnotification_provider_wrapper.so',
-                            env.get('BUILD_DIR') + 'libnotification_consumer_wrapper.so']
+    return target, [
+        source,
+        env.get('BUILD_DIR') + 'liboc.so',
+        env.get('BUILD_DIR') + 'liboc_logger.so',
+        env.get('BUILD_DIR') + 'libnotification_provider_wrapper.so',
+        env.get('BUILD_DIR') + 'libnotification_consumer_wrapper.so'
+    ]
 
 
 jdk_env = Environment(ENV=os.environ)
-jdk_env['BUILDERS']['Gradle'] = Builder(action = env.get('ANDROID_GRADLE') + 
-    ' build -bservice/notification/android/build.gradle -PTARGET_ARCH=%s -PRELEASE=%s --stacktrace' %(ANDROID_TARGET_ARCH, ANDROID_RELEASE),
-    emitter = ensure_libs)
+jdk_env['BUILDERS']['Gradle'] = Builder(
+    action=env.get('ANDROID_GRADLE') +
+    ' build -bservice/notification/android/build.gradle -PTARGET_ARCH=%s -PRELEASE=%s --stacktrace'
+    % (ANDROID_TARGET_ARCH, ANDROID_RELEASE),
+    emitter=ensure_libs)
 jdk_env['BUILD_DIR'] = env.get('BUILD_DIR')
-cmdBuildNotification = jdk_env.Gradle(target="notification-service/objs",
-    source="notification-service/src/main/java/org/iotivity/service/ns/consumer/ConsumerService.java")
+cmdBuildNotification = jdk_env.Gradle(
+    target="notification-service/objs",
+    source=
+    "notification-service/src/main/java/org/iotivity/service/ns/consumer/ConsumerService.java"
+)
 jdk_env.Clean(cmdBuildNotification, '#/service/notification/android/build')
-jdk_env.Clean(cmdBuildNotification, '#/service/notification/android/notification-service/build')
+jdk_env.Clean(cmdBuildNotification,
+              '#/service/notification/android/notification-service/build')
 
 Depends(cmdBuildNotification, env.get('baseAAR'))
 
-env.AppendUnique(notificationAAR = cmdBuildNotification)
+env.AppendUnique(notificationAAR=cmdBuildNotification)
index e6455da..daea5c6 100644 (file)
 Import('env')
 target_os = env.get('TARGET_OS')
 
-SConscript('common/SConscript')
-
-# build producer notification wrapper
-SConscript('provider/SConscript')
-
-# build producer notification wrapper
-SConscript('consumer/SConscript')
+SConscript(dirs=[
+    'common',
+    'provider',  # build producer notification wrapper
+    'consumer',  # build producer notification wrapper
+])
 
 # Go to build sample apps using wrapper
 if target_os == 'linux':
index 914f2cb..afe4a30 100644 (file)
@@ -29,7 +29,13 @@ lib_env = env.Clone()
 SConscript('#service/third_party_libs.scons', 'lib_env')
 notification_env = lib_env.Clone()
 
-list = [ "NSMessage.h", "NSSyncInfo.h", "NSTopicsList.h", "NSUtils.h"]
+list = [
+    "NSMessage.h",
+    "NSSyncInfo.h",
+    "NSTopicsList.h",
+    "NSUtils.h"
+]
 
 for filename in list:
-    notification_env.UserInstallTargetHeader(filename , 'service/notification', filename)
+    notification_env.UserInstallTargetHeader(
+        filename, 'service/notification', filename)
index 67186ea..134eb17 100644 (file)
@@ -26,13 +26,13 @@ import platform
 Import('env')
 
 if env.get('RELEASE'):
-       env.AppendUnique(CCFLAGS = ['-Os'])
-       env.AppendUnique(CPPDEFINES = ['NDEBUG'])
+    env.AppendUnique(CCFLAGS=['-Os'])
+    env.AppendUnique(CPPDEFINES=['NDEBUG'])
 else:
-       env.AppendUnique(CCFLAGS = ['-g'])
+    env.AppendUnique(CCFLAGS=['-g'])
 
 if env.get('LOGGING'):
-       env.AppendUnique(CPPDEFINES = ['TB_LOG'])
+    env.AppendUnique(CPPDEFINES=['TB_LOG'])
 
 lib_env = env.Clone()
 SConscript(env.get('SRC_DIR') + '/service/third_party_libs.scons', 'lib_env')
@@ -43,7 +43,7 @@ target_os = env.get('TARGET_OS')
 ######################################################################
 # Build flags
 ######################################################################
-notification_env.AppendUnique(CPPPATH = [
+notification_env.AppendUnique(CPPPATH=[
     '../../include',
     'inc',
     '../common',
@@ -56,46 +56,48 @@ notification_env.AppendUnique(CPPPATH = [
     '#/resource/oc_logger/include'
 ])
 
-notification_env.PrependUnique(LIBS = [
-       'oc_logger',
-       'oc',
-       'notification_consumer'
-       ])
+notification_env.PrependUnique(LIBS=[
+    'oc_logger',
+    'oc',
+    'notification_consumer',
+])
 
-notification_env.AppendUnique(CXXFLAGS = ['-std=c++0x','-frtti'])
+notification_env.AppendUnique(CXXFLAGS=['-std=c++0x', '-frtti'])
 
 if target_os not in ['windows', 'winrt']:
-       notification_env.AppendUnique(CCFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0'])
+    notification_env.AppendUnique(
+        CCFLAGS=['-O2', '-g', '-Wall', '-fmessage-length=0'])
 
 if target_os not in ['darwin', 'ios', 'windows', 'winrt']:
-       notification_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
+    notification_env.AppendUnique(LINKFLAGS=['-Wl,--no-undefined'])
 
 if target_os == 'linux':
-       notification_env.AppendUnique(LIBS = ['pthread'])
-       
+    notification_env.AppendUnique(LIBS=['pthread'])
+
 if target_os == 'android':
-    notification_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
-    notification_env.PrependUnique(LIBS = ['gnustl_shared', 'log'])
-    notification_env.AppendUnique(LINKFLAGS = ['-Wl,-soname,libnotification_consumer_wrapper.so'])
+    notification_env.AppendUnique(CXXFLAGS=['-frtti', '-fexceptions'])
+    notification_env.PrependUnique(LIBS=['gnustl_shared', 'log'])
+    notification_env.AppendUnique(
+        LINKFLAGS=['-Wl,-soname,libnotification_consumer_wrapper.so'])
 
 if not env.get('RELEASE') and target_os not in ['ios']:
-    notification_env.PrependUnique(LIBS = ['gcov'])
-    notification_env.AppendUnique(CCFLAGS = ['--coverage'])
+    notification_env.PrependUnique(LIBS=['gcov'])
+    notification_env.AppendUnique(CCFLAGS=['--coverage'])
 
 if env.get('WITH_CLOUD') == True:
-       notification_env.AppendUnique(CPPDEFINES = ['WITH_CLOUD'])
+    notification_env.AppendUnique(CPPDEFINES=['WITH_CLOUD'])
 
 with_mq = env.get('WITH_MQ')
 if 'SUB' in with_mq:
-    notification_env.AppendUnique(CPPDEFINES = ['MQ_SUBSCRIBER', 'WITH_MQ'])
+    notification_env.AppendUnique(CPPDEFINES=['MQ_SUBSCRIBER', 'WITH_MQ'])
     print "MQ SUB support"
 
 if 'PUB' in with_mq:
-    notification_env.AppendUnique(CPPDEFINES = ['MQ_PUBLISHER', 'WITH_MQ'])
+    notification_env.AppendUnique(CPPDEFINES=['MQ_PUBLISHER', 'WITH_MQ'])
     print "MQ PUB support"
 
 if 'BROKER' in with_mq:
-    notification_env.AppendUnique(CPPDEFINES = ['MQ_BROKER', 'WITH_MQ'])
+    notification_env.AppendUnique(CPPDEFINES=['MQ_BROKER', 'WITH_MQ'])
     print "MQ Broker support"
 ######################################################################
 # Source files and Targets for Consumer
@@ -106,44 +108,60 @@ Import('notificationCommonStaticObjs')
 Import('notificationCommonSharedObjs')
 
 notification_consumer_src = [
-       env.Glob('src/*.cpp'),notificationCommonSharedObjs]
+    env.Glob('src/*.cpp'), notificationCommonSharedObjs
+]
 
 if target_os in ['android']:
-    notification_env.AppendUnique(LINKFLAGS = ['-Wl,-soname,libnotification_consumer_wrapper.so'])
+    notification_env.AppendUnique(
+        LINKFLAGS=['-Wl,-soname,libnotification_consumer_wrapper.so'])
 if target_os not in ['ios']:
-       consumersdk = notification_env.SharedLibrary('notification_consumer_wrapper', notification_consumer_src)
-       notification_env.InstallTarget(consumersdk, 'libnotification_consumer_wrapper')
-       notification_env.UserInstallTargetLib(consumersdk, 'libnotification_consumer_wrapper')
+    consumersdk = notification_env.SharedLibrary(
+        'notification_consumer_wrapper', notification_consumer_src)
+    notification_env.InstallTarget(consumersdk,
+                                   'libnotification_consumer_wrapper')
+    notification_env.UserInstallTargetLib(consumersdk,
+                                          'libnotification_consumer_wrapper')
 
 notification_consumer_src = [
-       env.Glob('src/*.cpp'),notificationCommonStaticObjs]
+    env.Glob('src/*.cpp'), notificationCommonStaticObjs
+]
 
-consumersdk = notification_env.StaticLibrary('notification_consumer_wrapper', notification_consumer_src)
+consumersdk = notification_env.StaticLibrary(
+    'notification_consumer_wrapper', notification_consumer_src)
 notification_env.InstallTarget(consumersdk, 'libnotification_consumer_wrapper')
-notification_env.UserInstallTargetLib(consumersdk, 'libnotification_consumer_wrapper')
+notification_env.UserInstallTargetLib(
+    consumersdk, 'libnotification_consumer_wrapper')
 
-notification_env.UserInstallTargetHeader("inc/NSProvider.h", 'service/notification', 'NSProvider.h')
-notification_env.UserInstallTargetHeader("inc/NSConsumerService.h", 'service/notification', 'NSConsumerService.h')
+notification_env.UserInstallTargetHeader(
+    "inc/NSProvider.h", 'service/notification', 'NSProvider.h')
+notification_env.UserInstallTargetHeader(
+    "inc/NSConsumerService.h", 'service/notification', 'NSConsumerService.h')
 
 ######################################################################
 # Source files and Targets for Consumer Jni
 ######################################################################
 if target_os == 'android':
-       Import('notificationJniCommonSharedObjs')
-
-       notification_jni_consumer_env.AppendUnique(CPPPATH = ['../../../../extlibs/boost/boost_1_58_0'])
-       notification_jni_consumer_env.AppendUnique(CPPPATH = ['../../../../java/jni'])
-       notification_jni_consumer_env.AppendUnique(CPPPATH = ['../../android/notification-service/src/main/jni/common'])
-       notification_jni_consumer_env.AppendUnique(CPPPATH = ['../../android/notification-service/src/main/jni/consumer'])
-
-       notification_jni_consumer_env.PrependUnique(LIBS = [
-               'notification_consumer_wrapper'
-               ])
-
-       notification_consumer_jni_src = [
-               env.Glob('../../android/notification-service/src/main/jni/consumer/*.cpp'),
-               notificationJniCommonSharedObjs]
-
-       consumerJni = notification_jni_consumer_env.SharedLibrary('notification_consumer_jni', notification_consumer_jni_src)
-       notification_jni_consumer_env.InstallTarget(consumerJni, 'libnotification_consumer_jni')
-       notification_jni_consumer_env.UserInstallTargetLib(consumerJni, 'libnotification_consumer_jni')
+    Import('notificationJniCommonSharedObjs')
+
+    notification_jni_consumer_env.AppendUnique(CPPPATH=[
+        '../../../../extlibs/boost/boost_1_58_0',
+        '../../../../java/jni',
+        '../../android/notification-service/src/main/jni/common',
+        '../../android/notification-service/src/main/jni/consumer'
+    ])
+
+    notification_jni_consumer_env.PrependUnique(
+        LIBS=['notification_consumer_wrapper'])
+
+    notification_consumer_jni_src = [
+        env.Glob(
+            '../../android/notification-service/src/main/jni/consumer/*.cpp'),
+        notificationJniCommonSharedObjs
+    ]
+
+    consumerJni = notification_jni_consumer_env.SharedLibrary(
+        'notification_consumer_jni', notification_consumer_jni_src)
+    notification_jni_consumer_env.InstallTarget(consumerJni,
+                                                'libnotification_consumer_jni')
+    notification_jni_consumer_env.UserInstallTargetLib(
+        consumerJni, 'libnotification_consumer_jni')
index a217447..ea2129f 100644 (file)
@@ -32,7 +32,7 @@ target_os = env.get('TARGET_OS')
 ######################################################################
 # Build flags
 ######################################################################
-notification_sample_env.AppendUnique(CPPPATH = [
+notification_sample_env.AppendUnique(CPPPATH=[
     '../../../include',
     '../../provider/inc',
     '../../consumer/inc',
@@ -43,68 +43,78 @@ notification_sample_env.AppendUnique(CPPPATH = [
     '#/resource/include',
     '#/resource/oc_logger/include'
     '../../../src/common'
-    ])
+])
 
-notification_sample_env.PrependUnique(LIBS = [
+notification_sample_env.PrependUnique(LIBS=[
     'resource_directory',
     'oc',
     'liboctbstack',
     'oc_logger',
     'connectivity_abstraction',
     'libcoap',
-    ])
+])
 
-notification_sample_env.AppendUnique(CXXFLAGS = ['-std=c++0x','-frtti'])
+notification_sample_env.AppendUnique(CXXFLAGS=['-std=c++0x', '-frtti'])
 if target_os not in ['windows', 'winrt']:
-    notification_sample_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0'])
+    notification_sample_env.AppendUnique(
+        CXXFLAGS=['-O2', '-g', '-Wall', '-fmessage-length=0'])
 
 if target_os not in ['darwin', 'ios', 'windows', 'winrt']:
-    notification_sample_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
+    notification_sample_env.AppendUnique(LINKFLAGS=['-Wl,--no-undefined'])
 
 if target_os == 'linux':
-    notification_sample_env.AppendUnique(LIBS = ['pthread'])
+    notification_sample_env.AppendUnique(LIBS=['pthread'])
 
 if target_os == 'android':
-    notification_sample_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
-    notification_sample_env.AppendUnique(LIBS = ['gnustl_shared','log'])
+    notification_sample_env.AppendUnique(CXXFLAGS=['-frtti', '-fexceptions'])
+    notification_sample_env.AppendUnique(LIBS=['gnustl_shared', 'log'])
 
 if not env.get('RELEASE'):
-    notification_sample_env.PrependUnique(LIBS = ['gcov'])
-    notification_sample_env.AppendUnique(CCFLAGS = ['--coverage'])
+    notification_sample_env.PrependUnique(LIBS=['gcov'])
+    notification_sample_env.AppendUnique(CCFLAGS=['--coverage'])
 
 if env.get('WITH_CLOUD') == True:
-    notification_sample_env.AppendUnique(CPPDEFINES = ['WITH_CLOUD'])
+    notification_sample_env.AppendUnique(CPPDEFINES=['WITH_CLOUD'])
 
 with_mq = env.get('WITH_MQ')
 if 'SUB' in with_mq:
-    notification_sample_env.AppendUnique(CPPDEFINES = ['MQ_SUBSCRIBER', 'WITH_MQ'])
+    notification_sample_env.AppendUnique(
+        CPPDEFINES=['MQ_SUBSCRIBER', 'WITH_MQ'])
     print "MQ SUB support"
 
 if 'PUB' in with_mq:
-    notification_sample_env.AppendUnique(CPPDEFINES = ['MQ_PUBLISHER', 'WITH_MQ'])
+    notification_sample_env.AppendUnique(
+        CPPDEFINES=['MQ_PUBLISHER', 'WITH_MQ'])
     print "MQ PUB support"
 
 if 'BROKER' in with_mq:
-    notification_sample_env.AppendUnique(CPPDEFINES = ['MQ_BROKER', 'WITH_MQ'])
+    notification_sample_env.AppendUnique(CPPDEFINES=['MQ_BROKER', 'WITH_MQ'])
     print "MQ Broker support"
 
 if env.get('WITH_TCP') == True:
-    notification_sample_env.AppendUnique(CPPDEFINES = ['WITH_TCP'])
+    notification_sample_env.AppendUnique(CPPDEFINES=['WITH_TCP'])
 if env.get('SECURED') == '1':
-    notification_sample_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509', 'mbedcrypto'])
+    notification_sample_env.AppendUnique(
+        LIBS=['mbedtls', 'mbedx509', 'mbedcrypto'])
 
 ####################################################################
 # Source files and Targets
 ######################################################################
 notification_sample_provider_env = notification_sample_env.Clone()
 
-notification_sample_provider_env.AppendUnique(LIBS = 'libnotification_provider_wrapper')
-notification_sample_provider_env.AppendUnique(LIBS = 'libnotification_provider')
-notificationproviderwrapper = notification_sample_provider_env.Program('notificationproviderwrapper', 'notificationserviceprovider.cpp')
-i_notificationprovider = notification_sample_provider_env.Install(env.get('BUILD_DIR'), notificationproviderwrapper)
+notification_sample_provider_env.AppendUnique(
+    LIBS='libnotification_provider_wrapper')
+notification_sample_provider_env.AppendUnique(LIBS='libnotification_provider')
+notificationproviderwrapper = notification_sample_provider_env.Program(
+    'notificationproviderwrapper', 'notificationserviceprovider.cpp')
+i_notificationprovider = notification_sample_provider_env.Install(
+    env.get('BUILD_DIR'), notificationproviderwrapper)
 
 notification_sample_consumer_env = notification_sample_env.Clone()
-notification_sample_consumer_env.AppendUnique(LIBS = 'libnotification_consumer_wrapper')
-notification_sample_consumer_env.AppendUnique(LIBS = 'libnotification_consumer')
-notificationconsumerwrapper = notification_sample_consumer_env.Program('notificationconsumerwrapper', 'notificationserviceconsumer.cpp')
-i_notificationconsumer = notification_sample_consumer_env.Install(env.get('BUILD_DIR'), notificationconsumerwrapper)
+notification_sample_consumer_env.AppendUnique(
+    LIBS='libnotification_consumer_wrapper')
+notification_sample_consumer_env.AppendUnique(LIBS='libnotification_consumer')
+notificationconsumerwrapper = notification_sample_consumer_env.Program(
+    'notificationconsumerwrapper', 'notificationserviceconsumer.cpp')
+i_notificationconsumer = notification_sample_consumer_env.Install(
+    env.get('BUILD_DIR'), notificationconsumerwrapper)
index 35b2fbf..c42e4b0 100644 (file)
@@ -26,13 +26,13 @@ import platform
 Import('env')
 
 if env.get('RELEASE'):
-    env.AppendUnique(CCFLAGS = ['-Os'])
-    env.AppendUnique(CPPDEFINES = ['NDEBUG'])
+    env.AppendUnique(CCFLAGS=['-Os'])
+    env.AppendUnique(CPPDEFINES=['NDEBUG'])
 else:
-    env.AppendUnique(CCFLAGS = ['-g'])
+    env.AppendUnique(CCFLAGS=['-g'])
 
 if env.get('LOGGING'):
-    env.AppendUnique(CPPDEFINES = ['TB_LOG'])
+    env.AppendUnique(CPPDEFINES=['TB_LOG'])
 
 lib_env = env.Clone()
 SConscript(env.get('SRC_DIR') + '/service/third_party_libs.scons', 'lib_env')
@@ -43,7 +43,7 @@ target_os = env.get('TARGET_OS')
 ######################################################################
 # Build flags
 ######################################################################
-notification_env.AppendUnique(CPPPATH = [
+notification_env.AppendUnique(CPPPATH=[
     '../../include',
     'inc',
     '../common',
@@ -56,47 +56,49 @@ notification_env.AppendUnique(CPPPATH = [
     '#/resource/oc_logger/include'
 ])
 
-notification_env.PrependUnique(LIBS = [
+notification_env.PrependUnique(LIBS=[
     'oc_logger',
     'oc',
     'octbstack',
     'notification_provider',
     'resource_directory'
-    ])
-notification_env.AppendUnique(CXXFLAGS = ['-std=c++0x','-frtti'])
+])
+notification_env.AppendUnique(CXXFLAGS=['-std=c++0x', '-frtti'])
 
 if target_os not in ['windows', 'winrt']:
-    notification_env.AppendUnique(CCFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0'])
+    notification_env.AppendUnique(
+        CCFLAGS=['-O2', '-g', '-Wall', '-fmessage-length=0'])
 
 if target_os not in ['darwin', 'ios', 'windows', 'winrt']:
-    notification_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
+    notification_env.AppendUnique(LINKFLAGS=['-Wl,--no-undefined'])
 
 if target_os == 'linux':
-    notification_env.AppendUnique(LIBS = ['pthread'])
-    
+    notification_env.AppendUnique(LIBS=['pthread'])
+
 if target_os == 'android':
-    notification_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
-    notification_env.PrependUnique(LIBS = ['gnustl_shared', 'log'])
-    notification_env.AppendUnique(LINKFLAGS = ['-Wl,-soname,libnotification_provider_wrapper.so'])
+    notification_env.AppendUnique(CXXFLAGS=['-frtti', '-fexceptions'])
+    notification_env.PrependUnique(LIBS=['gnustl_shared', 'log'])
+    notification_env.AppendUnique(
+        LINKFLAGS=['-Wl,-soname,libnotification_provider_wrapper.so'])
 
 if not env.get('RELEASE') and target_os not in ['ios']:
-    notification_env.PrependUnique(LIBS = ['gcov'])
-    notification_env.AppendUnique(CCFLAGS = ['--coverage'])
+    notification_env.PrependUnique(LIBS=['gcov'])
+    notification_env.AppendUnique(CCFLAGS=['--coverage'])
 
 if env.get('WITH_CLOUD') == True:
-    notification_env.AppendUnique(CPPDEFINES = ['WITH_CLOUD'])
+    notification_env.AppendUnique(CPPDEFINES=['WITH_CLOUD'])
 
 with_mq = env.get('WITH_MQ')
 if 'SUB' in with_mq:
-    notification_env.AppendUnique(CPPDEFINES = ['MQ_SUBSCRIBER', 'WITH_MQ'])
+    notification_env.AppendUnique(CPPDEFINES=['MQ_SUBSCRIBER', 'WITH_MQ'])
     print "MQ SUB support"
 
 if 'PUB' in with_mq:
-    notification_env.AppendUnique(CPPDEFINES = ['MQ_PUBLISHER', 'WITH_MQ'])
+    notification_env.AppendUnique(CPPDEFINES=['MQ_PUBLISHER', 'WITH_MQ'])
     print "MQ PUB support"
 
 if 'BROKER' in with_mq:
-    notification_env.AppendUnique(CPPDEFINES = ['MQ_BROKER', 'WITH_MQ'])
+    notification_env.AppendUnique(CPPDEFINES=['MQ_BROKER', 'WITH_MQ'])
     print "MQ Broker support"
 ######################################################################
 # Source files and Targets for Provider
@@ -108,33 +110,45 @@ notificationCommonStaticObjs = [
     notification_env.Object('../common/NSMessage.cpp'),
     notification_env.Object('../common/NSSyncInfo.cpp'),
     notification_env.Object('../common/NSTopic.cpp'),
-    notification_env.Object('../common/NSTopicsList.cpp')]
+    notification_env.Object('../common/NSTopicsList.cpp')
+]
 
 notificationCommonSharedObjs = [
     notification_env.SharedObject('../common/NSMediaContents.cpp'),
     notification_env.SharedObject('../common/NSMessage.cpp'),
     notification_env.SharedObject('../common/NSSyncInfo.cpp'),
     notification_env.SharedObject('../common/NSTopic.cpp'),
-    notification_env.SharedObject('../common/NSTopicsList.cpp')]
+    notification_env.SharedObject('../common/NSTopicsList.cpp')
+]
 
 notification_provider_src = [
-    env.Glob('src/*.cpp'),notificationCommonSharedObjs]
+    env.Glob('src/*.cpp'), notificationCommonSharedObjs
+]
 
 if target_os in ['android']:
-    notification_env.AppendUnique(LINKFLAGS = ['-Wl,-soname,libnotification_provider_wrapper.so'])
+    notification_env.AppendUnique(
+        LINKFLAGS=['-Wl,-soname,libnotification_provider_wrapper.so'])
 if target_os not in ['ios']:
-    providersdk = notification_env.SharedLibrary('notification_provider_wrapper', notification_provider_src)
-    notification_env.InstallTarget(providersdk, 'libnotification_provider_wrapper')
-    notification_env.UserInstallTargetLib(providersdk, 'libnotification_provider_wrapper')
+    providersdk = notification_env.SharedLibrary(
+        'notification_provider_wrapper', notification_provider_src)
+    notification_env.InstallTarget(providersdk,
+                                   'libnotification_provider_wrapper')
+    notification_env.UserInstallTargetLib(providersdk,
+                                          'libnotification_provider_wrapper')
 
 notification_provider_src = [
-    env.Glob('src/*.cpp'),notificationCommonStaticObjs]
+    env.Glob('src/*.cpp'), notificationCommonStaticObjs
+]
 
-providersdk = notification_env.StaticLibrary('notification_provider_wrapper', notification_provider_src)
+providersdk = notification_env.StaticLibrary('notification_provider_wrapper',
+                                             notification_provider_src)
 notification_env.InstallTarget(providersdk, 'libnotification_provider_wrapper')
-notification_env.UserInstallTargetLib(providersdk, 'libnotification_provider_wrapper')
-notification_env.UserInstallTargetHeader('inc/NSConsumer.h', 'service/notification', 'NSConsumer.h')
-notification_env.UserInstallTargetHeader('inc/NSProviderService.h', 'service/notification', 'NSProviderService.h')
+notification_env.UserInstallTargetLib(providersdk,
+                                      'libnotification_provider_wrapper')
+notification_env.UserInstallTargetHeader(
+    'inc/NSConsumer.h', 'service/notification', 'NSConsumer.h')
+notification_env.UserInstallTargetHeader(
+    'inc/NSProviderService.h', 'service/notification', 'NSProviderService.h')
 
 Export('notificationCommonStaticObjs')
 Export('notificationCommonSharedObjs')
@@ -143,24 +157,33 @@ Export('notificationCommonSharedObjs')
 # Source files and Targets for Provider Jni
 ######################################################################
 if target_os == 'android':
-    notification_jni_provider_env.AppendUnique(CPPPATH = ['../../../../extlibs/boost/boost_1_58_0'])
-    notification_jni_provider_env.AppendUnique(CPPPATH = ['../../../../java/jni'])
-    notification_jni_provider_env.AppendUnique(CPPPATH = ['../../android/notification-service/src/main/jni/common'])
-    notification_jni_provider_env.AppendUnique(CPPPATH = ['../../android/notification-service/src/main/jni/provider'])
+    notification_jni_provider_env.AppendUnique(CPPPATH=[
+        '../../../../extlibs/boost/boost_1_58_0',
+        '../../../../java/jni',
+        '../../android/notification-service/src/main/jni/common',
+        '../../android/notification-service/src/main/jni/provider',
+    ])
 
-    notification_jni_provider_env.PrependUnique(LIBS = [
-        'notification_provider_wrapper'
-        ])
+    notification_jni_provider_env.PrependUnique(
+        LIBS=['notification_provider_wrapper'])
 
     notificationJniCommonSharedObjs = [
-        notification_jni_provider_env.SharedObject('../../android/notification-service/src/main/jni/common/JniNotificationCommon.cpp')]
+        notification_jni_provider_env.SharedObject(
+            '../../android/notification-service/src/main/jni/common/JniNotificationCommon.cpp'
+        )
+    ]
 
     notification_provider_jni_src = [
-        env.Glob('../../android/notification-service/src/main/jni/provider/*.cpp'),
-        notificationJniCommonSharedObjs]
-
-    providerJni = notification_jni_provider_env.SharedLibrary('notification_provider_jni', notification_provider_jni_src)
-    notification_jni_provider_env.InstallTarget(providerJni, 'libnotification_provider_jni')
-    notification_jni_provider_env.UserInstallTargetLib(providerJni, 'libnotification_provider_jni')
+        env.Glob(
+            '../../android/notification-service/src/main/jni/provider/*.cpp'),
+        notificationJniCommonSharedObjs
+    ]
+
+    providerJni = notification_jni_provider_env.SharedLibrary(
+        'notification_provider_jni', notification_provider_jni_src)
+    notification_jni_provider_env.InstallTarget(
+        providerJni, 'libnotification_provider_jni')
+    notification_jni_provider_env.UserInstallTargetLib(
+        providerJni, 'libnotification_provider_jni')
 
     Export('notificationJniCommonSharedObjs')
index a4e5363..9c21420 100644 (file)
 # Notification Unit Test build script
 ##
 
+from tools.scons.RunTest import run_test
+
 Import('env')
 
 if env.get('RELEASE'):
-       env.AppendUnique(CCFLAGS = ['-Os'])
-       env.AppendUnique(CPPDEFINES = ['NDEBUG'])
+    env.AppendUnique(CCFLAGS=['-Os'])
+    env.AppendUnique(CPPDEFINES=['NDEBUG'])
 else:
-       env.AppendUnique(CCFLAGS = ['-g'])
+    env.AppendUnique(CCFLAGS=['-g'])
 
 if env.get('LOGGING'):
-       env.AppendUnique(CPPDEFINES = ['TB_LOG'])
+    env.AppendUnique(CPPDEFINES=['TB_LOG'])
 
 gtest_env = SConscript('#extlibs/gtest/SConscript')
 lib_env = gtest_env.Clone()
@@ -48,25 +50,33 @@ target_os = env.get('TARGET_OS')
 # Build flags
 ######################################################################
 
-notification_wrapper_test_env.AppendUnique(LIBPATH = [lib_env.get('BUILD_DIR')])
-notification_wrapper_test_env.AppendUnique(LIBS = [
-    'connectivity_abstraction', 'oc', 'octbstack', 'oc_logger', 'coap', 'resource_directory'
+notification_wrapper_test_env.AppendUnique(LIBPATH=[lib_env.get('BUILD_DIR')])
+notification_wrapper_test_env.AppendUnique(LIBS=[
+    'connectivity_abstraction',
+    'oc',
+    'octbstack',
+    'oc_logger',
+    'coap',
+    'resource_directory',
+
 ])
 
 if env.get('WITH_TCP') == True:
-       notification_wrapper_test_env.AppendUnique(CPPDEFINES = ['WITH_TCP'])
+    notification_wrapper_test_env.AppendUnique(CPPDEFINES=['WITH_TCP'])
 if env.get('SECURED') == '1':
-       notification_wrapper_test_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509', 'mbedcrypto'])
+    notification_wrapper_test_env.AppendUnique(
+        LIBS=['mbedtls', 'mbedx509', 'mbedcrypto'])
 
 if target_os not in ['windows', 'winrt']:
-    notification_wrapper_test_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x'])
+    notification_wrapper_test_env.AppendUnique(
+        CXXFLAGS=['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x'])
 
-notification_wrapper_test_env.AppendUnique(LINKFLAGS = ['-Wl,--no-as-needed'])
+notification_wrapper_test_env.AppendUnique(LINKFLAGS=['-Wl,--no-as-needed'])
 
-notification_wrapper_test_env.AppendUnique(CXXFLAGS = ['-pthread'])
-notification_wrapper_test_env.AppendUnique(LIBS = ['pthread'])
+notification_wrapper_test_env.AppendUnique(CXXFLAGS=['-pthread'])
+notification_wrapper_test_env.AppendUnique(LIBS=['pthread'])
 
-notification_wrapper_test_env.PrependUnique(CPPPATH = [
+notification_wrapper_test_env.PrependUnique(CPPPATH=[
     '#/extlibs/hippomocks/hippomocks',
     '../provider/inc',
     '../consumer/inc',
@@ -85,41 +95,58 @@ notification_wrapper_test_env.PrependUnique(CPPPATH = [
 ######################################################################
 
 notification_consumer_wrapper_test_env = notification_wrapper_test_env.Clone()
-notification_consumer_wrapper_test_env.AppendUnique(LIBS = ['notification_consumer_wrapper','notification_consumer'])
+notification_consumer_wrapper_test_env.AppendUnique(
+    LIBS=['notification_consumer_wrapper', 'notification_consumer'])
 
 notification_provider_wrapper_test_env = notification_wrapper_test_env.Clone()
-notification_provider_wrapper_test_env.AppendUnique(LIBS = ['notification_provider_wrapper','notification_provider'])
-
-notification_consumer_wrapper_test_src = env.Glob('./NSConsumerServiceTest2.cpp')
-notification_consumer_wrapper_test = notification_consumer_wrapper_test_env.Program('notification_consumer_wrapper_test', notification_consumer_wrapper_test_src)
+notification_provider_wrapper_test_env.AppendUnique(
+    LIBS=['notification_provider_wrapper', 'notification_provider'])
+
+notification_consumer_wrapper_test_src = env.Glob(
+    './NSConsumerServiceTest2.cpp')
+notification_consumer_wrapper_test = notification_consumer_wrapper_test_env.Program(
+    'notification_consumer_wrapper_test',
+    notification_consumer_wrapper_test_src)
 Alias("notification_consumer_wrapper_test", notification_consumer_wrapper_test)
 env.AppendTarget('notification_consumer_wrapper_test')
 
-notification_consumer_wrapper_test_src = env.Glob('./NSConsumerServiceTest.cpp')
-notification_consumer_wrapper_internaltest = notification_consumer_wrapper_test_env.Program('notification_consumer_wrapper_internaltest', notification_consumer_wrapper_test_src)
-Alias("notification_consumer_wrapper_internaltest", notification_consumer_wrapper_internaltest)
+notification_consumer_wrapper_test_src = env.Glob(
+    './NSConsumerServiceTest.cpp')
+notification_consumer_wrapper_internaltest = notification_consumer_wrapper_test_env.Program(
+    'notification_consumer_wrapper_internaltest',
+    notification_consumer_wrapper_test_src)
+Alias("notification_consumer_wrapper_internaltest",
+      notification_consumer_wrapper_internaltest)
 env.AppendTarget('notification_consumer_wrapper_test')
 
-notification_provider_wrapper_test_src = env.Glob('./NSProviderServiceTest2.cpp')
-notification_provider_wrapper_test = notification_provider_wrapper_test_env.Program('notification_provider_wrapper_test', notification_provider_wrapper_test_src)
+notification_provider_wrapper_test_src = env.Glob(
+    './NSProviderServiceTest2.cpp')
+notification_provider_wrapper_test = notification_provider_wrapper_test_env.Program(
+    'notification_provider_wrapper_test',
+    notification_provider_wrapper_test_src)
 Alias("notification_provider_wrapper_test", notification_provider_wrapper_test)
 env.AppendTarget('notification_provider_wrapper_test')
 
-notification_provider_wrapper_test_src = env.Glob('./NSProviderServiceTest.cpp')
-notification_provider_wrapper_internaltest = notification_provider_wrapper_test_env.Program('notification_provider_wrapper_internaltest', notification_provider_wrapper_test_src)
-Alias("notification_provider_wrapper_internaltest", notification_provider_wrapper_internaltest)
+notification_provider_wrapper_test_src = env.Glob(
+    './NSProviderServiceTest.cpp')
+notification_provider_wrapper_internaltest = notification_provider_wrapper_test_env.Program(
+    'notification_provider_wrapper_internaltest',
+    notification_provider_wrapper_test_src)
+Alias("notification_provider_wrapper_internaltest",
+      notification_provider_wrapper_internaltest)
 env.AppendTarget('notification_provider_wrapper_test')
 
 # TODO: Fix this test for more configs and remove this commented line
 if env.get('TEST') == '1':
     if env.get('SECURED') != '1':
         if target_os in ['linux']:
-            from tools.scons.RunTest import *
-            run_test(notification_consumer_wrapper_test_env,
-                     'service_notification_cpp-wrapper_unittest_notification_consumer_wrapper_test.memcheck',
-                     'service/notification/cpp-wrapper/unittest/notification_consumer_wrapper_test',
-                     notification_consumer_wrapper_test)
-            run_test(notification_provider_wrapper_test_env,
-                     'service_notification_cpp-wrapper_unittest_notification_provider_wrapper_test.memcheck',
-                     'service/notification/cpp-wrapper/unittest/notification_provider_wrapper_test',
-                     notification_provider_wrapper_test)
+            run_test(
+                notification_consumer_wrapper_test_env,
+                'service_notification_cpp-wrapper_unittest_notification_consumer_wrapper_test.memcheck',
+                'service/notification/cpp-wrapper/unittest/notification_consumer_wrapper_test',
+                notification_consumer_wrapper_test)
+            run_test(
+                notification_provider_wrapper_test_env,
+                'service_notification_cpp-wrapper_unittest_notification_provider_wrapper_test.memcheck',
+                'service/notification/cpp-wrapper/unittest/notification_provider_wrapper_test',
+                notification_provider_wrapper_test)
index c51a751..35f2863 100644 (file)
@@ -5,6 +5,6 @@ Import('env')
 
 target_os = env.get('TARGET_OS')
 if target_os == 'linux':
-       SConscript('linux/SConscript')
+    SConscript('linux/SConscript')
 elif target_os == 'android':
-       SConscript('android/SConscript')
\ No newline at end of file
+    SConscript('android/SConscript')
index e147b90..c9e47f2 100644 (file)
@@ -26,14 +26,16 @@ android_home = env.get('ANDROID_HOME')
 
 ANDROID_TARGET_ARCH = env.get('TARGET_ARCH')
 if env.get('RELEASE'):
-       ANDROID_RELEASE="release"
+    ANDROID_RELEASE = "release"
 else:
-       ANDROID_RELEASE="debug"
+    ANDROID_RELEASE = "debug"
 
 os.environ['ANDROID_HOME'] = env.get('ANDROID_HOME')
 os.environ['ANDROID_NDK_HOME'] = env.get('ANDROID_NDK')
 
-if not os.path.exists(android_home + '/platforms/android-21') or not os.path.exists(android_home + '/build-tools/20.0.0'):
+if not os.path.exists(android_home +
+                      '/platforms/android-21') or not os.path.exists(
+                          android_home + '/build-tools/20.0.0'):
     print '''
 ***************************************** Info ********************************
 *   Either 'Android API 21' is not installed or 'Android SDK Build Tools      *
@@ -62,23 +64,36 @@ if not os.path.exists(android_home + '/platforms/android-21') or not os.path.exi
 '''
     os.system(android_home + '/tools/android')
 
+
 def ensure_libs(target, source, env):
-    return target, [source,
-                    env.get('BUILD_DIR') + 'libnotification_provider_jni.so',
-                    env.get('BUILD_DIR') + 'libnotification_provider_wrapper.so',
-                    env.get('BUILD_DIR') + 'libnotification_provider.so',
-                    env.get('BUILD_DIR') + 'libnotification_consumer_jni.so',
-                    env.get('BUILD_DIR') + 'libnotification_consumer_wrapper.so',
-                    env.get('BUILD_DIR') + 'libnotification_consumer.so']
+    return target, [
+        source,
+        env.get('BUILD_DIR') + 'libnotification_provider_jni.so',
+        env.get('BUILD_DIR') + 'libnotification_provider_wrapper.so',
+        env.get('BUILD_DIR') + 'libnotification_provider.so',
+        env.get('BUILD_DIR') + 'libnotification_consumer_jni.so',
+        env.get('BUILD_DIR') + 'libnotification_consumer_wrapper.so',
+        env.get('BUILD_DIR') + 'libnotification_consumer.so'
+    ]
+
 
 jdk_env = Environment(ENV=os.environ)
-jdk_env['BUILDERS']['Gradle'] = Builder(action = env.get('ANDROID_GRADLE') + 
-    ' build -bservice/notification/examples/android/NotiConsumerExample/build.gradle -PTARGET_ARCH=%s -PRELEASE=%s --stacktrace' %(ANDROID_TARGET_ARCH, ANDROID_RELEASE),
-    emitter = ensure_libs)
+jdk_env['BUILDERS']['Gradle'] = Builder(
+    action=env.get('ANDROID_GRADLE') +
+    ' build -bservice/notification/examples/android/NotiConsumerExample/build.gradle -PTARGET_ARCH=%s -PRELEASE=%s --stacktrace'
+    % (ANDROID_TARGET_ARCH, ANDROID_RELEASE),
+    emitter=ensure_libs)
 jdk_env['BUILD_DIR'] = env.get('BUILD_DIR')
-cmdBuildNotificationConsumerApp=jdk_env.Gradle(target="app/apk", 
-    source=["app/src/main/java/org/iotivity/service/ns/sample/consumer/MainActivity.java",
-            "app/src/main/java/org/iotivity/service/ns/sample/consumer/ConsumerSample.java"])
-jdk_env.Clean(cmdBuildNotificationConsumerApp, '#/service/notification/examples/android/NotiConsumerExample/build')
-jdk_env.Clean(cmdBuildNotificationConsumerApp, '#/service/notification/examples/android/NotiConsumerExample/app/build')
+cmdBuildNotificationConsumerApp = jdk_env.Gradle(
+    target="app/apk",
+    source=[
+        "app/src/main/java/org/iotivity/service/ns/sample/consumer/MainActivity.java",
+        "app/src/main/java/org/iotivity/service/ns/sample/consumer/ConsumerSample.java"
+    ])
+jdk_env.Clean(
+    cmdBuildNotificationConsumerApp,
+    '#/service/notification/examples/android/NotiConsumerExample/build')
+jdk_env.Clean(
+    cmdBuildNotificationConsumerApp,
+    '#/service/notification/examples/android/NotiConsumerExample/app/build')
 Depends(cmdBuildNotificationConsumerApp, env.get('notificationAAR'))
index 36c77c1..c5191ab 100644 (file)
@@ -26,14 +26,16 @@ android_home = env.get('ANDROID_HOME')
 
 ANDROID_TARGET_ARCH = env.get('TARGET_ARCH')
 if env.get('RELEASE'):
-       ANDROID_RELEASE="release"
+    ANDROID_RELEASE = "release"
 else:
-       ANDROID_RELEASE="debug"
+    ANDROID_RELEASE = "debug"
 
 os.environ['ANDROID_HOME'] = env.get('ANDROID_HOME')
 os.environ['ANDROID_NDK_HOME'] = env.get('ANDROID_NDK')
 
-if not os.path.exists(android_home + '/platforms/android-21') or not os.path.exists(android_home + '/build-tools/20.0.0'):
+if not os.path.exists(android_home +
+                      '/platforms/android-21') or not os.path.exists(
+                          android_home + '/build-tools/20.0.0'):
     print '''
 ***************************************** Info ********************************
 *   Either 'Android API 21' is not installed or 'Android SDK Build Tools      *
@@ -62,24 +64,37 @@ if not os.path.exists(android_home + '/platforms/android-21') or not os.path.exi
 '''
     os.system(android_home + '/tools/android')
 
+
 def ensure_libs(target, source, env):
-    return target, [source,
-                    env.get('BUILD_DIR') + 'libnotification_provider_jni.so',
-                    env.get('BUILD_DIR') + 'libnotification_provider_wrapper.so',
-                    env.get('BUILD_DIR') + 'libnotification_provider.so',
-                    env.get('BUILD_DIR') + 'libnotification_consumer_jni.so',
-                    env.get('BUILD_DIR') + 'libnotification_consumer_wrapper.so',
-                    env.get('BUILD_DIR') + 'libnotification_consumer.so']
+    return target, [
+        source,
+        env.get('BUILD_DIR') + 'libnotification_provider_jni.so',
+        env.get('BUILD_DIR') + 'libnotification_provider_wrapper.so',
+        env.get('BUILD_DIR') + 'libnotification_provider.so',
+        env.get('BUILD_DIR') + 'libnotification_consumer_jni.so',
+        env.get('BUILD_DIR') + 'libnotification_consumer_wrapper.so',
+        env.get('BUILD_DIR') + 'libnotification_consumer.so'
+    ]
+
 
 jdk_env = Environment(ENV=os.environ)
-jdk_env['BUILDERS']['Gradle'] = Builder(action = env.get('ANDROID_GRADLE') + 
-    ' build -bservice/notification/examples/android/NotiProviderExample/build.gradle -PTARGET_ARCH=%s -PRELEASE=%s --stacktrace' %(ANDROID_TARGET_ARCH, ANDROID_RELEASE),
-    emitter = ensure_libs)
+jdk_env['BUILDERS']['Gradle'] = Builder(
+    action=env.get('ANDROID_GRADLE') +
+    ' build -bservice/notification/examples/android/NotiProviderExample/build.gradle -PTARGET_ARCH=%s -PRELEASE=%s --stacktrace'
+    % (ANDROID_TARGET_ARCH, ANDROID_RELEASE),
+    emitter=ensure_libs)
 jdk_env['BUILD_DIR'] = env.get('BUILD_DIR')
-cmdBuildNotificationProviderApp=jdk_env.Gradle(target="app/apk", 
-    source=["app/src/main/java/org/iotivity/service/ns/sample/provider/MainActivity.java",
-            "app/src/main/java/org/iotivity/service/ns/sample/provider/NotiListener.java",
-            "app/src/main/java/org/iotivity/service/ns/sample/provider/ProviderSample.java"])
-jdk_env.Clean(cmdBuildNotificationProviderApp, '#/service/notification/examples/android/NotiProviderExample/build')
-jdk_env.Clean(cmdBuildNotificationProviderApp, '#/service/notification/examples/android/NotiProviderExample/app/build')
+cmdBuildNotificationProviderApp = jdk_env.Gradle(
+    target="app/apk",
+    source=[
+        "app/src/main/java/org/iotivity/service/ns/sample/provider/MainActivity.java",
+        "app/src/main/java/org/iotivity/service/ns/sample/provider/NotiListener.java",
+        "app/src/main/java/org/iotivity/service/ns/sample/provider/ProviderSample.java"
+    ])
+jdk_env.Clean(
+    cmdBuildNotificationProviderApp,
+    '#/service/notification/examples/android/NotiProviderExample/build')
+jdk_env.Clean(
+    cmdBuildNotificationProviderApp,
+    '#/service/notification/examples/android/NotiProviderExample/app/build')
 Depends(cmdBuildNotificationProviderApp, env.get('notificationAAR'))
index 059c496..c48d27c 100644 (file)
@@ -12,88 +12,104 @@ target_os = env.get('TARGET_OS')
 ######################################################################
 # Build flags
 ######################################################################
-notification_sample_env.AppendUnique(CPPPATH = ['../../include'])
-notification_sample_env.AppendUnique(CPPPATH = ['../../src/common'])
-notification_sample_env.AppendUnique(CPPPATH = ['../../src/provider'])
-notification_sample_env.AppendUnique(CPPPATH = ['#/resource/csdk/include'])
-notification_sample_env.AppendUnique(CPPPATH = ['#/resource/csdk/stack/include'])
-notification_sample_env.AppendUnique(CPPPATH = ['#/resource/csdk/security/include'])
-notification_sample_env.AppendUnique(CPPPATH = ['#/resource/csdk/resource-directory/include'])
-notification_sample_env.AppendUnique(CPPPATH = ['#/resource/csdk/connectivity/api'])
-
-notification_sample_env.PrependUnique(LIBS = [
-       'resource_directory',
-       'octbstack',
-       'connectivity_abstraction',
-       'oc_logger',
-       'libcoap',
-       ])
+notification_sample_env.AppendUnique(CPPPATH=[
+    '../../include',
+    '../../src/common',
+    '../../src/provider',
+    '#/resource/csdk/include',
+    '#/resource/csdk/stack/include',
+    '#/resource/csdk/security/include',
+    '#/resource/csdk/resource-directory/include',
+    '#/resource/csdk/connectivity/api',
+])
+
+notification_sample_env.PrependUnique(LIBS=[
+    'resource_directory',
+    'octbstack',
+    'connectivity_abstraction',
+    'oc_logger',
+    'libcoap',
+])
 
 if target_os not in ['windows', 'winrt']:
-       notification_sample_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x'])
+    notification_sample_env.AppendUnique(
+        CXXFLAGS=['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x'])
 
 if target_os not in ['darwin', 'ios', 'windows', 'winrt']:
-       notification_sample_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
+    notification_sample_env.AppendUnique(LINKFLAGS=['-Wl,--no-undefined'])
 
 if target_os == 'linux':
-       notification_sample_env.AppendUnique(LIBS = ['pthread'])
+    notification_sample_env.AppendUnique(LIBS=['pthread'])
 
 if target_os == 'android':
-       notification_sample_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
-       notification_sample_env.AppendUnique(LIBS = ['gnustl_shared','log'])
+    notification_sample_env.AppendUnique(CXXFLAGS=['-frtti', '-fexceptions'])
+    notification_sample_env.AppendUnique(LIBS=['gnustl_shared', 'log'])
 
-       if not env.get('RELEASE'):
-               notification_sample_env.AppendUnique(LIBS = ['log'])
+    if not env.get('RELEASE'):
+        notification_sample_env.AppendUnique(LIBS=['log'])
 
 notification_sample_consumer_src = 'notificationconsumer.c'
 notification_sample_provider_src = 'notificationprovider.c'
 
 if env.get('WITH_CLOUD') == True:
-       notification_sample_env.AppendUnique(CPPPATH = ['../../src/consumer'])
-        notification_sample_env.AppendUnique(CPPPATH = ['../../src/provider'])
-       notification_sample_env.AppendUnique(CPPDEFINES = ['WITH_CLOUD'])
-
-        providerCloudConnectorObj = notification_sample_env.Object('cloud_connector.c')
-        consumerCloudConnectorObj = notification_sample_env.Object('cloud_connector.c')
-
-        #PROVIDER_CLOUD = File('cloud_connector.c')
-        #notification_sample_provider_src = ['notificationprovider.c', PROVIDER_CLOUD]
-        notification_sample_provider_src = ['notificationprovider.c', providerCloudConnectorObj]
-       #CONSUMER_CLOUD = File('cloud_connector.c')
-       #notification_sample_consumer_src = ['notificationconsumer.c', CONSUMER_CLOUD]
-        notification_sample_consumer_src = ['notificationconsumer.c', consumerCloudConnectorObj]
+    notification_sample_env.AppendUnique(CPPPATH=['../../src/consumer'])
+    notification_sample_env.AppendUnique(CPPPATH=['../../src/provider'])
+    notification_sample_env.AppendUnique(CPPDEFINES=['WITH_CLOUD'])
+
+    providerCloudConnectorObj = notification_sample_env.Object('cloud_connector.c')
+    consumerCloudConnectorObj = notification_sample_env.Object('cloud_connector.c')
+
+    #PROVIDER_CLOUD = File('cloud_connector.c')
+    #notification_sample_provider_src = ['notificationprovider.c', PROVIDER_CLOUD]
+    notification_sample_provider_src = [
+        'notificationprovider.c',
+        providerCloudConnectorObj,
+    ]
+    #CONSUMER_CLOUD = File('cloud_connector.c')
+    #notification_sample_consumer_src = ['notificationconsumer.c', CONSUMER_CLOUD]
+    notification_sample_consumer_src = [
+        'notificationconsumer.c',
+        consumerCloudConnectorObj,
+    ]
 
 if env.get('WITH_TCP') == True:
-       notification_sample_env.AppendUnique(CPPDEFINES = ['WITH_TCP'])
+    notification_sample_env.AppendUnique(CPPDEFINES=['WITH_TCP'])
 if env.get('SECURED') == '1':
-       notification_sample_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509', 'mbedcrypto'])
+    notification_sample_env.AppendUnique(
+        LIBS=['mbedtls', 'mbedx509', 'mbedcrypto'])
 
 with_mq = env.get('WITH_MQ')
 if 'SUB' in with_mq:
-    notification_sample_env.AppendUnique(CPPDEFINES = ['MQ_SUBSCRIBER', 'WITH_MQ'])
+    notification_sample_env.AppendUnique(
+        CPPDEFINES=['MQ_SUBSCRIBER', 'WITH_MQ'])
     print "MQ SUB support"
 
 if 'PUB' in with_mq:
-    notification_sample_env.AppendUnique(CPPDEFINES = ['MQ_PUBLISHER', 'WITH_MQ'])
+    notification_sample_env.AppendUnique(
+        CPPDEFINES=['MQ_PUBLISHER', 'WITH_MQ'])
     print "MQ PUB support"
 
 if 'BROKER' in with_mq:
-    notification_sample_env.AppendUnique(CPPDEFINES = ['MQ_BROKER', 'WITH_MQ'])
+    notification_sample_env.AppendUnique(CPPDEFINES=['MQ_BROKER', 'WITH_MQ'])
     print "MQ Broker support"
 
 ####################################################################
 # Source files and Targets
 ######################################################################
 notification_sample_provider_env = notification_sample_env.Clone()
-notification_sample_provider_env.AppendUnique(LIBS = 'libnotification_provider')
-notificationprovider = notification_sample_provider_env.Program('notificationprovider', notification_sample_provider_src)
-i_notificationprovider = notification_sample_provider_env.Install(env.get('BUILD_DIR'), notificationprovider)
+notification_sample_provider_env.AppendUnique(LIBS='libnotification_provider')
+notificationprovider = notification_sample_provider_env.Program(
+    'notificationprovider', notification_sample_provider_src)
+i_notificationprovider = notification_sample_provider_env.Install(
+    env.get('BUILD_DIR'), notificationprovider)
 
 notification_sample_consumer_env = notification_sample_env.Clone()
-notification_sample_consumer_env.AppendUnique(LIBS = 'libnotification_consumer')
-notificationconsumer = notification_sample_consumer_env.Program('notificationconsumer', notification_sample_consumer_src)
-i_notificationprovider = notification_sample_consumer_env.Install(env.get('BUILD_DIR'), notificationconsumer)
+notification_sample_consumer_env.AppendUnique(LIBS='libnotification_consumer')
+notificationconsumer = notification_sample_consumer_env.Program(
+    'notificationconsumer', notification_sample_consumer_src)
+i_notificationprovider = notification_sample_consumer_env.Install(
+    env.get('BUILD_DIR'), notificationconsumer)
 
 if env.get('WITH_CLOUD') == True:
-        Export('providerCloudConnectorObj')
-        Export('consumerCloudConnectorObj')
+    Export('providerCloudConnectorObj')
+    Export('consumerCloudConnectorObj')
index ec4f51d..70729cf 100644 (file)
 ##
 # Notification Unit Test build script
 ##
-from tools.scons.RunTest import run_test
-Import('env')
 
 import os
+from tools.scons.RunTest import run_test
+
+Import('env')
 
 if env.get('RELEASE'):
-       env.AppendUnique(CCFLAGS = ['-Os'])
-       env.AppendUnique(CPPDEFINES = ['NDEBUG'])
+    env.AppendUnique(CCFLAGS=['-Os'])
+    env.AppendUnique(CPPDEFINES=['NDEBUG'])
 else:
-       env.AppendUnique(CCFLAGS = ['-g'])
+    env.AppendUnique(CCFLAGS=['-g'])
 
 if env.get('LOGGING'):
-       env.AppendUnique(CPPDEFINES = ['TB_LOG'])
+    env.AppendUnique(CPPDEFINES=['TB_LOG'])
 
 gtest_env = SConscript('#extlibs/gtest/SConscript')
 lib_env = gtest_env.Clone()
@@ -50,81 +51,95 @@ target_os = env.get('TARGET_OS')
 ######################################################################
 # Build flags
 ######################################################################
-notification_test_env.AppendUnique(LIBPATH = [lib_env.get('BUILD_DIR')])
-notification_test_env.AppendUnique(LIBS = [
-    'resource_directory', 'oc', 
-    'octbstack', 'connectivity_abstraction', 'oc_logger', 
-    'coap'
+notification_test_env.AppendUnique(LIBPATH=[lib_env.get('BUILD_DIR')])
+notification_test_env.AppendUnique(LIBS=[
+    'resource_directory',
+    'oc',
+    'octbstack',
+    'connectivity_abstraction',
+    'oc_logger',
+    'coap',
 ])
 
 if target_os not in ['windows', 'winrt']:
-    notification_test_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x'])
+    notification_test_env.AppendUnique(
+        CXXFLAGS=['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x'])
+
+notification_test_env.AppendUnique(LINKFLAGS=['-Wl,--no-as-needed'])
 
-notification_test_env.AppendUnique(LINKFLAGS = ['-Wl,--no-as-needed'])
 
-notification_test_env.AppendUnique(CXXFLAGS = ['-pthread'])
-notification_test_env.AppendUnique(LIBS = ['pthread'])
-notification_test_env.AppendUnique(CPPPATH = ['../include'])
-notification_test_env.AppendUnique(CPPPATH = ['../src/consumer'])
-notification_test_env.AppendUnique(CPPPATH = ['../src/provider'])
-notification_test_env.AppendUnique(CPPPATH = ['../src/common'])
-notification_test_env.AppendUnique(CPPPATH = [src_dir + '/resource/csdk/connectivity/api'])
+notification_test_env.AppendUnique(CXXFLAGS=['-pthread'])
+notification_test_env.AppendUnique(LIBS=['pthread'])
+
+notification_test_env.PrependUnique(CPPPATH=[
+    '../include',
+    '../src/consumer',
+    '../src/provider',
+    '../src/common',
+    src_dir + '/resource/csdk/connectivity/api',
+])
 
 if env.get('WITH_TCP') == True:
-       notification_test_env.AppendUnique(CPPDEFINES = ['WITH_TCP'])
+    notification_test_env.AppendUnique(CPPDEFINES=['WITH_TCP'])
 if env.get('SECURED') == '1':
-       notification_test_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509', 'mbedcrypto'])
-       notification_test_env.AppendUnique(CPPPATH = ['#/resource/csdk/security/include'])
+    notification_test_env.AppendUnique(
+        LIBS=['mbedtls', 'mbedx509', 'mbedcrypto'])
+    notification_test_env.AppendUnique(
+        CPPPATH=['#/resource/csdk/security/include'])
 
 ######################################################################
 # Build Test
 ######################################################################
 
 notification_consumer_test_env = notification_test_env.Clone()
-notification_consumer_test_env.AppendUnique(LIBS = ['notification_consumer'])
+notification_consumer_test_env.AppendUnique(LIBS=['notification_consumer'])
 
 notification_provider_test_env = notification_test_env.Clone()
-notification_provider_test_env.AppendUnique(LIBS = ['notification_provider'])
+notification_provider_test_env.AppendUnique(LIBS=['notification_provider'])
 
 notification_consumer_test_src = env.Glob('./NSConsumerTest2.cpp')
-notification_consumer_test = notification_consumer_test_env.Program('notification_consumer_test', notification_consumer_test_src)
+notification_consumer_test = notification_consumer_test_env.Program(
+    'notification_consumer_test', notification_consumer_test_src)
 Alias("notification_consumer_test", notification_consumer_test)
 env.AppendTarget('notification_consumer_test')
 
 notification_consumer_test_src = env.Glob('./NSConsumerTest.cpp')
-notification_consumer_internaltest = notification_consumer_test_env.Program('notification_consumer_internaltest', notification_consumer_test_src)
+notification_consumer_internaltest = notification_consumer_test_env.Program(
+    'notification_consumer_internaltest', notification_consumer_test_src)
 Alias("notification_consumer_internaltest", notification_consumer_internaltest)
 
 notification_provider_test_src = env.Glob('./NSProviderTest2.cpp')
 notification_provider_test = notification_provider_test_env.Program(
-            'notification_provider_test', notification_provider_test_src)
+    'notification_provider_test', notification_provider_test_src)
 Alias("notification_provider_test", notification_provider_test)
 env.AppendTarget('notification_provider_test')
 
 notification_provider_test_src = env.Glob('./NSProviderTest.cpp')
 notification_provider_internaltest = notification_provider_test_env.Program(
-            'notification_provider_internaltest', notification_provider_test_src)
+    'notification_provider_internaltest', notification_provider_test_src)
 Alias("notification_provider_internaltest", notification_provider_internaltest)
 
-# TODO: Fix this test for MLK and remove commented lines
 if env.get('TEST') == '1':
     if target_os in ['linux'] and env.get('SECURED') != '1':
-        run_test(notification_consumer_test_env,
-#                'service_notification_unittest_notification_consumer_test.memcheck',
-                 '',
-                 'service/notification/unittest/notification_consumer_test')
-        run_test(notification_provider_test_env,
-#                'service_notification_unittest_notification_provider_test.memcheck',
-                 '',
-                 'service/notification/unittest/notification_provider_test')
+        run_test(
+            notification_consumer_test_env,
+            #'service_notification_unittest_notification_consumer_test.memcheck',
+            '',  # TODO: Fix this test for MLK and enable previous line
+            'service/notification/unittest/notification_consumer_test')
+        run_test(
+            notification_provider_test_env,
+            #'service_notification_unittest_notification_provider_test.memcheck',
+            '',  # TODO: Fix this test for MLK and enable previous line
+            'service/notification/unittest/notification_provider_test')
 else:
-    notification_consumer_test_env.AppendUnique(CPPDEFINES = ['LOCAL_RUNNING'])
-    notification_provider_test_env.AppendUnique(CPPDEFINES = ['LOCAL_RUNNING'])
+    notification_consumer_test_env.AppendUnique(CPPDEFINES=['LOCAL_RUNNING'])
+    notification_provider_test_env.AppendUnique(CPPDEFINES=['LOCAL_RUNNING'])
     src_dir = notification_consumer_test_env.get('SRC_DIR')
     svr_db_src_dir = os.path.join(src_dir, 'service/notification/unittest/')
-    svr_db_build_dir = os.path.join(notification_consumer_test_env.get('BUILD_DIR'),
-        'service', 'notification', 'unittest') + os.sep
-    notification_consumer_test_env.Alias("install",
-        notification_consumer_test_env.Install(svr_db_build_dir,
-              os.path.join(svr_db_src_dir,
-                           'oic_svr_db_ns.dat')))
+    svr_db_build_dir = os.path.join(
+        notification_consumer_test_env.get('BUILD_DIR'), 'service',
+        'notification', 'unittest') + os.sep
+    notification_consumer_test_env.Alias(
+        "install",
+        notification_consumer_test_env.Install(
+            svr_db_build_dir, os.path.join(svr_db_src_dir, 'oic_svr_db_ns.dat')))
index 67678d7..7f758df 100644 (file)
@@ -25,19 +25,24 @@ import os
 Import('env')
 import os.path
 
-containerJavaSupport = ARGUMENTS.get('containerJavaSupport',0)
+containerJavaSupport = ARGUMENTS.get('containerJavaSupport', 0)
 
-def filtered_glob(env, pattern, omit=[],
-  ondisk=True, source=False, strings=False):
-    return filter(
-      lambda f: os.path.basename(f.path) not in omit,
-      env.Glob(pattern))
 
-env.AddMethod(filtered_glob, "FilteredGlob");
+def filtered_glob(env,
+                  pattern,
+                  omit=[],
+                  ondisk=True,
+                  source=False,
+                  strings=False):
+    return filter(lambda f: os.path.basename(f.path) not in omit,
+                  env.Glob(pattern))
+
+
+env.AddMethod(filtered_glob, "FilteredGlob")
 
 # Add third party libraries
 lib_env = env.Clone()
-SConscript('#service/third_party_libs.scons', exports = 'lib_env')
+SConscript('#service/third_party_libs.scons', exports='lib_env')
 
 resource_container_env = lib_env.Clone()
 target_os = env.get('TARGET_OS')
@@ -49,155 +54,181 @@ if int(containerJavaSupport):
     try:
         print 'Java Home: ', os.environ['JAVA_HOME']
         print 'Java Lib: ', os.environ['JAVA_LIB']
-        resource_container_env.Append(CPPDEFINES={'JAVA_SUPPORT':1})
+        resource_container_env.Append(CPPDEFINES={'JAVA_SUPPORT': 1})
     except KeyError:
         print '''
-    *********************************** Error *************************************
-    * Building resource container without Java support. JAVA_HOME or JAVA_LIB are not set properly
-    * Please configure JAVA_HOME to point to your Java 7 JDK and
-    * JAVA_LIB to your folder containing libjvm
-    * Example: export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-i386
-    *          export JAVA_LIB=/usr/lib/jvm/java-7-openjdk-i386/jre/lib/i386/server
-    *******************************************************************************
-        '''
-        resource_container_env.Append(CPPDEFINES={'JAVA_SUPPORT':0})
-
-
-resource_container_env.AppendUnique(
-    CPPPATH = [
-        '#/extlibs',
-        '#/resource/csdk/include',
-        '#/resource/csdk/stack/include',
-        '#/resource/include',
-        '#/resource/oc_logger/include',
-        '#/service/resource-encapsulation/include',
-        'include',
-        'bundle-api/include',
-        'src'
-    ])
+*********************************** Error *************************************
+* Building resource container without Java support. JAVA_HOME or JAVA_LIB are not set properly
+* Please configure JAVA_HOME to point to your Java 7 JDK and
+* JAVA_LIB to your folder containing libjvm
+* Example: export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-i386
+*          export JAVA_LIB=/usr/lib/jvm/java-7-openjdk-i386/jre/lib/i386/server
+*******************************************************************************
+'''
+        resource_container_env.Append(CPPDEFINES={'JAVA_SUPPORT': 0})
+
+resource_container_env.AppendUnique(CPPPATH=[
+    '#/extlibs',
+    '#/resource/csdk/include',
+    '#/resource/csdk/stack/include',
+    '#/resource/include',
+    '#/resource/oc_logger/include',
+    '#/service/resource-encapsulation/include',
+    'include',
+    'bundle-api/include',
+    'src',
+])
 
 if int(containerJavaSupport):
     try:
-        resource_container_env.AppendUnique(
-        CPPPATH = [
-            os.environ['JAVA_HOME']+'/include',
-            os.environ['JAVA_HOME']+'/include/linux'
+        resource_container_env.AppendUnique(CPPPATH=[
+            os.environ['JAVA_HOME'] + '/include',
+            os.environ['JAVA_HOME'] + '/include/linux'
         ])
     except KeyError:
         print ''
 
-
 if target_os not in ['windows']:
-    resource_container_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall'])
+    resource_container_env.AppendUnique(CXXFLAGS=['-std=c++0x', '-Wall'])
     if target_os != 'android':
-        resource_container_env.AppendUnique(CXXFLAGS = ['-pthread'])
+        resource_container_env.AppendUnique(CXXFLAGS=['-pthread'])
 
 if target_os not in ['darwin', 'ios', 'windows']:
-    resource_container_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
+    resource_container_env.AppendUnique(LINKFLAGS=['-Wl,--no-undefined'])
 
 if target_os == 'android':
-    resource_container_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
-    resource_container_env.PrependUnique(LIBS = ['gnustl_shared', 'log'])
+    resource_container_env.AppendUnique(CXXFLAGS=['-frtti', '-fexceptions'])
+    resource_container_env.PrependUnique(LIBS=['gnustl_shared', 'log'])
 
 try:
-    resource_container_env.AppendUnique(LIBPATH = [os.environ['JAVA_LIB']])
+    resource_container_env.AppendUnique(LIBPATH=[os.environ['JAVA_LIB']])
 except KeyError:
     print ''
 
-resource_container_env.PrependUnique(LIBS = ['coap'])
-resource_container_env.AppendUnique(LIBS = ['connectivity_abstraction'])
-resource_container_env.AppendUnique(LIBS = ['oc_logger'])
-resource_container_env.AppendUnique(LIBS = ['octbstack'])
-resource_container_env.AppendUnique(LIBS = ['oc'])
-resource_container_env.AppendUnique(LIBS = ['rcs_client'])
-resource_container_env.AppendUnique(LIBS = ['rcs_server'])
-resource_container_env.AppendUnique(LIBS = ['rcs_common'])
-resource_container_env.AppendUnique(LIBS = ['dl'])
-resource_container_env.AppendUnique(LIBS = ['boost_system'])
-resource_container_env.AppendUnique(LIBS = ['boost_date_time'])
-resource_container_env.AppendUnique(LIBS = ['boost_thread'])
+resource_container_env.PrependUnique(LIBS=[
+    'coap',
+    'connectivity_abstraction',
+    'oc_logger',
+    'octbstack',
+    'oc',
+    'rcs_client',
+    'rcs_server',
+    'rcs_common',
+    'dl',
+    'boost_system',
+    'boost_date_time',
+    'boost_thread',
+])
 
 if resource_container_env.get('SECURED') == '1':
-    resource_container_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509', 'mbedcrypto'])
+    resource_container_env.AppendUnique(
+        LIBS=['mbedtls', 'mbedx509', 'mbedcrypto'])
 
 if int(containerJavaSupport):
     try:
         print 'Java Lib: ', os.environ['JAVA_LIB']
-        resource_container_env.AppendUnique(LIBS = ['jvm'])
+        resource_container_env.AppendUnique(LIBS=['jvm'])
     except KeyError:
         print ''
 
 ######################################################################
 # Source files and Targets
 ######################################################################
-res_container_src = [ Glob('src/*.cpp') ]
+res_container_src = [Glob('src/*.cpp')]
 
-res_container_static = resource_container_env.StaticLibrary('rcs_container', res_container_src)
+res_container_static = resource_container_env.StaticLibrary(
+    'rcs_container', res_container_src)
 if target_os not in ['ios']:
-    res_container_shared = resource_container_env.SharedLibrary('rcs_container', res_container_src)
-    resource_container_env.InstallTarget([res_container_static,res_container_shared], 'libResContainer')
-    resource_container_env.UserInstallTargetLib([res_container_static,res_container_shared], 'libResContainer')
+    res_container_shared = resource_container_env.SharedLibrary(
+        'rcs_container', res_container_src)
+    resource_container_env.InstallTarget(
+        [res_container_static, res_container_shared], 'libResContainer')
+    resource_container_env.UserInstallTargetLib(
+        [res_container_static, res_container_shared], 'libResContainer')
 else:
-    resource_container_env.InstallTarget([res_container_static], 'libResContainer')
-    resource_container_env.UserInstallTargetLib([res_container_static], 'libResContainer')
+    resource_container_env.InstallTarget([res_container_static],
+                                         'libResContainer')
+    resource_container_env.UserInstallTargetLib([res_container_static],
+                                                'libResContainer')
 
-resource_container_env.UserInstallTargetHeader('include/RCSBundleInfo.h', 'service/resource-container', 'RCSBundleInfo.h')
-resource_container_env.UserInstallTargetHeader('include/RCSResourceContainer.h', 'service/resource-container', 'RCSResourceContainer.h')
+resource_container_env.UserInstallTargetHeader(
+    'include/RCSBundleInfo.h', 'service/resource-container', 'RCSBundleInfo.h')
+resource_container_env.UserInstallTargetHeader(
+    'include/RCSResourceContainer.h', 'service/resource-container',
+    'RCSResourceContainer.h')
 
 if target_os in ['android']:
-    resource_container_env.AppendUnique(LINKFLAGS = ['-Wl,-soname,librcs_container.so'])
+    resource_container_env.AppendUnique(
+        LINKFLAGS=['-Wl,-soname,librcs_container.so'])
 
 ######################################################################
 # build discomfort index sensor sample bundle
 ######################################################################
 if target_os in ['linux', 'tizen', 'android']:
     DI_sensor_bundle_env = resource_container_env.Clone()
-    DI_sensor_bundle_env.AppendUnique(CCFLAGS = ['-fPIC'])
+    DI_sensor_bundle_env.AppendUnique(CCFLAGS=['-fPIC'])
 
     DI_SENSOR_BUNDLE_DIR = 'examples/DiscomfortIndexSensorBundle/'
-    DI_sensor_bundle_env.AppendUnique(CPPPATH = [ DI_SENSOR_BUNDLE_DIR + 'include' ])
+    DI_sensor_bundle_env.AppendUnique(
+        CPPPATH=[DI_SENSOR_BUNDLE_DIR + 'include'])
 
-    DI_sensor_bundle_env.PrependUnique(LIBS = ['rcs_container'])
+    DI_sensor_bundle_env.PrependUnique(LIBS=['rcs_container'])
 
-    DI_sensor_bundle_src = [ Glob(DI_SENSOR_BUNDLE_DIR + 'src/*.cpp')]
+    DI_sensor_bundle_src = [Glob(DI_SENSOR_BUNDLE_DIR + 'src/*.cpp')]
 
-    DISensorBundle = DI_sensor_bundle_env.SharedLibrary('DISensorBundle', DI_sensor_bundle_src)
+    DISensorBundle = DI_sensor_bundle_env.SharedLibrary(
+        'DISensorBundle', DI_sensor_bundle_src)
     DI_sensor_bundle_env.InstallTarget(DISensorBundle, 'libDISensorBundle')
-    DI_sensor_bundle_env.UserInstallTargetLib(DISensorBundle, 'libDISensorBundle')
+    DI_sensor_bundle_env.UserInstallTargetLib(DISensorBundle,
+                                              'libDISensorBundle')
 
     if target_os in ['linux']:
         SConscript(DI_SENSOR_BUNDLE_DIR + 'src/inputSensors/SConscript')
-        Command("THSensorApp", DI_SENSOR_BUNDLE_DIR + "src/inputSensors/THSensorApp/THSensorApp", Copy("$TARGET", "$SOURCE"))
-        Command("THSensorApp1", DI_SENSOR_BUNDLE_DIR + "src/inputSensors/THSensorApp1/THSensorApp1", Copy("$TARGET", "$SOURCE"))
+        Command(
+            "THSensorApp",
+            DI_SENSOR_BUNDLE_DIR + "src/inputSensors/THSensorApp/THSensorApp",
+            Copy("$TARGET", "$SOURCE"))
+        Command("THSensorApp1", DI_SENSOR_BUNDLE_DIR +
+                "src/inputSensors/THSensorApp1/THSensorApp1",
+                Copy("$TARGET", "$SOURCE"))
 
     if target_os in ['android']:
-        resource_container_env.AppendUnique(LINKFLAGS = ['-Wl,-soname,libDISensorBundle.so'])
+        resource_container_env.AppendUnique(
+            LINKFLAGS=['-Wl,-soname,libDISensorBundle.so'])
 
 ######################################################################
 # build BMI sensor sample bundle
 ######################################################################
 if target_os in ['linux', 'tizen', 'android']:
     BMI_sensor_bundle_env = resource_container_env.Clone()
-    BMI_sensor_bundle_env.AppendUnique(CCFLAGS = ['-fPIC'])
+    BMI_sensor_bundle_env.AppendUnique(CCFLAGS=['-fPIC'])
 
     BMI_SENSOR_BUNDLE_DIR = 'examples/BMISensorBundle/'
-    BMI_sensor_bundle_env.AppendUnique(CPPPATH = [ BMI_SENSOR_BUNDLE_DIR + 'include' ])
+    BMI_sensor_bundle_env.AppendUnique(
+        CPPPATH=[BMI_SENSOR_BUNDLE_DIR + 'include'])
 
-    BMI_sensor_bundle_env.PrependUnique(LIBS = ['rcs_container'])
+    BMI_sensor_bundle_env.PrependUnique(LIBS=['rcs_container'])
 
-    BMI_sensor_bundle_src = [ Glob(BMI_SENSOR_BUNDLE_DIR + 'src/*.cpp')]
+    BMI_sensor_bundle_src = [Glob(BMI_SENSOR_BUNDLE_DIR + 'src/*.cpp')]
 
-    BMISensorBundle = BMI_sensor_bundle_env.SharedLibrary('BMISensorBundle', BMI_sensor_bundle_src)
+    BMISensorBundle = BMI_sensor_bundle_env.SharedLibrary(
+        'BMISensorBundle', BMI_sensor_bundle_src)
     BMI_sensor_bundle_env.InstallTarget(BMISensorBundle, 'libBMISensorBundle')
-    BMI_sensor_bundle_env.UserInstallTargetLib(BMISensorBundle, 'libBMISensorBundle')
+    BMI_sensor_bundle_env.UserInstallTargetLib(BMISensorBundle,
+                                               'libBMISensorBundle')
 
     if target_os in ['linux']:
         SConscript(BMI_SENSOR_BUNDLE_DIR + 'src/inputSensors/SConscript')
-        Command("HeightSensorApp", BMI_SENSOR_BUNDLE_DIR + "src/inputSensors/HeightSensorApp/HeightSensorApp", Copy("$TARGET", "$SOURCE"))
-        Command("WeightSensorApp", BMI_SENSOR_BUNDLE_DIR + "src/inputSensors/WeightSensorApp/WeightSensorApp", Copy("$TARGET", "$SOURCE"))
+        Command("HeightSensorApp", BMI_SENSOR_BUNDLE_DIR +
+                "src/inputSensors/HeightSensorApp/HeightSensorApp",
+                Copy("$TARGET", "$SOURCE"))
+        Command("WeightSensorApp", BMI_SENSOR_BUNDLE_DIR +
+                "src/inputSensors/WeightSensorApp/WeightSensorApp",
+                Copy("$TARGET", "$SOURCE"))
 
     if target_os in ['android']:
-        resource_container_env.AppendUnique(LINKFLAGS = ['-Wl,-soname,libBMISensorBundle.so'])
+        resource_container_env.AppendUnique(
+            LINKFLAGS=['-Wl,-soname,libBMISensorBundle.so'])
 
 ######################################################################
 # build hue sample bundle
@@ -205,7 +236,7 @@ if target_os in ['linux', 'tizen', 'android']:
 
 conf2 = Configure(lib_env)
 if not conf2.CheckLib('curl'):
-    print '''X
+    print '''
 *********************************** Error *************************************
 * Cannot build hue sample. Please install libcurl.
 * Example (Ubuntu):
@@ -217,19 +248,18 @@ if not conf2.CheckLib('curl'):
     '''
 else:
     hue_resource_bundle_env = resource_container_env.Clone()
-    hue_resource_bundle_env.AppendUnique(CCFLAGS = ['-fPIC'])
+    hue_resource_bundle_env.AppendUnique(CCFLAGS=['-fPIC'])
 
     HUE_RESOURCE_BUNDLE_DIR = 'examples/HueSampleBundle/'
-    hue_resource_bundle_env.AppendUnique(CPPPATH = [
-            HUE_RESOURCE_BUNDLE_DIR + 'include',
-            'include/'
-            ])
+    hue_resource_bundle_env.AppendUnique(
+        CPPPATH=[HUE_RESOURCE_BUNDLE_DIR + 'include', 'include/'])
 
-    hue_resource_bundle_env.PrependUnique(LIBS = ['curl', 'rcs_container'])
+    hue_resource_bundle_env.PrependUnique(LIBS=['curl', 'rcs_container'])
 
-    hue_resource_bundle_src = [ Glob(HUE_RESOURCE_BUNDLE_DIR + 'src/*.cpp')]
+    hue_resource_bundle_src = [Glob(HUE_RESOURCE_BUNDLE_DIR + 'src/*.cpp')]
 
-    HueBundle = hue_resource_bundle_env.SharedLibrary('HueBundle', hue_resource_bundle_src)
+    HueBundle = hue_resource_bundle_env.SharedLibrary('HueBundle',
+                                                      hue_resource_bundle_src)
     hue_resource_bundle_env.InstallTarget(HueBundle, 'libHueBundle')
     hue_resource_bundle_env.UserInstallTargetLib(HueBundle, 'libHueBundle')
 lib_env = conf2.Finish()
@@ -244,28 +274,34 @@ if target_os in ['linux']:
 # Build Container Sample
 ######################################################################
 if target_os not in ['ios']:
-    containersample_env = resource_container_env.Clone();
+    containersample_env = resource_container_env.Clone()
     containersample_env.AppendUnique(LINKFLAGS=["-rdynamic"])
 
     # Copy test configuration
-    Command("examples/ResourceContainerConfig.xml","examples/ResourceContainerConfig.xml", Copy("$TARGET", "$SOURCE"))
-    Ignore("examples/ResourceContainerConfig.xml", "examples/ResourceContainerConfig.xml")
+    Command("examples/ResourceContainerConfig.xml",
+            "examples/ResourceContainerConfig.xml", Copy("$TARGET", "$SOURCE"))
+    Ignore("examples/ResourceContainerConfig.xml",
+           "examples/ResourceContainerConfig.xml")
 
-    containersample_env.AppendUnique(LIBS = ['rcs_container','resource_directory'])
+    containersample_env.AppendUnique(
+        LIBS=['rcs_container', 'resource_directory'])
 
-    containersampleapp_src =  ['examples/ContainerSample.cpp']
-    containersampleapp = containersample_env.Program('ContainerSample',containersampleapp_src)
+    containersampleapp_src = ['examples/ContainerSample.cpp']
+    containersampleapp = containersample_env.Program('ContainerSample',
+                                                     containersampleapp_src)
     Alias("containersample", containersampleapp)
     env.AppendTarget('containersample')
 
-######################################################################
-# Build Container Sample Client
-######################################################################
-    containersampleclient_env = resource_container_env.Clone();
+    ######################################################################
+    # Build Container Sample Client
+    ######################################################################
+    containersampleclient_env = resource_container_env.Clone()
 
-    containersample_env.AppendUnique(LIBS = ['rcs_container'])
-    containersampleclient_src =  ['examples/ContainerSampleClient.cpp']
-    containersampleclientapp = containersample_env.Program('ContainerSampleClient',containersampleclient_src)
+    # this looks like a duplicate, needed?
+    containersample_env.AppendUnique(LIBS=['rcs_container'])
+    containersampleclient_src = ['examples/ContainerSampleClient.cpp']
+    containersampleclientapp = containersample_env.Program(
+        'ContainerSampleClient', containersampleclient_src)
     Alias("containersampleclient", containersampleclientapp)
     env.AppendTarget('containersampleclient')
 
index fb454aa..7a73d3d 100644 (file)
@@ -6,14 +6,16 @@ android_home = env.get('ANDROID_HOME')
 
 ANDROID_TARGET_ARCH = env.get('TARGET_ARCH')
 if env.get('RELEASE'):
-       ANDROID_RELEASE="release"
+    ANDROID_RELEASE = "release"
 else:
-       ANDROID_RELEASE="debug"
+    ANDROID_RELEASE = "debug"
 
 os.environ['ANDROID_HOME'] = env.get('ANDROID_HOME')
 os.environ['ANDROID_NDK_HOME'] = env.get('ANDROID_NDK')
 
-if not os.path.exists(android_home + '/platforms/android-21') or not os.path.exists(android_home + '/build-tools/20.0.0'):
+if not os.path.exists(android_home +
+                      '/platforms/android-21') or not os.path.exists(
+                          android_home + '/build-tools/20.0.0'):
     print '''
 ***************************************** Info ********************************
 *   Either 'Android API 21' is not installed or 'Android SDK Build Tools      *
@@ -41,17 +43,26 @@ if not os.path.exists(android_home + '/platforms/android-21') or not os.path.exi
 ...Opening Android SDK Manager now. Once you are finished, the build will continue.
 '''
     os.system(android_home + '/tools/android')
-    
+
+
 def ensure_libs(target, source, env):
     return target, [source, env.get('BUILD_DIR') + 'librcs_container.so']
 
+
 jdk_env = Environment(ENV=os.environ)
-jdk_env['BUILDERS']['Gradle'] = Builder(action = env.get('ANDROID_GRADLE') +
-    ' build -bservice/resource-container/android/build.gradle -PTARGET_ARCH=%s -PRELEASE=%s --stacktrace' %(ANDROID_TARGET_ARCH, ANDROID_RELEASE),
-    emitter = ensure_libs)
+jdk_env['BUILDERS']['Gradle'] = Builder(
+    action=env.get('ANDROID_GRADLE') +
+    ' build -bservice/resource-container/android/build.gradle -PTARGET_ARCH=%s -PRELEASE=%s --stacktrace'
+    % (ANDROID_TARGET_ARCH, ANDROID_RELEASE),
+    emitter=ensure_libs)
 jdk_env['BUILD_DIR'] = env.get('BUILD_DIR')
 
-cmdResourceContainerApp = jdk_env.Gradle(target="resource-container/objs",
-    source="resource-container/src/main/java/org/iotivity/service/resourcecontainer/RcsBundleInfo.java")
-jdk_env.Clean(cmdResourceContainerApp, '#/service/resource-container/android/build')
-jdk_env.Clean(cmdResourceContainerApp, '#/service/resource-container/android/resource-container/build')
+cmdResourceContainerApp = jdk_env.Gradle(
+    target="resource-container/objs",
+    source=
+    "resource-container/src/main/java/org/iotivity/service/resourcecontainer/RcsBundleInfo.java"
+)
+jdk_env.Clean(cmdResourceContainerApp,
+              '#/service/resource-container/android/build')
+jdk_env.Clean(cmdResourceContainerApp,
+              '#/service/resource-container/android/resource-container/build')
index 1237a8d..e108a83 100644 (file)
@@ -5,33 +5,37 @@
 Import('env linux_sample_env')
 
 # Add third party libraries
-SConscript('#service/third_party_libs.scons', exports = { 'lib_env' : linux_sample_env })
+SConscript('#service/third_party_libs.scons',
+           exports={'lib_env': linux_sample_env})
 
 ######################################################################
 # Build flags
 ######################################################################
-linux_sample_env.AppendUnique(CPPPATH = ['include'])
-linux_sample_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-pthread'])
-linux_sample_env.AppendUnique(CPPDEFINES = ['LINUX'])
-linux_sample_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
-linux_sample_env.AppendUnique(LIBS = ['coap'])
-linux_sample_env.AppendUnique(LIBS = ['connectivity_abstraction'])
-linux_sample_env.AppendUnique(LIBS = ['oc_logger'])
-linux_sample_env.AppendUnique(LIBS = ['octbstack'])
-linux_sample_env.AppendUnique(LIBS = ['oc'])
-linux_sample_env.AppendUnique(LIBS = ['pthread'])
+linux_sample_env.AppendUnique(CPPPATH=['include'])
+linux_sample_env.AppendUnique(CXXFLAGS=['-std=c++0x', '-Wall', '-pthread'])
+linux_sample_env.AppendUnique(CPPDEFINES=['LINUX'])
+linux_sample_env.AppendUnique(LIBPATH=[env.get('BUILD_DIR')])
+linux_sample_env.AppendUnique(LIBS=[
+    'coap',
+    'connectivity_abstraction',
+    'oc_logger',
+    'octbstack',
+    'oc',
+    'pthread',
+])
 
 if env.get('SECURED') == '1':
-       linux_sample_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509', 'mbedcrypto'])
+    linux_sample_env.AppendUnique(LIBS=['mbedtls', 'mbedx509', 'mbedcrypto'])
 
 # On some platforms link order can miss functions so librt needs to be
 # re-scanned at the end if present. gcc 4.6 is one with this issue.
 if 'rt' in linux_sample_env.get('LIBS'):
-    linux_sample_env.Append(LIBS = ['rt'])
+    linux_sample_env.Append(LIBS=['rt'])
 
 ######################################################################
 #build sampleapp
 ######################################################################
-heightsensorapp = linux_sample_env.Program('HeightSensorApp', 'src/HeightSensorApp.cpp')
+heightsensorapp = linux_sample_env.Program('HeightSensorApp',
+                                           'src/HeightSensorApp.cpp')
 Alias("heightsensorapp_sample", heightsensorapp)
 env.AppendTarget('heightsensorapp')
index 3e1e92b..bbf1072 100644 (file)
@@ -24,13 +24,13 @@ target_os = env.get('TARGET_OS')
 
 linux_sample_env = env.Clone()
 
-linux_sample_env.AppendUnique(CPPPATH = [
+linux_sample_env.AppendUnique(CPPPATH=[
     '#/resource/csdk/include',
     '#/resource/csdk/stack/include',
     '#/resource/include',
-    '#/resource/oc_logger/include'
+    '#/resource/oc_logger/include',
 ])
 
 if target_os in ['linux']:
-       SConscript('HeightSensorApp/SConscript', 'linux_sample_env')
-       SConscript('WeightSensorApp/SConscript', 'linux_sample_env')
\ No newline at end of file
+    SConscript('HeightSensorApp/SConscript', 'linux_sample_env')
+    SConscript('WeightSensorApp/SConscript', 'linux_sample_env')
index 626720e..26987d9 100644 (file)
@@ -5,33 +5,37 @@
 Import('env linux_sample_env')
 
 # Add third party libraries
-SConscript('#service/third_party_libs.scons', exports = { 'lib_env' : linux_sample_env })
+SConscript(
+    '#service/third_party_libs.scons', exports={'lib_env': linux_sample_env})
 
 ######################################################################
 # Build flags
 ######################################################################
-linux_sample_env.AppendUnique(CPPPATH = ['include'])
-linux_sample_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-pthread'])
-linux_sample_env.AppendUnique(CPPDEFINES = ['LINUX'])
-linux_sample_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
-linux_sample_env.AppendUnique(LIBS = ['coap'])
-linux_sample_env.AppendUnique(LIBS = ['connectivity_abstraction'])
-linux_sample_env.AppendUnique(LIBS = ['oc_logger'])
-linux_sample_env.AppendUnique(LIBS = ['octbstack'])
-linux_sample_env.AppendUnique(LIBS = ['oc'])
-linux_sample_env.AppendUnique(LIBS = ['pthread'])
+linux_sample_env.AppendUnique(CPPPATH=['include'])
+linux_sample_env.AppendUnique(CXXFLAGS=['-std=c++0x', '-Wall', '-pthread'])
+linux_sample_env.AppendUnique(CPPDEFINES=['LINUX'])
+linux_sample_env.AppendUnique(LIBPATH=[env.get('BUILD_DIR')])
+linux_sample_env.AppendUnique(LIBS=[
+    'coap',
+    'connectivity_abstraction',
+    'oc_logger',
+    'octbstack',
+    'oc',
+    'pthread',
+])
 
 if env.get('SECURED') == '1':
-       linux_sample_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509', 'mbedcrypto'])
+    linux_sample_env.AppendUnique(LIBS=['mbedtls', 'mbedx509', 'mbedcrypto'])
 
 # On some platforms link order can miss functions so librt needs to be
 # re-scanned at the end if present. gcc 4.6 is one with this issue.
 if 'rt' in linux_sample_env.get('LIBS'):
-    linux_sample_env.Append(LIBS = ['rt'])
+    linux_sample_env.Append(LIBS=['rt'])
 
 ######################################################################
 #build sampleapp
 ######################################################################
-weightsensorapp = linux_sample_env.Program('WeightSensorApp', 'src/WeightSensorApp.cpp')
+weightsensorapp = linux_sample_env.Program('WeightSensorApp',
+                                           'src/WeightSensorApp.cpp')
 Alias("weightsensorapp_sample", weightsensorapp)
 env.AppendTarget('weightsensorapp')
index 82350b5..7439a19 100644 (file)
@@ -24,13 +24,13 @@ target_os = env.get('TARGET_OS')
 
 linux_sample_env = env.Clone()
 
-linux_sample_env.AppendUnique(CPPPATH = [
+linux_sample_env.AppendUnique(CPPPATH=[
     '#/resource/csdk/include',
     '#/resource/csdk/stack/include',
     '#/resource/include',
     '#/resource/oc_logger/include'
 ])
 
-if target_os in ['linux'] :
+if target_os in ['linux']:
     SConscript('THSensorApp/SConscript', 'linux_sample_env')
     SConscript('THSensorApp1/SConscript', 'linux_sample_env')
index f671761..df86ae8 100644 (file)
@@ -5,33 +5,37 @@
 Import('env linux_sample_env')
 
 # Add third party libraries
-SConscript('#service/third_party_libs.scons', exports = { 'lib_env' : linux_sample_env })
+SConscript('#service/third_party_libs.scons',
+           exports={'lib_env': linux_sample_env})
 
 ######################################################################
 # Build flags
 ######################################################################
-linux_sample_env.AppendUnique(CPPPATH = ['include'])
-linux_sample_env.AppendUnique(CXXFLAGS = ['-Wall', '-pthread','-std=c++0x'])
-linux_sample_env.AppendUnique(CPPDEFINES = ['LINUX'])
-linux_sample_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
-linux_sample_env.AppendUnique(LIBS = ['coap'])
-linux_sample_env.AppendUnique(LIBS = ['connectivity_abstraction'])
-linux_sample_env.AppendUnique(LIBS = ['oc_logger'])
-linux_sample_env.AppendUnique(LIBS = ['octbstack'])
-linux_sample_env.AppendUnique(LIBS = ['oc'])
-linux_sample_env.AppendUnique(LIBS = ['pthread'])
+linux_sample_env.AppendUnique(CPPPATH=['include'])
+linux_sample_env.AppendUnique(CXXFLAGS=['-Wall', '-pthread', '-std=c++0x'])
+linux_sample_env.AppendUnique(CPPDEFINES=['LINUX'])
+linux_sample_env.AppendUnique(LIBPATH=[env.get('BUILD_DIR')])
+linux_sample_env.AppendUnique(LIBS=[
+    'coap',
+    'connectivity_abstraction',
+    'oc_logger',
+    'octbstack',
+    'oc',
+    'pthread',
+])
 
 if env.get('SECURED') == '1':
-       linux_sample_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509', 'mbedcrypto'])
+    linux_sample_env.AppendUnique(LIBS=['mbedtls', 'mbedx509', 'mbedcrypto'])
 #
 # On some platforms link order can miss functions so librt needs to be
 # re-scanned at the end if present. gcc 4.6 is one with this issue.
 if 'rt' in linux_sample_env.get('LIBS'):
-    linux_sample_env.Append(LIBS = ['rt'])
+    linux_sample_env.Append(LIBS=['rt'])
 
 ######################################################################
 #build sampleapp
 ######################################################################
-thsensorapp = linux_sample_env.Program('THSensorApp', 'src/ThingResourceServer.cpp')
+thsensorapp = linux_sample_env.Program('THSensorApp',
+                                       'src/ThingResourceServer.cpp')
 Alias("thsensorapp_sample", thsensorapp)
 env.AppendTarget('thsensorapp_sample')
index 173e190..2452f1a 100644 (file)
@@ -5,33 +5,37 @@
 Import('env linux_sample_env')
 
 # Add third party libraries
-SConscript('#service/third_party_libs.scons', exports = { 'lib_env' : linux_sample_env })
+SConscript('#service/third_party_libs.scons',
+           exports={'lib_env': linux_sample_env})
 
 ######################################################################
 # Build flags
 ######################################################################
-linux_sample_env.AppendUnique(CPPPATH = ['include'])
-linux_sample_env.AppendUnique(CXXFLAGS = ['-Wall', '-pthread','-std=c++0x'])
-linux_sample_env.AppendUnique(CPPDEFINES = ['LINUX'])
-linux_sample_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
-linux_sample_env.AppendUnique(LIBS = ['coap'])
-linux_sample_env.AppendUnique(LIBS = ['connectivity_abstraction'])
-linux_sample_env.AppendUnique(LIBS = ['oc_logger'])
-linux_sample_env.AppendUnique(LIBS = ['octbstack'])
-linux_sample_env.AppendUnique(LIBS = ['oc'])
-linux_sample_env.AppendUnique(LIBS = ['pthread'])
+linux_sample_env.AppendUnique(CPPPATH=['include'])
+linux_sample_env.AppendUnique(CXXFLAGS=['-Wall', '-pthread', '-std=c++0x'])
+linux_sample_env.AppendUnique(CPPDEFINES=['LINUX'])
+linux_sample_env.AppendUnique(LIBPATH=[env.get('BUILD_DIR')])
+linux_sample_env.AppendUnique(LIBS=[
+    'coap',
+    'connectivity_abstraction',
+    'oc_logger',
+    'octbstack',
+    'oc',
+    'pthread',
+])
 
 if env.get('SECURED') == '1':
-       linux_sample_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509', 'mbedcrypto'])
+    linux_sample_env.AppendUnique(LIBS=['mbedtls', 'mbedx509', 'mbedcrypto'])
 
 # On some platforms link order can miss functions so librt needs to be
 # re-scanned at the end if present. gcc 4.6 is one with this issue.
 if 'rt' in linux_sample_env.get('LIBS'):
-    linux_sample_env.Append(LIBS = ['rt'])
+    linux_sample_env.Append(LIBS=['rt'])
 
 ######################################################################
 #build sampleapp
 ######################################################################
-thsensorapp1 = linux_sample_env.Program('THSensorApp1', 'src/ThingResourceServer1.cpp')
+thsensorapp1 = linux_sample_env.Program('THSensorApp1',
+                                        'src/ThingResourceServer1.cpp')
 Alias("thsensorapp1_sample", thsensorapp1)
 env.AppendTarget('thsensorapp1_sample')
index 0ef115d..4b0581d 100644 (file)
@@ -23,6 +23,7 @@
 ##
 import os
 import os.path
+from tools.scons.RunTest import run_test
 
 # SConscript file for Local PKI google tests
 gtest_env = SConscript('#extlibs/gtest/SConscript')
@@ -31,24 +32,29 @@ target_os = lib_env.get('TARGET_OS')
 src_dir = lib_env.get('SRC_DIR')
 rd_mode = lib_env.get('RD_MODE')
 
-containerJavaSupport = ARGUMENTS.get('containerJavaSupport',0)
+containerJavaSupport = ARGUMENTS.get('containerJavaSupport', 0)
 
-def filtered_glob(env, pattern, omit=[],
-  ondisk=True, source=False, strings=False):
-    return filter(
-      lambda f: os.path.basename(f.path) not in omit,
-      lib_env.Glob(pattern))
 
-lib_env.AddMethod(filtered_glob, "FilteredGlob");
+def filtered_glob(env,
+                  pattern,
+                  omit=[],
+                  ondisk=True,
+                  source=False,
+                  strings=False):
+    return filter(lambda f: os.path.basename(f.path) not in omit,
+                  lib_env.Glob(pattern))
+
+
+lib_env.AddMethod(filtered_glob, "FilteredGlob")
 
 if lib_env.get('RELEASE'):
-    lib_env.AppendUnique(CCFLAGS = ['-Os'])
-    lib_env.AppendUnique(CPPDEFINES = ['NDEBUG'])
+    lib_env.AppendUnique(CCFLAGS=['-Os'])
+    lib_env.AppendUnique(CPPDEFINES=['NDEBUG'])
 else:
-    lib_env.AppendUnique(CCFLAGS = ['-g'])
+    lib_env.AppendUnique(CCFLAGS=['-g'])
 
 if lib_env.get('LOGGING'):
-    lib_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
+    lib_env.AppendUnique(CPPDEFINES=['TB_LOG'])
 
 # Add third party libraries
 SConscript(src_dir + '/service/third_party_libs.scons', 'lib_env')
@@ -59,72 +65,76 @@ if int(containerJavaSupport):
     try:
         print 'Java Home: ', os.environ['JAVA_HOME']
         print 'Java Lib: ', os.environ['JAVA_LIB']
-        container_gtest_env.Append(CPPDEFINES={'JAVA_SUPPORT_TEST':1})
+        container_gtest_env.Append(CPPDEFINES={'JAVA_SUPPORT_TEST': 1})
     except KeyError:
         print '''
-    *********************************** Error *************************************
-    * Building resource container without Java support. JAVA_HOME or JAVA_LIB are not set properly
-    * Please configure JAVA_HOME to point to your Java 7 JDK and
-    * JAVA_LIB to your folder containing libjvm
-    * Example: export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-i386
-    *          export JAVA_LIB=/usr/lib/jvm/java-7-openjdk-i386/jre/lib/i386/server/
-    *******************************************************************************
-        '''
-        container_gtest_env.Append(CPPDEFINES={'JAVA_SUPPORT_TEST':0})
-
-
+*********************************** Error *************************************
+* Building resource container without Java support. JAVA_HOME or JAVA_LIB are not set properly
+* Please configure JAVA_HOME to point to your Java 7 JDK and
+* JAVA_LIB to your folder containing libjvm
+* Example: export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-i386
+*          export JAVA_LIB=/usr/lib/jvm/java-7-openjdk-i386/jre/lib/i386/server/
+*******************************************************************************
+'''
+        container_gtest_env.Append(CPPDEFINES={'JAVA_SUPPORT_TEST': 0})
 
 ######################### unit test setting ##########################
 ######################################################################
 
-
 ######################################################################
 # Build flags
 ######################################################################
-container_gtest_env.AppendUnique(
-    CPPPATH = [
-        '#/extlibs',
-        '../include',
-        '../../resource-encapsulation/include',
-        '../../resource-encapsulation/src/common/utils/include',
-        '../bundle-api/include',
-        '../src',
-        '#/resource/include',
-        '#/resource/csdk/include',
-        '#/resource/csdk/stack/include',
-        '#/resource/oc_logger/include'
-    ])
+container_gtest_env.AppendUnique(CPPPATH=[
+    '#/extlibs',
+    '../include',
+    '../../resource-encapsulation/include',
+    '../../resource-encapsulation/src/common/utils/include',
+    '../bundle-api/include',
+    '../src',
+    '#/resource/include',
+    '#/resource/csdk/include',
+    '#/resource/csdk/stack/include',
+    '#/resource/oc_logger/include'
+])
 
 if int(containerJavaSupport):
     try:
-        container_gtest_env.AppendUnique(
-        CPPPATH = [
-            os.environ['JAVA_HOME']+'/include',
-            os.environ['JAVA_HOME']+'/include/linux'
+        container_gtest_env.AppendUnique(CPPPATH=[
+            os.environ['JAVA_HOME'] + '/include',
+            os.environ['JAVA_HOME'] + '/include/linux'
         ])
     except KeyError:
         print ''
 
 if target_os not in ['windows']:
-    container_gtest_env.AppendUnique(LIBS = ['dl'])
-    container_gtest_env.AppendUnique(CCFLAGS = ['-Wnoexcept'])
+    container_gtest_env.AppendUnique(LIBS=['dl'])
+    container_gtest_env.AppendUnique(CCFLAGS=['-Wnoexcept'])
 
-container_gtest_env.PrependUnique(LIBS = ['rcs_container', 'rcs_client', 'rcs_server', 'rcs_common',
-  'oc','octbstack', 'oc_logger', 'oc_logger_core',
-  'connectivity_abstraction'])
+container_gtest_env.PrependUnique(LIBS=[
+    'rcs_container',
+    'rcs_client',
+    'rcs_server',
+    'rcs_common',
+    'oc',
+    'octbstack',
+    'oc_logger',
+    'oc_logger_core',
+    'connectivity_abstraction',
+])
 
 if target_os in ['android']:
-    container_gtest_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
-    container_gtest_env.PrependUnique(LIBS = ['gnustl_shared', 'compatibility', 'log'])
+    container_gtest_env.AppendUnique(CXXFLAGS=['-frtti', '-fexceptions'])
+    container_gtest_env.PrependUnique(
+        LIBS=['gnustl_shared', 'compatibility', 'log'])
 
-container_gtest_env.PrependUnique(CPPPATH = ['#/extlibs/hippomocks/hippomocks'])
+container_gtest_env.PrependUnique(CPPPATH=['#/extlibs/hippomocks/hippomocks'])
 
 if int(containerJavaSupport):
     try:
-        container_gtest_env.AppendUnique(LIBPATH = [os.environ['JAVA_LIB']])
+        container_gtest_env.AppendUnique(LIBPATH=[os.environ['JAVA_LIB']])
     except KeyError:
         print ''
-container_gtest_env.PrependUnique(LIBS = [
+container_gtest_env.PrependUnique(LIBS=[
     'rcs_container',
     'rcs_client',
     'rcs_server',
@@ -134,70 +144,76 @@ container_gtest_env.PrependUnique(LIBS = [
     'oc_logger',
     'oc_logger_core',
     'connectivity_abstraction',
-    'gtest',
-    'gtest_main',
-    'boost_system'])
+    'boost_system'
+])
 
 if int(containerJavaSupport):
     try:
         print 'Java Lib: ', os.environ['JAVA_LIB']
-        container_gtest_env.AppendUnique(LIBS = ['jvm'])
+        container_gtest_env.AppendUnique(LIBS=['jvm'])
     except KeyError:
         print ''
 
 if container_gtest_env.get('SECURED') == '1':
-    container_gtest_env.AppendUnique(CPPDEFINES = ['SECURED'])
-    container_gtest_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509', 'mbedcrypto'])
+    container_gtest_env.AppendUnique(CPPDEFINES=['SECURED'])
+    container_gtest_env.AppendUnique(
+        LIBS=['mbedtls', 'mbedx509', 'mbedcrypto'])
 
 if 'CLIENT' in rd_mode or 'SERVER' in rd_mode:
-       container_gtest_env.AppendUnique(LIBS = ['resource_directory'])
+    container_gtest_env.AppendUnique(LIBS=['resource_directory'])
 
 ######################################################################
 # build test bundle
 ######################################################################
 test_bundle_env = container_gtest_env.Clone()
-test_bundle_env.AppendUnique(CCFLAGS = ['-fPIC'])
+test_bundle_env.AppendUnique(CCFLAGS=['-fPIC'])
 
 if target_os not in ['darwin', 'ios', 'windows']:
-    test_bundle_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
+    test_bundle_env.AppendUnique(LINKFLAGS=['-Wl,--no-undefined'])
 
 TEST_BUNDLE_DIR = 'TestBundle/'
-test_bundle_env.AppendUnique(CPPPATH = [
-        TEST_BUNDLE_DIR + 'include'
-        ])
+test_bundle_env.AppendUnique(CPPPATH=[TEST_BUNDLE_DIR + 'include'])
 
-test_bundle_src = [ Glob(TEST_BUNDLE_DIR + 'src/*.cpp'), Glob('src/*.cpp')]
+test_bundle_src = [Glob(TEST_BUNDLE_DIR + 'src/*.cpp'), Glob('src/*.cpp')]
 
 TestBundle = test_bundle_env.SharedLibrary('TestBundle', test_bundle_src)
 test_bundle_env.InstallTarget(TestBundle, 'libTestBundle')
 
-
 ######################################################################
 # Build Test
 ######################################################################
 if 'g++' in container_gtest_env.get('CXX'):
-    container_gtest_env.AppendUnique(CXXFLAGS = ['-std=c++0x'])
+    container_gtest_env.AppendUnique(CXXFLAGS=['-std=c++0x'])
 
 container_gtest_src = container_gtest_env.Glob('./ResourceContainerTest.cpp')
 
-container_test = container_gtest_env.Program('container_test', container_gtest_src)
+container_test = container_gtest_env.Program('container_test',
+                                             container_gtest_src)
 Alias("container_test", container_test)
 container_gtest_env.AppendTarget('container_test')
 
 # Copy test configuration
-Command("./ResourceContainerTestConfig.xml","./ResourceContainerTestConfig.xml", Copy("$TARGET", "$SOURCE"))
-Ignore("./ResourceContainerTestConfig.xml", "./ResourceContainerTestConfig.xml")
-Command("./ResourceContainerInvalidConfig.xml","./ResourceContainerInvalidConfig.xml", Copy("$TARGET", "$SOURCE"))
-Ignore("./ResourceContainerInvalidConfig.xml", "./ResourceContainerInvalidConfig.xml")
-Command("./TestBundleJava/hue-0.1-jar-with-dependencies.jar","./TestBundleJava/hue-0.1-jar-with-dependencies.jar", Copy("$TARGET", "$SOURCE"))
-Ignore("./TestBundleJava/hue-0.1-jar-with-dependencies.jar", "./TestBundleJava/hue-0.1-jar-with-dependencies.jar")
-
-# TODO: fix this test and edit commented lines
+Command("./ResourceContainerTestConfig.xml",
+        "./ResourceContainerTestConfig.xml", Copy("$TARGET", "$SOURCE"))
+Ignore("./ResourceContainerTestConfig.xml",
+       "./ResourceContainerTestConfig.xml")
+Command("./ResourceContainerInvalidConfig.xml",
+        "./ResourceContainerInvalidConfig.xml", Copy("$TARGET", "$SOURCE"))
+Ignore("./ResourceContainerInvalidConfig.xml",
+       "./ResourceContainerInvalidConfig.xml")
+Command("./TestBundleJava/hue-0.1-jar-with-dependencies.jar",
+        "./TestBundleJava/hue-0.1-jar-with-dependencies.jar",
+        Copy("$TARGET", "$SOURCE"))
+Ignore("./TestBundleJava/hue-0.1-jar-with-dependencies.jar",
+       "./TestBundleJava/hue-0.1-jar-with-dependencies.jar")
+
+# TODO: fix this test and edit commented lines and target_os
 if container_gtest_env.get('TEST') == '1':
-    if target_os in ['TODO/linux'] and container_gtest_env.get('SECURED') != '1':
-        from tools.scons.RunTest import run_test
-        run_test(container_gtest_env,
-#                'service_resource-container_unittests_container_test.memcheck',
-                 '',
-                 'service/resource-container/unittests/container_test',
-                 container_test)
+    if target_os in ['TODO/linux'
+                     ] and container_gtest_env.get('SECURED') != '1':
+        run_test(
+            container_gtest_env,
+            #'service_resource-container_unittests_container_test.memcheck',
+            '',
+            'service/resource-container/unittests/container_test',
+            container_test)
index 70b4328..1d3ef4c 100644 (file)
@@ -32,18 +32,18 @@ SConscript('src/serverBuilder/SConscript')
 ######################################################################
 
 if env.get('RELEASE'):
-    env.AppendUnique(CCFLAGS = ['-Os'])
-    env.AppendUnique(CPPDEFINES = ['NDEBUG'])
+    env.AppendUnique(CCFLAGS=['-Os'])
+    env.AppendUnique(CPPDEFINES=['NDEBUG'])
 else:
-    env.AppendUnique(CCFLAGS = ['-g'])
+    env.AppendUnique(CCFLAGS=['-g'])
 
 if env.get('LOGGING'):
-    env.AppendUnique(CPPDEFINES = ['TB_LOG'])
+    env.AppendUnique(CPPDEFINES=['TB_LOG'])
 
 target_os = env.get('TARGET_OS')
 
 if target_os in ['ios']:
-    env.AppendUnique(CPPDEFINES = ['TARGET_OS_IPHONE'])
+    env.AppendUnique(CPPDEFINES=['TARGET_OS_IPHONE'])
 
 # Add third party libraries
 lib_env = env.Clone()
@@ -54,7 +54,7 @@ resourceClient_env = lib_env.Clone()
 ######################################################################
 # Build flags
 ######################################################################
-resourceClient_env.AppendUnique(CPPPATH = [
+resourceClient_env.AppendUnique(CPPPATH=[
     'include',
     '#/resource/include',
     '#/resource/csdk/include',
@@ -67,23 +67,24 @@ resourceClient_env.AppendUnique(CPPPATH = [
     'src/resourceCache/include'
 ])
 
-resourceClient_env.PrependUnique(LIBS = ['oc', 'rcs_common', 'octbstack','oc_logger'])
+resourceClient_env.PrependUnique(
+    LIBS=['oc', 'rcs_common', 'octbstack', 'oc_logger'])
 
 if target_os not in ['windows']:
-    resourceClient_env.AppendUnique(CXXFLAGS = ['-Wall', '-std=c++0x'])
-    resourceClient_env.AppendUnique(LIBS = ['dl'])
+    resourceClient_env.AppendUnique(CXXFLAGS=['-Wall', '-std=c++0x'])
+    resourceClient_env.AppendUnique(LIBS=['dl'])
     if target_os in ['linux']:
-        resourceClient_env.AppendUnique(LIBS = ['pthread'])
+        resourceClient_env.AppendUnique(LIBS=['pthread'])
 
 if target_os in ['android']:
-    resourceClient_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
-    resourceClient_env.PrependUnique(LIBS = ['gnustl_shared', 'log'])
-    resourceClient_env.AppendUnique(LINKFLAGS = ['-Wl,-soname,librcs_client.so'])
+    resourceClient_env.AppendUnique(CXXFLAGS=['-frtti', '-fexceptions'])
+    resourceClient_env.PrependUnique(LIBS=['gnustl_shared', 'log'])
+    resourceClient_env.AppendUnique(LINKFLAGS=['-Wl,-soname,librcs_client.so'])
 
 if target_os in ['linux']:
     if not env.get('RELEASE'):
-        resourceClient_env.PrependUnique(LIBS = ['gcov'])
-        resourceClient_env.AppendUnique(CXXFLAGS = ['--coverage'])
+        resourceClient_env.PrependUnique(LIBS=['gcov'])
+        resourceClient_env.AppendUnique(CXXFLAGS=['--coverage'])
 
 ######################################################################
 # Source files and Targets
@@ -93,35 +94,56 @@ CACHE_SRC_DIR = 'src/resourceCache/src/'
 RESOURCECLIENT_DIR = 'src/resourceClient/'
 
 client_src = [
-        BROKER_SRC_DIR + 'DeviceAssociation.cpp',
-        BROKER_SRC_DIR + 'DevicePresence.cpp',
-        BROKER_SRC_DIR + 'ResourcePresence.cpp',
-        BROKER_SRC_DIR + 'ResourceBroker.cpp',
-        CACHE_SRC_DIR + 'DataCache.cpp',
-        CACHE_SRC_DIR + 'ResourceCacheManager.cpp',
-        CACHE_SRC_DIR + 'ObserveCache.cpp',
-        RESOURCECLIENT_DIR + 'RCSDiscoveryManager.cpp',
-        RESOURCECLIENT_DIR + 'RCSDiscoveryManagerImpl.cpp',
-        RESOURCECLIENT_DIR + 'RCSRemoteResourceObject.cpp'
-        ]
-ResourceClientsdk_static = resourceClient_env.StaticLibrary('rcs_client', client_src)
+    BROKER_SRC_DIR + 'DeviceAssociation.cpp',
+    BROKER_SRC_DIR + 'DevicePresence.cpp',
+    BROKER_SRC_DIR + 'ResourcePresence.cpp',
+    BROKER_SRC_DIR + 'ResourceBroker.cpp', CACHE_SRC_DIR + 'DataCache.cpp',
+    CACHE_SRC_DIR + 'ResourceCacheManager.cpp',
+    CACHE_SRC_DIR + 'ObserveCache.cpp',
+    RESOURCECLIENT_DIR + 'RCSDiscoveryManager.cpp',
+    RESOURCECLIENT_DIR + 'RCSDiscoveryManagerImpl.cpp',
+    RESOURCECLIENT_DIR + 'RCSRemoteResourceObject.cpp'
+]
+ResourceClientsdk_static = resourceClient_env.StaticLibrary(
+    'rcs_client', client_src)
 if target_os not in ['ios']:
-    ResourceClientsdk_shared = resourceClient_env.SharedLibrary('rcs_client', client_src)
-    resourceClient_env.InstallTarget([ResourceClientsdk_static,ResourceClientsdk_shared], 'rcs_client')
-    resourceClient_env.UserInstallTargetLib([ResourceClientsdk_static,ResourceClientsdk_shared], 'rcs_client')
+    ResourceClientsdk_shared = resourceClient_env.SharedLibrary(
+        'rcs_client', client_src)
+    resourceClient_env.InstallTarget(
+        [ResourceClientsdk_static, ResourceClientsdk_shared], 'rcs_client')
+    resourceClient_env.UserInstallTargetLib(
+        [ResourceClientsdk_static, ResourceClientsdk_shared], 'rcs_client')
 else:
     resourceClient_env.InstallTarget([ResourceClientsdk_static], 'rcs_client')
-    resourceClient_env.UserInstallTargetLib([ResourceClientsdk_static], 'rcs_client')
-resourceClient_env.UserInstallTargetHeader('include/RCSAddress.h', 'service/resource-encapsulation', 'RCSAddress.h')
-resourceClient_env.UserInstallTargetHeader('include/RCSDiscoveryManager.h', 'service/resource-encapsulation', 'RCSDiscoveryManager.h')
-resourceClient_env.UserInstallTargetHeader('include/RCSRemoteResourceObject.h', 'service/resource-encapsulation', 'RCSRemoteResourceObject.h')
-resourceClient_env.UserInstallTargetHeader('include/RCSResourceAttributes.h', 'service/resource-encapsulation', 'RCSResourceAttributes.h')
-resourceClient_env.UserInstallTargetHeader('include/RCSResourceObject.h', 'service/resource-encapsulation', 'RCSResourceObject.h')
-resourceClient_env.UserInstallTargetHeader('include/RCSException.h', 'service/resource-encapsulation', 'RCSException.h')
-resourceClient_env.UserInstallTargetHeader('include/RCSRequest.h', 'service/resource-encapsulation', 'RCSRequest.h')
-resourceClient_env.UserInstallTargetHeader('include/RCSResponse.h', 'service/resource-encapsulation', 'RCSResponse.h')
-resourceClient_env.UserInstallTargetHeader('include/RCSRepresentation.h', 'service/resource-encapsulation', 'RCSRepresentation.h')
-resourceClient_env.UserInstallTargetHeader('include/RCSSeparateResponse.h', 'service/resource-encapsulation', 'RCSSeparateResponse.h')
+    resourceClient_env.UserInstallTargetLib([ResourceClientsdk_static],
+                                            'rcs_client')
+resourceClient_env.UserInstallTargetHeader(
+    'include/RCSAddress.h', 'service/resource-encapsulation', 'RCSAddress.h')
+resourceClient_env.UserInstallTargetHeader('include/RCSDiscoveryManager.h',
+                                           'service/resource-encapsulation',
+                                           'RCSDiscoveryManager.h')
+resourceClient_env.UserInstallTargetHeader('include/RCSRemoteResourceObject.h',
+                                           'service/resource-encapsulation',
+                                           'RCSRemoteResourceObject.h')
+resourceClient_env.UserInstallTargetHeader('include/RCSResourceAttributes.h',
+                                           'service/resource-encapsulation',
+                                           'RCSResourceAttributes.h')
+resourceClient_env.UserInstallTargetHeader('include/RCSResourceObject.h',
+                                           'service/resource-encapsulation',
+                                           'RCSResourceObject.h')
+resourceClient_env.UserInstallTargetHeader('include/RCSException.h',
+                                           'service/resource-encapsulation',
+                                           'RCSException.h')
+resourceClient_env.UserInstallTargetHeader(
+    'include/RCSRequest.h', 'service/resource-encapsulation', 'RCSRequest.h')
+resourceClient_env.UserInstallTargetHeader(
+    'include/RCSResponse.h', 'service/resource-encapsulation', 'RCSResponse.h')
+resourceClient_env.UserInstallTargetHeader('include/RCSRepresentation.h',
+                                           'service/resource-encapsulation',
+                                           'RCSRepresentation.h')
+resourceClient_env.UserInstallTargetHeader('include/RCSSeparateResponse.h',
+                                           'service/resource-encapsulation',
+                                           'RCSSeparateResponse.h')
 
 ######################################################################
 # Build Sample App: SampleResourceClient & SampleResourceServer
@@ -129,7 +151,7 @@ resourceClient_env.UserInstallTargetHeader('include/RCSSeparateResponse.h', 'ser
 SConscript('examples/SConscript')
 
 ######################################################################
-# Build UnitTests Resource Client , resourceCache and resourceBroker and 
+# Build UnitTests Resource Client , resourceCache and resourceBroker and
 # DiscoveryManager
 ################################################ ######################
 if target_os in ['linux']:
index 3dc6268..a56c006 100644 (file)
@@ -6,14 +6,16 @@ android_home = env.get('ANDROID_HOME')
 
 ANDROID_TARGET_ARCH = env.get('TARGET_ARCH')
 if env.get('RELEASE'):
-       ANDROID_RELEASE="release"
+    ANDROID_RELEASE = "release"
 else:
-       ANDROID_RELEASE="debug"
+    ANDROID_RELEASE = "debug"
 
 os.environ['ANDROID_HOME'] = env.get('ANDROID_HOME')
 os.environ['ANDROID_NDK_HOME'] = env.get('ANDROID_NDK')
 
-if not os.path.exists(android_home + '/platforms/android-21') or not os.path.exists(android_home + '/build-tools/20.0.0'):
+if not os.path.exists(android_home +
+                      '/platforms/android-21') or not os.path.exists(
+                          android_home + '/build-tools/20.0.0'):
     print '''
 ***************************************** Info ********************************
 *   Either 'Android API 21' is not installed or 'Android SDK Build Tools      *
@@ -44,47 +46,78 @@ if not os.path.exists(android_home + '/platforms/android-21') or not os.path.exi
 
 
 def ensure_libs(target, source, env):
-    return target, [source, env.get('BUILD_DIR') + 'librcs_server.so',
-                    env.get('BUILD_DIR') + 'librcs_client.so']
+    return target, [
+        source,
+        env.get('BUILD_DIR') + 'librcs_server.so',
+        env.get('BUILD_DIR') + 'librcs_client.so'
+    ]
+
 
 jdk_env = Environment(ENV=os.environ)
-jdk_env['BUILDERS']['Gradle'] = Builder(action = env.get('ANDROID_GRADLE') +
-    ' build -bservice/resource-encapsulation/android/build.gradle -PTARGET_ARCH=%s -PRELEASE=%s --stacktrace' %(ANDROID_TARGET_ARCH, ANDROID_RELEASE),
-    emitter = ensure_libs)
+jdk_env['BUILDERS']['Gradle'] = Builder(
+    action=env.get('ANDROID_GRADLE') +
+    ' build -bservice/resource-encapsulation/android/build.gradle -PTARGET_ARCH=%s -PRELEASE=%s --stacktrace'
+    % (ANDROID_TARGET_ARCH, ANDROID_RELEASE),
+    emitter=ensure_libs)
 jdk_env['BUILD_DIR'] = env.get('BUILD_DIR')
-cmdBuildRE = jdk_env.Gradle(target="service/objs",
-    source="service/src/main/java/org/iotivity/service/RcsResourceAttributes.java")
+cmdBuildRE = jdk_env.Gradle(
+    target="service/objs",
+    source=
+    "service/src/main/java/org/iotivity/service/RcsResourceAttributes.java")
 jdk_env.Clean(cmdBuildRE, '#/service/resource-encapsulation/android/build')
-jdk_env.Clean(cmdBuildRE, '#/service/resource-encapsulation/android/service/build')
-env.AppendUnique(resourceencapsulationAAR = cmdBuildRE)
+jdk_env.Clean(cmdBuildRE,
+              '#/service/resource-encapsulation/android/service/build')
+env.AppendUnique(resourceencapsulationAAR=cmdBuildRE)
 
 Depends(cmdBuildRE, env.get('baseAAR'))
 
 # Build RE Android Samples
 re_sample_server_env = Environment(ENV=os.environ)
-re_sample_server_env['BUILDERS']['Gradle'] = Builder(action = env.get('ANDROID_GRADLE') +
-    ' build -bservice/resource-encapsulation/examples/android/RESampleServerApp/build.gradle -PTARGET_ARCH=%s -PRELEASE=%s --stacktrace' %(ANDROID_TARGET_ARCH, ANDROID_RELEASE),
-    emitter = ensure_libs)
+re_sample_server_env['BUILDERS']['Gradle'] = Builder(
+    action=env.get('ANDROID_GRADLE') +
+    ' build -bservice/resource-encapsulation/examples/android/RESampleServerApp/build.gradle -PTARGET_ARCH=%s -PRELEASE=%s --stacktrace'
+    % (ANDROID_TARGET_ARCH, ANDROID_RELEASE),
+    emitter=ensure_libs)
 re_sample_server_env['BUILD_DIR'] = env.get('BUILD_DIR')
-cmdBuildREServerApp=re_sample_server_env.Gradle(target="../examples/android/RESampleServerApp/app/apk",
-    source=["../examples/android/RESampleServerApp/app/src/main/java/org/iotivity/service/sample/server/MainActivity.java",
-            "../examples/android/RESampleServerApp/app/src/main/java/org/iotivity/service/sample/server/CustomServerActivity.java",
-            "../examples/android/RESampleServerApp/app/src/main/java/org/iotivity/service/sample/server/ResourceProperties.java",
-            "../examples/android/RESampleServerApp/app/src/main/java/org/iotivity/service/sample/server/SimpleServerActivity.java"])
-jdk_env.Clean(cmdBuildREServerApp, '#/service/resource-encapsulation/examples/android/RESampleServerApp/build')
-jdk_env.Clean(cmdBuildREServerApp, '#/service/resource-encapsulation/examples/android/RESampleServerApp/app/build')
+cmdBuildREServerApp = re_sample_server_env.Gradle(
+    target="../examples/android/RESampleServerApp/app/apk",
+    source=[
+        "../examples/android/RESampleServerApp/app/src/main/java/org/iotivity/service/sample/server/MainActivity.java",
+        "../examples/android/RESampleServerApp/app/src/main/java/org/iotivity/service/sample/server/CustomServerActivity.java",
+        "../examples/android/RESampleServerApp/app/src/main/java/org/iotivity/service/sample/server/ResourceProperties.java",
+        "../examples/android/RESampleServerApp/app/src/main/java/org/iotivity/service/sample/server/SimpleServerActivity.java"
+    ])
+jdk_env.Clean(
+    cmdBuildREServerApp,
+    '#/service/resource-encapsulation/examples/android/RESampleServerApp/build'
+)
+jdk_env.Clean(
+    cmdBuildREServerApp,
+    '#/service/resource-encapsulation/examples/android/RESampleServerApp/app/build'
+)
 Depends(cmdBuildREServerApp, cmdBuildRE)
 
 re_sample_client_env = Environment(ENV=os.environ)
-re_sample_client_env['BUILDERS']['Gradle'] = Builder(action = env.get('ANDROID_GRADLE') +
-    ' build -bservice/resource-encapsulation/examples/android/RESampleClientApp/build.gradle -PTARGET_ARCH=%s -PRELEASE=%s --stacktrace' %(ANDROID_TARGET_ARCH, ANDROID_RELEASE),
-    emitter = ensure_libs)
+re_sample_client_env['BUILDERS']['Gradle'] = Builder(
+    action=env.get('ANDROID_GRADLE') +
+    ' build -bservice/resource-encapsulation/examples/android/RESampleClientApp/build.gradle -PTARGET_ARCH=%s -PRELEASE=%s --stacktrace'
+    % (ANDROID_TARGET_ARCH, ANDROID_RELEASE),
+    emitter=ensure_libs)
 re_sample_client_env['BUILD_DIR'] = env.get('BUILD_DIR')
-cmdBuildREClientApp=re_sample_client_env.Gradle(target="../examples/android/RESampleClientApp/app/apk",
-    source=["../examples/android/RESampleClientApp/app/src/main/java/org/iotivity/service/sample/client/MainActivity.java",
-            "../examples/android/RESampleClientApp/app/src/main/java/org/iotivity/service/sample/client/ResourceClientActivity.java"])
-jdk_env.Clean(cmdBuildREClientApp, '#/service/resource-encapsulation/examples/android/RESampleClientApp/build')
-jdk_env.Clean(cmdBuildREClientApp, '#/service/resource-encapsulation/examples/android/RESampleClientApp/app/build')
+cmdBuildREClientApp = re_sample_client_env.Gradle(
+    target="../examples/android/RESampleClientApp/app/apk",
+    source=[
+        "../examples/android/RESampleClientApp/app/src/main/java/org/iotivity/service/sample/client/MainActivity.java",
+        "../examples/android/RESampleClientApp/app/src/main/java/org/iotivity/service/sample/client/ResourceClientActivity.java"
+    ])
+jdk_env.Clean(
+    cmdBuildREClientApp,
+    '#/service/resource-encapsulation/examples/android/RESampleClientApp/build'
+)
+jdk_env.Clean(
+    cmdBuildREClientApp,
+    '#/service/resource-encapsulation/examples/android/RESampleClientApp/app/build'
+)
 Depends(cmdBuildREClientApp, cmdBuildRE)
 
 
index 42407fa..1114330 100644 (file)
@@ -29,17 +29,12 @@ SConscript('#service/third_party_libs.scons', 'lib_env')
 
 sample_env = lib_env.Clone()
 
-sample_env.AppendUnique(CXXFLAGS = ['-Wall', '-std=c++0x'])
-sample_env.AppendUnique(LIBS = [
-    'coap',
-    'connectivity_abstraction',
-    'oc_logger',
-    'octbstack',
-    'oc',
-    'rcs_common',
-    'pthread'
-    ])
-sample_env.AppendUnique(CPPPATH = [
+sample_env.AppendUnique(CXXFLAGS=['-Wall', '-std=c++0x'])
+sample_env.AppendUnique(LIBS=[
+    'coap', 'connectivity_abstraction', 'oc_logger', 'octbstack', 'oc',
+    'rcs_common', 'pthread'
+])
+sample_env.AppendUnique(CPPPATH=[
     '../../include',
     '#/resource/csdk/include',
     '#/resource/csdk/stack/include',
@@ -48,26 +43,31 @@ sample_env.AppendUnique(CPPPATH = [
 ])
 
 if env.get('SECURED') == '1':
-    sample_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509', 'mbedcrypto'])
+    sample_env.AppendUnique(LIBS=['mbedtls', 'mbedx509', 'mbedcrypto'])
 
 if 'rt' in sample_env.get('LIBS'):
-    sample_env.Append(LIBS = ['rt'])
+    sample_env.Append(LIBS=['rt'])
 
 ######################################################################
 # ##### Client #####
 ######################################################################
 client_env = sample_env.Clone()
-client_env.AppendUnique(LIBS = 'rcs_client')
+client_env.AppendUnique(LIBS='rcs_client')
 
-sampleResourceClient = client_env.Program('sampleResourceClient', 'SampleResourceClient.cpp')
-nestedAttributesClient = client_env.Program('nestedAttributesClient', 'NestedAttributesClient.cpp')
+sampleResourceClient = client_env.Program('sampleResourceClient',
+                                          'SampleResourceClient.cpp')
+nestedAttributesClient = client_env.Program('nestedAttributesClient',
+                                            'NestedAttributesClient.cpp')
 
 ######################################################################
 # ##### Server #####
 ######################################################################
 server_env = sample_env.Clone()
-server_env.AppendUnique(LIBS = 'rcs_server')
+server_env.AppendUnique(LIBS='rcs_server')
 
-sampleResourceServer = server_env.Program('sampleResourceServer', 'SampleResourceServer.cpp')
-separateResponseServer = server_env.Program('separateResponseServer', 'SeparateResponseServer.cpp')
-nestedAttributesServer = server_env.Program('nestedAttributesServer', 'NestedAttributesServer.cpp')
+sampleResourceServer = server_env.Program('sampleResourceServer',
+                                          'SampleResourceServer.cpp')
+separateResponseServer = server_env.Program('separateResponseServer',
+                                            'SeparateResponseServer.cpp')
+nestedAttributesServer = server_env.Program('nestedAttributesServer',
+                                            'NestedAttributesServer.cpp')
index 83b5605..302ae07 100644 (file)
@@ -21,6 +21,7 @@
 ##
 # rcs_common (primitiveResource and expiryTimer) build script
 ##
+
 import os
 Import('env')
 
@@ -32,42 +33,41 @@ src_dir = rcs_common_env.get('SRC_DIR')
 ######################################################################
 # Build flags
 ######################################################################
-rcs_common_env.AppendUnique(CPPPATH = [
+rcs_common_env.AppendUnique(CPPPATH=[
     '#/extlibs',
     '#/resource/include',
     '#/resource/csdk/include',
     '#/resource/csdk/stack/include',
     '#/resource/oc_logger/include',
     '../../include',
-    'primitiveResource/include'])
+    'primitiveResource/include'
+])
 
-rcs_common_env.AppendUnique(CPPPATH = [
-    'expiryTimer/include',
-    'expiryTimer/src'])
+rcs_common_env.AppendUnique(CPPPATH=['expiryTimer/include', 'expiryTimer/src'])
 
-rcs_common_env.AppendUnique(LIBPATH = [rcs_common_env.get('BUILD_DIR')])
+rcs_common_env.AppendUnique(LIBPATH=[rcs_common_env.get('BUILD_DIR')])
 
 if target_os not in ['windows']:
-    rcs_common_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall'])
+    rcs_common_env.AppendUnique(CXXFLAGS=['-std=c++0x', '-Wall'])
 
 if target_os not in ['darwin', 'ios', 'windows']:
-    rcs_common_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
-    rcs_common_env.AppendUnique(LIBS = ['dl'])
+    rcs_common_env.AppendUnique(LINKFLAGS=['-Wl,--no-undefined'])
+    rcs_common_env.AppendUnique(LIBS=['dl'])
 
 if target_os == 'android':
-    rcs_common_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
-    rcs_common_env.PrependUnique(LIBS = ['gnustl_shared', 'log'])
-    rcs_common_env.AppendUnique(LINKFLAGS = ['-Wl,-soname,librcs_common.so'])
+    rcs_common_env.AppendUnique(CXXFLAGS=['-frtti', '-fexceptions'])
+    rcs_common_env.PrependUnique(LIBS=['gnustl_shared', 'log'])
+    rcs_common_env.AppendUnique(LINKFLAGS=['-Wl,-soname,librcs_common.so'])
 
-rcs_common_env.AppendUnique(LIBS = ['oc'])
+rcs_common_env.AppendUnique(LIBS=['oc'])
 
 if not release:
-    rcs_common_env.AppendUnique(CXXFLAGS = ['--coverage'])
-    rcs_common_env.PrependUnique(LIBS = ['gcov'])
+    rcs_common_env.AppendUnique(CXXFLAGS=['--coverage'])
+    rcs_common_env.PrependUnique(LIBS=['gcov'])
 
 if rcs_common_env.get('SECURED') == '1':
-       if rcs_common_env.get('WITH_TCP') == True:
-               rcs_common_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509', 'mbedcrypto'])
+    if rcs_common_env.get('WITH_TCP') == True:
+        rcs_common_env.AppendUnique(LIBS=['mbedtls', 'mbedx509', 'mbedcrypto'])
 
 ######################################################################
 # Source files and Targets
@@ -75,21 +75,22 @@ if rcs_common_env.get('SECURED') == '1':
 TIMER_SRC_DIR = 'expiryTimer/src/'
 RESOURCE_SRC = 'primitiveResource/src/'
 rcs_common_src = [
-        TIMER_SRC_DIR + 'ExpiryTimerImpl.cpp',
-        TIMER_SRC_DIR + 'ExpiryTimer.cpp',
-        RESOURCE_SRC + 'PresenceSubscriber.cpp',
-        RESOURCE_SRC + 'PrimitiveResource.cpp',
-        RESOURCE_SRC + 'RCSException.cpp',
-        RESOURCE_SRC + 'RCSAddress.cpp',
-        RESOURCE_SRC + 'RCSResourceAttributes.cpp',
-        RESOURCE_SRC + 'RCSRepresentation.cpp'
-        ]
+    TIMER_SRC_DIR + 'ExpiryTimerImpl.cpp', TIMER_SRC_DIR + 'ExpiryTimer.cpp',
+    RESOURCE_SRC + 'PresenceSubscriber.cpp',
+    RESOURCE_SRC + 'PrimitiveResource.cpp', RESOURCE_SRC + 'RCSException.cpp',
+    RESOURCE_SRC + 'RCSAddress.cpp',
+    RESOURCE_SRC + 'RCSResourceAttributes.cpp',
+    RESOURCE_SRC + 'RCSRepresentation.cpp'
+]
 
 rcs_common_static = rcs_common_env.StaticLibrary('rcs_common', rcs_common_src)
 if target_os not in ['ios']:
-    rcs_common_shared = rcs_common_env.SharedLibrary('rcs_common', rcs_common_src)
-    rcs_common_env.InstallTarget([rcs_common_static,rcs_common_shared], 'rcs_common')
-    rcs_common_env.UserInstallTargetLib([rcs_common_static,rcs_common_shared], 'rcs_common')
+    rcs_common_shared = rcs_common_env.SharedLibrary('rcs_common',
+                                                     rcs_common_src)
+    rcs_common_env.InstallTarget([rcs_common_static, rcs_common_shared],
+                                 'rcs_common')
+    rcs_common_env.UserInstallTargetLib([rcs_common_static, rcs_common_shared],
+                                        'rcs_common')
 else:
     rcs_common_env.InstallTarget([rcs_common_static], 'rcs_common')
     rcs_common_env.UserInstallTargetLib([rcs_common_static], 'rcs_common')
@@ -99,3 +100,4 @@ else:
 ######################################################################
 if target_os in ['linux']:
     SConscript('primitiveResource/unittests/SConscript')
+
index 0d07127..2e66098 100644 (file)
 # ResourceBroker Unit Test build script
 ##
 # SConscript file for Local PKI google tests
+
+from tools.scons.RunTest import run_test
+
 gtest_env = SConscript('#extlibs/gtest/SConscript')
 lib_env = gtest_env.Clone()
 
 if lib_env.get('RELEASE'):
-    lib_env.AppendUnique(CCFLAGS = ['-Os'])
-    lib_env.AppendUnique(CPPDEFINES = ['NDEBUG'])
+    lib_env.AppendUnique(CCFLAGS=['-Os'])
+    lib_env.AppendUnique(CPPDEFINES=['NDEBUG'])
 else:
-    lib_env.AppendUnique(CCFLAGS = ['-g'])
+    lib_env.AppendUnique(CCFLAGS=['-g'])
 
 if lib_env.get('LOGGING'):
-    lib_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
+    lib_env.AppendUnique(CPPDEFINES=['TB_LOG'])
 
 SConscript('#service/third_party_libs.scons', 'lib_env')
 
@@ -47,7 +50,7 @@ target_os = broker_test_env.get('TARGET_OS')
 # Build flags
 ######################################################################
 
-broker_test_env.AppendUnique(CPPPATH = [
+broker_test_env.AppendUnique(CPPPATH=[
     '../include',
     '../../../include',
     '../../common/primitiveResource/include',
@@ -60,23 +63,26 @@ broker_test_env.AppendUnique(CPPPATH = [
     '#/resource/oc_logger/include'
 ])
 
-broker_test_env.PrependUnique(CPPPATH = ['#/extlibs/hippomocks/hippomocks'])
-broker_test_env.AppendUnique(LIBPATH = [broker_test_env.get('BUILD_DIR')])
+broker_test_env.PrependUnique(CPPPATH=['#/extlibs/hippomocks/hippomocks'])
+broker_test_env.AppendUnique(LIBPATH=[broker_test_env.get('BUILD_DIR')])
 
-broker_test_env.PrependUnique(LIBS = ['coap'])
-broker_test_env.AppendUnique(LIBS = ['connectivity_abstraction'])
-broker_test_env.AppendUnique(LIBS = ['oc_logger'])
-broker_test_env.AppendUnique(LIBS = ['octbstack'])
-broker_test_env.AppendUnique(LIBS = ['oc'])
-broker_test_env.AppendUnique(LIBS = ['rcs_client'])
-broker_test_env.AppendUnique(LIBS = ['rcs_common'])
+broker_test_env.PrependUnique(LIBS=['coap'])
+broker_test_env.AppendUnique(LIBS=[
+'connectivity_abstraction',
+'oc_logger',
+'octbstack',
+'oc',
+'rcs_client',
+'rcs_common',
+])
 
 compiler = broker_test_env.get('CXX')
 if 'g++' in compiler:
-    broker_test_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x'])
+    broker_test_env.AppendUnique(
+        CXXFLAGS=['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x'])
 
 if broker_test_env.get('SECURED') == '1':
-    broker_test_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509', 'mbedcrypto'])
+    broker_test_env.AppendUnique(LIBS=['mbedtls', 'mbedx509', 'mbedcrypto'])
 
 ######################################################################
 # Build Test
@@ -89,10 +95,9 @@ broker_test_env.AppendTarget('broker_test')
 
 if broker_test_env.get('TEST') == '1':
     if target_os in ['linux']:
-        from tools.scons.RunTest import run_test
-        run_test(broker_test_env,
-# TODO: fix this test on linux and remove commented lines
-#                'service_resource-encapsulation_src_resourceBroker_unittest_broker_test.memcheck',
-                 '',
-                 'service/resource-encapsulation/src/resourceBroker/unittest/broker_test',
-                 broker_test)
+        run_test(
+            broker_test_env,
+            #'service_resource-encapsulation_src_resourceBroker_unittest_broker_test.memcheck',
+            '',  # TODO: fix this test on linux and enable previous line
+            'service/resource-encapsulation/src/resourceBroker/unittest/broker_test',
+            broker_test)
index 828700f..1d79377 100644 (file)
 # ResourceCache Unit Test build script
 ##
 # SConscript file for Local PKI google tests
+
+from tools.scons.RunTest import run_test
+
 gtest_env = SConscript('#extlibs/gtest/SConscript')
 lib_env = gtest_env.Clone()
 
 if lib_env.get('RELEASE'):
-    lib_env.AppendUnique(CCFLAGS = ['-Os'])
-    lib_env.AppendUnique(CPPDEFINES = ['NDEBUG'])
+    lib_env.AppendUnique(CCFLAGS=['-Os'])
+    lib_env.AppendUnique(CPPDEFINES=['NDEBUG'])
 else:
-    lib_env.AppendUnique(CCFLAGS = ['-g'])
+    lib_env.AppendUnique(CCFLAGS=['-g'])
 
 if lib_env.get('LOGGING'):
-    lib_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
+    lib_env.AppendUnique(CPPDEFINES=['TB_LOG'])
 
 SConscript('#service/third_party_libs.scons', 'lib_env')
 
@@ -46,7 +49,7 @@ target_os = cache_test_env.get('TARGET_OS')
 # Build flags
 ######################################################################
 
-cache_test_env.AppendUnique(CPPPATH = [
+cache_test_env.AppendUnique(CPPPATH=[
     '../include',
     '../../../include',
     '../../common/primitiveResource/include',
@@ -58,18 +61,25 @@ cache_test_env.AppendUnique(CPPPATH = [
     '#/resource/include',
     '#/resource/oc_logger/include'
 ])
-cache_test_env.PrependUnique(CPPPATH = ['#/extlibs/hippomocks/hippomocks'])
-cache_test_env.AppendUnique(LIBPATH = [cache_test_env.get('BUILD_DIR')])
-cache_test_env.PrependUnique(LIBS = ['rcs_client', 'rcs_common',
-  'oc', 'octbstack', 'oc_logger',
-  'connectivity_abstraction', 'coap'])
+cache_test_env.PrependUnique(CPPPATH=['#/extlibs/hippomocks/hippomocks'])
+cache_test_env.AppendUnique(LIBPATH=[cache_test_env.get('BUILD_DIR')])
+cache_test_env.PrependUnique(LIBS=[
+    'rcs_client',
+    'rcs_common',
+    'oc',
+    'octbstack',
+    'oc_logger',
+    'connectivity_abstraction',
+    'coap',
+])
 
 compiler = cache_test_env.get('CXX')
 if 'g++' in compiler:
-    cache_test_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x'])
+    cache_test_env.AppendUnique(
+        CXXFLAGS=['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x'])
 
 if cache_test_env.get('SECURED') == '1':
-    cache_test_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509', 'mbedcrypto'])
+    cache_test_env.AppendUnique(LIBS=['mbedtls', 'mbedx509', 'mbedcrypto'])
 
 ######################################################################
 # Build Test
@@ -81,8 +91,8 @@ cache_test_env.AppendTarget('cache_test')
 
 if cache_test_env.get('TEST') == '1':
     if target_os in ['linux']:
-        from tools.scons.RunTest import run_test
-        run_test(cache_test_env,
-                 'service_resource-encapsulation_src_resourceCache_unittests_cache_test.memtest',
-                 'service/resource-encapsulation/src/resourceCache/unittests/cache_test',
-                 cache_test)
+        run_test(
+            cache_test_env,
+            'service_resource-encapsulation_src_resourceCache_unittests_cache_test.memtest',
+            'service/resource-encapsulation/src/resourceCache/unittests/cache_test',
+            cache_test)
index 4138d82..cb73d1b 100644 (file)
 # rcs_server (Server Builder) project build script
 ##
 # SConscript file for Local PKI google tests
+
 gtest_env = SConscript('#extlibs/gtest/SConscript')
 lib_env = gtest_env.Clone()
 rd_mode = lib_env.get('RD_MODE')
 
 # Add third party libraries
-SConscript('#service/third_party_libs.scons', exports = 'lib_env')
+SConscript('#service/third_party_libs.scons', exports='lib_env')
 server_builder_env = lib_env.Clone()
 release = server_builder_env.get('RELEASE')
 src_dir = server_builder_env.get('SRC_DIR')
@@ -37,7 +38,7 @@ target_os = server_builder_env.get('TARGET_OS')
 ######################################################################
 # Build flags
 ######################################################################
-server_builder_env.AppendUnique(CPPPATH = [
+server_builder_env.AppendUnique(CPPPATH=[
     '../common/primitiveResource/include',
     '../common/utils/include',
     '../../include',
@@ -45,78 +46,90 @@ server_builder_env.AppendUnique(CPPPATH = [
     '#/resource/csdk/include',
     '#/resource/csdk/stack/include',
     '#/resource/oc_logger/include',
-    ])
-
-server_builder_env.AppendUnique(CPPPATH = [server_builder_env.get('SRC_DIR')+'/extlibs', 'include'])
-server_builder_env.AppendUnique(LIBPATH = [server_builder_env.get('BUILD_DIR')])
-server_builder_env.AppendUnique(LIBS = ['oc', 'rcs_common'])
-
+])
 
+server_builder_env.AppendUnique(
+    CPPPATH=[server_builder_env.get('SRC_DIR') + '/extlibs', 'include'])
+server_builder_env.AppendUnique(LIBPATH=[server_builder_env.get('BUILD_DIR')])
+server_builder_env.AppendUnique(LIBS=['oc', 'rcs_common'])
 
 if server_builder_env.get('LOGGING'):
-    server_builder_env.AppendUnique(LIBS = ['octbstack'])
+    server_builder_env.AppendUnique(LIBS=['octbstack'])
 
 if not release:
-    server_builder_env.AppendUnique(CXXFLAGS = ['--coverage'])
-    server_builder_env.PrependUnique(LIBS = ['gcov'])
+    server_builder_env.AppendUnique(CXXFLAGS=['--coverage'])
+    server_builder_env.PrependUnique(LIBS=['gcov'])
 if target_os not in ['windows']:
-    server_builder_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall'])
+    server_builder_env.AppendUnique(CXXFLAGS=['-std=c++0x', '-Wall'])
 
 if target_os not in ['darwin', 'ios', 'windows']:
-    server_builder_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
+    server_builder_env.AppendUnique(LINKFLAGS=['-Wl,--no-undefined'])
 
 if target_os in ['android']:
-    server_builder_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
-    server_builder_env.PrependUnique(LIBS = ['gnustl_shared', 'log'])
-    server_builder_env.AppendUnique(LINKFLAGS = ['-Wl,-soname,librcs_server.so'])
+    server_builder_env.AppendUnique(CXXFLAGS=['-frtti', '-fexceptions'])
+    server_builder_env.PrependUnique(LIBS=['gnustl_shared', 'log'])
+    server_builder_env.AppendUnique(LINKFLAGS=['-Wl,-soname,librcs_server.so'])
 
 if server_builder_env.get('SECURED') == '1':
-       if server_builder_env.get('WITH_TCP') == True:
-               server_builder_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509', 'mbedcrypto'])
+    if server_builder_env.get('WITH_TCP') == True:
+        server_builder_env.AppendUnique(
+            LIBS=['mbedtls', 'mbedx509', 'mbedcrypto'])
 
 ######################################################################
 # Source files and Targets
 ######################################################################
 server_builder_src = server_builder_env.Glob('src/*.cpp')
 
-server_builder_static = server_builder_env.StaticLibrary('rcs_server', server_builder_src)
+server_builder_static = server_builder_env.StaticLibrary(
+    'rcs_server', server_builder_src)
 if target_os not in ['ios']:
-    server_builder_shared = server_builder_env.SharedLibrary('rcs_server', server_builder_src)
-    server_builder_env.InstallTarget([server_builder_static, server_builder_shared], 'rcs_server')
-    server_builder_env.UserInstallTargetLib([server_builder_static, server_builder_shared], 'rcs_server')
+    server_builder_shared = server_builder_env.SharedLibrary(
+        'rcs_server', server_builder_src)
+    server_builder_env.InstallTarget(
+        [server_builder_static, server_builder_shared], 'rcs_server')
+    server_builder_env.UserInstallTargetLib(
+        [server_builder_static, server_builder_shared], 'rcs_server')
 else:
     server_builder_env.InstallTarget([server_builder_static], 'rcs_server')
-    server_builder_env.UserInstallTargetLib([server_builder_static], 'rcs_server')
+    server_builder_env.UserInstallTargetLib([server_builder_static],
+                                            'rcs_server')
 
 ######################################################################
 # Build Test
 ######################################################################
 if target_os in ['linux']:
-       server_builder_test_env = server_builder_env.Clone();
-
-       server_builder_test_env.AppendUnique(CPPPATH = [
-               '#/extlibs/hippomocks/hippomocks',
-               '../common/utils/include'
-               ])
-
-       server_builder_test_env.PrependUnique(LIBS = [
-               'rcs_server',
-               'octbstack',
-               'oc_logger',
-               'connectivity_abstraction',
-               'coap'])
-
-       server_builder_test_src = server_builder_test_env.Glob('unittests/*.cpp')
-
-       server_builder_test = server_builder_test_env.Program('rcs_server_test', server_builder_test_src)
-       Alias("rcs_server_test", server_builder_test)
-       server_builder_test_env.AppendTarget('rcs_server_test')
-
-       if server_builder_test_env.get('TEST') == '1':
-               from tools.scons.RunTest import *
-               run_test(server_builder_test_env,
-# TODO: fix this test on linux and remove commented lines
-                       '',
-#                      'service_resource-encapsulation_src_serverBuilder_rcs_server_test.memcheck',
-                       'service/resource-encapsulation/src/serverBuilder/rcs_server_test',
-                       server_builder_test)
+    server_builder_test_env = server_builder_env.Clone()
+    server_builder_test_env.AppendUnique(CPPPATH=[
+        '#/extlibs/hippomocks/hippomocks',
+        '../common/utils/include'
+])
+
+    if server_builder_test_env.get('SECURED') == '1':
+        server_builder_test_env.AppendUnique(
+            CPPPATH=['#/resource/csdk/security/include'])
+
+    server_builder_test_env.PrependUnique(LIBS=[
+        'rcs_server',
+        'octbstack',
+        'oc_logger',
+        'connectivity_abstraction',
+        'coap',
+    ])
+
+    server_builder_test_src = [
+        server_builder_test_env.Glob('unittests/*.cpp'),
+    ]
+
+    server_builder_test = server_builder_test_env.Program(
+        'rcs_server_test', server_builder_test_src)
+    Alias("rcs_server_test", server_builder_test)
+    server_builder_test_env.AppendTarget('rcs_server_test')
+
+    if server_builder_test_env.get('TEST') == '1':
+        from tools.scons.RunTest import run_test
+        run_test(
+            server_builder_test_env,
+#           'service_resource-encapsulation_src_serverBuilder_rcs_server_test.memcheck',
+            '', # TODO: fix this test on linux and remove commented lines
+            'service/resource-encapsulation/src/serverBuilder/rcs_server_test',
+            server_builder_test)
index dffcd80..3e0df64 100644 (file)
 # ResourceClient Unit Test build script
 ##
 # SConscript file for Local PKI google tests
+
 import os
+from tools.scons.RunTest import run_test
 
 gtest_env = SConscript('#extlibs/gtest/SConscript')
 lib_env = gtest_env.Clone()
 target_os = lib_env.get('TARGET_OS')
 
 if lib_env.get('RELEASE'):
-    lib_env.AppendUnique(CCFLAGS = ['-Os'])
-    lib_env.AppendUnique(CPPDEFINES = ['NDEBUG'])
+    lib_env.AppendUnique(CCFLAGS=['-Os'])
+    lib_env.AppendUnique(CPPDEFINES=['NDEBUG'])
 else:
-    lib_env.AppendUnique(CCFLAGS = ['-g'])
+    lib_env.AppendUnique(CCFLAGS=['-g'])
 
 if lib_env.get('LOGGING'):
-    lib_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
+    lib_env.AppendUnique(CPPDEFINES=['TB_LOG'])
 
 # Add third party libraries
 SConscript('#service/third_party_libs.scons', 'lib_env')
@@ -53,18 +55,19 @@ src_dir = lib_env.get('SRC_DIR')
 ######################################################################
 # Build flags
 ######################################################################
-rcs_test_env.AppendUnique(
-        CPPPATH = [
-                '#/extlibs/hippomocks/hippomocks',
-                '../include',
-                '../src/common/utils/include',
-                '#/resource/csdk/include',
-                '#/resource/csdk/stack/include',
-                '#/resource/include',
-                '#/resource/oc_logger/include'
-        ])
-
-rcs_test_env.PrependUnique(LIBS = [
+
+rcs_test_env.AppendUnique(CPPPATH=[
+    '#/extlibs/hippomocks/hippomocks',
+    '../include',
+    '../src/common/utils/include',
+    '#/resource/csdk/include',
+    '#/resource/csdk/stack/include',
+    '#/resource/include',
+    '#/resource/oc_logger/include',
+    '#/resource/csdk/connectivity/api'
+])
+
+rcs_test_env.PrependUnique(LIBS=[
     'connectivity_abstraction',
     'oc_logger',
     'oc_logger_core',
@@ -72,14 +75,15 @@ rcs_test_env.PrependUnique(LIBS = [
     'oc',
     'rcs_client',
     'rcs_server',
-    'rcs_common'])
+    'rcs_common',
+])
 
 if lib_env.get('SECURED') == '1':
-    rcs_test_env.AppendUnique(CPPDEFINES = ['SECURED'])
-    rcs_test_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509', 'mbedcrypto'])
+    rcs_test_env.AppendUnique(CPPDEFINES=['SECURED'])
+    rcs_test_env.AppendUnique(LIBS=['mbedtls', 'mbedx509', 'mbedcrypto'])
 
 if 'g++' in rcs_test_env.get('CXX'):
-    rcs_test_env.AppendUnique(CXXFLAGS = ['-std=c++0x'])
+    rcs_test_env.AppendUnique(CXXFLAGS=['-std=c++0x'])
 
 ######################################################################
 # Build Test
@@ -93,19 +97,23 @@ rcs_test_env.AppendTarget('rcs_client_test')
 # TODO: fix this test on linux and remove commented lines
 if rcs_test_env.get('TEST') == '1':
     if target_os in ['linux']:
-        from tools.scons.RunTest import run_test
-        run_test(rcs_test_env,
-#                'service_resource-encapsulation_unittests_rcs_client_test.memcheck',
-                 '',
-                 'service/resource-encapsulation/unittests/rcs_client_test')
+        run_test(
+            rcs_test_env,
+#           'service_resource-encapsulation_unittests_rcs_client_test.memcheck',
+            '',
+            'service/resource-encapsulation/unittests/rcs_client_test')
 else:
-    rcs_test_env.AppendUnique(CPPDEFINES = ['LOCAL_RUNNING'])
+    rcs_test_env.AppendUnique(CPPDEFINES=['LOCAL_RUNNING'])
 
 if lib_env.get('SECURED') == '1':
     src_dir = rcs_test_env.get('SRC_DIR')
-    svr_db_src_dir = os.path.join(src_dir, 'service/resource-encapsulation/unittests/')
-    svr_db_build_dir = os.path.join(rcs_test_env.get('BUILD_DIR'), 'service', 'resource-encapsulation', 'unittests') + os.sep
+    svr_db_src_dir = os.path.join(src_dir,
+                                  'service/resource-encapsulation/unittests/')
+    svr_db_build_dir = os.path.join(
+        rcs_test_env.get('BUILD_DIR'), 'service', 'resource-encapsulation',
+        'unittests') + os.sep
     rcs_test_env.Alias("install",
-        rcs_test_env.Install(svr_db_build_dir,
-              os.path.join(svr_db_src_dir,
-                           'oic_svr_db_re_client.dat')))
\ No newline at end of file
+                       rcs_test_env.Install(svr_db_build_dir,
+                                            os.path.join(
+                                                svr_db_src_dir,
+                                                'oic_svr_db_re_client.dat')))
index 6fd6f04..cbd0f6e 100644 (file)
 Import('env')
 
 if env.get('RELEASE'):
-    env.AppendUnique(CCFLAGS = ['-Os'])
-    env.AppendUnique(CPPDEFINES = ['NDEBUG'])
+    env.AppendUnique(CCFLAGS=['-Os'])
+    env.AppendUnique(CPPDEFINES=['NDEBUG'])
 else:
-    env.AppendUnique(CCFLAGS = ['-g'])
+    env.AppendUnique(CCFLAGS=['-g'])
 
 if env.get('LOGGING'):
-    env.AppendUnique(CPPDEFINES = ['TB_LOG'])
+    env.AppendUnique(CPPDEFINES=['TB_LOG'])
 
 lib_env = env.Clone()
 SConscript('#service/third_party_libs.scons', 'lib_env')
@@ -41,7 +41,7 @@ target_os = env.get('TARGET_OS')
 ######################################################################
 # Build flags
 ######################################################################
-scenemanager_env.AppendUnique(CPPPATH = [
+scenemanager_env.AppendUnique(CPPPATH=[
     './include',
     './src',
     '#/resource/csdk/connectivity/api',
@@ -54,7 +54,7 @@ scenemanager_env.AppendUnique(CPPPATH = [
     '#/resource/oc_logger/include'
 ])
 
-scenemanager_env.PrependUnique(LIBS = [
+scenemanager_env.PrependUnique(LIBS=[
     'coap',
     'connectivity_abstraction',
     'oc_logger',
@@ -62,48 +62,60 @@ scenemanager_env.PrependUnique(LIBS = [
     'oc',
     'rcs_client',
     'rcs_server',
-    'rcs_common'
-    ])
+    'rcs_common',
+])
 
 if target_os not in ['windows']:
-    scenemanager_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x'])
+    scenemanager_env.AppendUnique(
+        CXXFLAGS=['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x'])
 
 if target_os not in ['darwin', 'ios', 'windows']:
-    scenemanager_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
+    scenemanager_env.AppendUnique(LINKFLAGS=['-Wl,--no-undefined'])
 
 if target_os in ['linux']:
-    scenemanager_env.AppendUnique(LIBS = ['pthread'])
-    
+    scenemanager_env.AppendUnique(LIBS=['pthread'])
 
 if target_os == 'android':
-    scenemanager_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
-    scenemanager_env.AppendUnique(LIBS = ['gnustl_shared','log'])
+    scenemanager_env.AppendUnique(CXXFLAGS=['-frtti', '-fexceptions'])
+    scenemanager_env.AppendUnique(LIBS=['gnustl_shared', 'log'])
 
 if not env.get('RELEASE') and target_os not in ['ios']:
-    scenemanager_env.PrependUnique(LIBS = ['gcov'])
-    scenemanager_env.AppendUnique(CXXFLAGS = ['--coverage'])
+    scenemanager_env.PrependUnique(LIBS=['gcov'])
+    scenemanager_env.AppendUnique(CXXFLAGS=['--coverage'])
 
 ######################################################################
 # Source files and Targets
 ######################################################################
-SCENE_SRC_DIR = './src/' 
+SCENE_SRC_DIR = './src/'
 scenemanager_src = Glob(SCENE_SRC_DIR + '*.cpp')
 
-if target_os in ['tizen','android'] :
-    scenemanagersdk = scenemanager_env.SharedLibrary('scene_manager', scenemanager_src)
-else :
-    scenemanagersdk = scenemanager_env.StaticLibrary('scene_manager', scenemanager_src)
+if target_os in ['tizen', 'android']:
+    scenemanagersdk = scenemanager_env.SharedLibrary('scene_manager',
+                                                     scenemanager_src)
+else:
+    scenemanagersdk = scenemanager_env.StaticLibrary('scene_manager',
+                                                     scenemanager_src)
 
 scenemanager_env.InstallTarget(scenemanagersdk, 'libscene_manager')
 scenemanager_env.UserInstallTargetLib(scenemanagersdk, 'libscene_manager')
-scenemanager_env.UserInstallTargetHeader('include/SceneList.h', 'service/scene-manager', 'SceneList.h')
-scenemanager_env.UserInstallTargetHeader('include/SceneCollection.h', 'service/scene-manager', 'SceneCollection.h')
-scenemanager_env.UserInstallTargetHeader('include/Scene.h', 'service/scene-manager', 'Scene.h')
-scenemanager_env.UserInstallTargetHeader('include/SceneAction.h', 'service/scene-manager', 'SceneAction.h')
-scenemanager_env.UserInstallTargetHeader('include/RemoteSceneList.h', 'service/scene-manager', 'RemoteSceneList.h')
-scenemanager_env.UserInstallTargetHeader('include/RemoteSceneCollection.h', 'service/scene-manager', 'RemoteSceneCollection.h')
-scenemanager_env.UserInstallTargetHeader('include/RemoteScene.h', 'service/scene-manager', 'RemoteScene.h')
-scenemanager_env.UserInstallTargetHeader('include/RemoteSceneAction.h', 'service/scene-manager', 'RemoteSceneAction.h')
+scenemanager_env.UserInstallTargetHeader(
+    'include/SceneList.h', 'service/scene-manager', 'SceneList.h')
+scenemanager_env.UserInstallTargetHeader(
+    'include/SceneCollection.h', 'service/scene-manager', 'SceneCollection.h')
+scenemanager_env.UserInstallTargetHeader('include/Scene.h',
+                                         'service/scene-manager', 'Scene.h')
+scenemanager_env.UserInstallTargetHeader(
+    'include/SceneAction.h', 'service/scene-manager', 'SceneAction.h')
+scenemanager_env.UserInstallTargetHeader(
+    'include/RemoteSceneList.h', 'service/scene-manager', 'RemoteSceneList.h')
+scenemanager_env.UserInstallTargetHeader('include/RemoteSceneCollection.h',
+                                         'service/scene-manager',
+                                         'RemoteSceneCollection.h')
+scenemanager_env.UserInstallTargetHeader(
+    'include/RemoteScene.h', 'service/scene-manager', 'RemoteScene.h')
+scenemanager_env.UserInstallTargetHeader('include/RemoteSceneAction.h',
+                                         'service/scene-manager',
+                                         'RemoteSceneAction.h')
 
 # Go to build Unit test
 if target_os in ['linux']:
index 78b0810..7a14921 100644 (file)
@@ -5,6 +5,6 @@ Import('env')
 
 target_os = env.get('TARGET_OS')
 if target_os in ['linux']:
-       SConscript('linux/SConscript')
+    SConscript('linux/SConscript')
 elif target_os == 'arduino':
-       SConscript('arduino/SConscript')
\ No newline at end of file
+    SConscript('arduino/SConscript')
index 37d9e33..d0f41b4 100644 (file)
@@ -12,7 +12,7 @@ rd_mode = lib_env.get('RD_MODE')
 ######################################################################
 # Build flags
 ######################################################################
-scenemanager_sample_env.AppendUnique(CPPPATH = [
+scenemanager_sample_env.AppendUnique(CPPPATH=[
     '../../include',
     '../../src',
     '#/service/resource-encapsulation/include',
@@ -23,27 +23,31 @@ scenemanager_sample_env.AppendUnique(CPPPATH = [
     '#/resource/include',
     '#/resource/oc_logger/include'
 ])
-scenemanager_sample_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x'])
+scenemanager_sample_env.AppendUnique(
+    CXXFLAGS=['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x'])
 
-scenemanager_sample_env.PrependUnique(LIBS = ['scene_manager'])
-scenemanager_sample_env.AppendUnique(LIBS = ['rcs_client'])
-scenemanager_sample_env.AppendUnique(LIBS = ['rcs_server'])
-scenemanager_sample_env.AppendUnique(LIBS = ['rcs_common'])
-scenemanager_sample_env.AppendUnique(LIBS = ['oc'])
-scenemanager_sample_env.AppendUnique(LIBS = ['octbstack'])
-scenemanager_sample_env.AppendUnique(LIBS = ['oc_logger'])
-scenemanager_sample_env.AppendUnique(LIBS = ['connectivity_abstraction'])
-scenemanager_sample_env.AppendUnique(LIBS = ['coap'])
+scenemanager_sample_env.PrependUnique(LIBS=['scene_manager'])
+scenemanager_sample_env.AppendUnique(LIBS=[
+    'rcs_client',
+    'rcs_server',
+    'rcs_common',
+    'oc',
+    'octbstack',
+    'oc_logger',
+    'connectivity_abstraction',
+    'coap',
+])
 
 if env.get('SECURED') == '1':
-       scenemanager_sample_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509', 'mbedcrypto'])
+    scenemanager_sample_env.AppendUnique(
+        LIBS=['mbedtls', 'mbedx509', 'mbedcrypto'])
 
 if 'rt' in scenemanager_sample_env.get('LIBS'):
-    scenemanager_sample_env.Append(LIBS = ['rt'])
+    scenemanager_sample_env.Append(LIBS=['rt'])
 
 if not env.get('RELEASE'):
-    scenemanager_sample_env.PrependUnique(LIBS = ['gcov'])
-    scenemanager_sample_env.AppendUnique(CXXFLAGS = ['--coverage'])
+    scenemanager_sample_env.PrependUnique(LIBS=['gcov'])
+    scenemanager_sample_env.AppendUnique(CXXFLAGS=['--coverage'])
 ####################################################################
 # Source files and Targets
 ######################################################################
index bf70a24..7567e71 100644 (file)
 # SConscript file for Local PKI google tests
 
 from tools.scons.RunTest import run_test
+
 Import('env')
 
 gtest_env = SConscript('#extlibs/gtest/SConscript')
 lib_env = gtest_env.Clone()
 
 if lib_env.get('RELEASE'):
-    lib_env.AppendUnique(CCFLAGS = ['-Os'])
-    lib_env.AppendUnique(CPPDEFINES = ['NDEBUG'])
+    lib_env.AppendUnique(CCFLAGS=['-Os'])
+    lib_env.AppendUnique(CPPDEFINES=['NDEBUG'])
 else:
-    lib_env.AppendUnique(CCFLAGS = ['-g'])
+    lib_env.AppendUnique(CCFLAGS=['-g'])
 
 if lib_env.get('LOGGING'):
-    lib_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
+    lib_env.AppendUnique(CPPDEFINES=['TB_LOG'])
 
 SConscript('#service/third_party_libs.scons', 'lib_env')
 
@@ -52,19 +53,28 @@ target_os = scene_test_env.get('TARGET_OS')
 # Build flags
 ######################################################################
 
-scene_test_env.AppendUnique(LIBPATH = [lib_env.get('BUILD_DIR')])
-scene_test_env.AppendUnique(LIBS = [
-    'scene_manager', 'rcs_server', 'rcs_client','rcs_common',
-    'oc', 'octbstack', 'oc_logger', 'connectivity_abstraction', 'coap'])
+scene_test_env.AppendUnique(LIBPATH=[lib_env.get('BUILD_DIR')])
+scene_test_env.AppendUnique(LIBS=[
+    'scene_manager',
+    'rcs_server',
+    'rcs_client',
+    'rcs_common',
+    'oc',
+    'octbstack',
+    'oc_logger',
+    'connectivity_abstraction',
+    'coap',
+])
 
 if target_os not in ['windows']:
-    scene_test_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0'])
+    scene_test_env.AppendUnique(
+        CXXFLAGS=['-O2', '-g', '-Wall', '-fmessage-length=0'])
 
 if not scene_test_env.get('RELEASE'):
-    scene_test_env.PrependUnique(LIBS = ['gcov'])
-    scene_test_env.AppendUnique(CXXFLAGS = ['--coverage'])
+    scene_test_env.PrependUnique(LIBS=['gcov'])
+    scene_test_env.AppendUnique(CXXFLAGS=['--coverage'])
 
-scene_test_env.PrependUnique(CPPPATH = [
+scene_test_env.PrependUnique(CPPPATH=[
     '#/extlibs/hippomocks/hippomocks',
     '../include',
     '../src',
@@ -80,19 +90,21 @@ scene_test_env.PrependUnique(CPPPATH = [
 
 if scene_test_env.get('SECURED') == '1':
     if scene_test_env.get('WITH_TCP') == True:
-        scene_test_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509', 'mbedcrypto'])
+        scene_test_env.AppendUnique(LIBS=['mbedtls', 'mbedx509', 'mbedcrypto'])
 
 ######################################################################
 # Build Test
 ######################################################################
 
 scene_list_test_src = scene_test_env.Glob('./SceneListTest.cpp')
-scene_list_test = scene_test_env.Program('scene_list_test', scene_list_test_src)
+scene_list_test = scene_test_env.Program('scene_list_test',
+                                         scene_list_test_src)
 Alias("scene_list_test", scene_list_test)
 scene_test_env.AppendTarget('scene_list_test')
 
 scene_collection_test_src = scene_test_env.Glob('./SceneCollectionTest.cpp')
-scene_collection_test = scene_test_env.Program('scene_collection_test', scene_collection_test_src)
+scene_collection_test = scene_test_env.Program('scene_collection_test',
+                                               scene_collection_test_src)
 Alias("scene_collection_test", scene_collection_test)
 scene_test_env.AppendTarget('scene_collection_test')
 
@@ -102,53 +114,52 @@ Alias("scene_test", scene_test)
 scene_test_env.AppendTarget('scene_test')
 
 scene_action_test_src = scene_test_env.Glob('./SceneActionTest.cpp')
-scene_action_test = scene_test_env.Program('scene_action_test', scene_action_test_src)
+scene_action_test = scene_test_env.Program('scene_action_test',
+                                           scene_action_test_src)
 Alias("scene_action_test", scene_action_test)
 scene_test_env.AppendTarget('scene_action_test')
 
 remote_scene_list_test_src = scene_test_env.Glob('./RemoteSceneListTest.cpp')
-remote_scene_list_test = scene_test_env.Program('remote_scene_list_test', remote_scene_list_test_src)
+remote_scene_list_test = scene_test_env.Program('remote_scene_list_test',
+                                                remote_scene_list_test_src)
 Alias("remote_scene_list_test", remote_scene_list_test)
 scene_test_env.AppendTarget('remote_scene_list_test')
 
-remote_scene_col_test_src = scene_test_env.Glob('./RemoteSceneCollectionTest.cpp')
-remote_scene_col_test = scene_test_env.Program('remote_scene_col_test', remote_scene_col_test_src)
+remote_scene_col_test_src = scene_test_env.Glob(
+    './RemoteSceneCollectionTest.cpp')
+remote_scene_col_test = scene_test_env.Program('remote_scene_col_test',
+                                               remote_scene_col_test_src)
 Alias("remote_scene_col_test", remote_scene_col_test)
 scene_test_env.AppendTarget('remote_scene_col_test')
 
 remote_scene_test_src = scene_test_env.Glob('./RemoteSceneTest.cpp')
-remote_scene_test = scene_test_env.Program('remote_scene_test', remote_scene_test_src)
+remote_scene_test = scene_test_env.Program('remote_scene_test',
+                                           remote_scene_test_src)
 Alias("remote_scene_test", remote_scene_test)
 scene_test_env.AppendTarget('remote_scene_test')
 
-remote_scene_action_test_src = scene_test_env.Glob('./RemoteSceneActionTest.cpp')
-remote_scene_action_test = scene_test_env.Program('remote_scene_action_test', remote_scene_action_test_src)
+remote_scene_action_test_src = scene_test_env.Glob(
+    './RemoteSceneActionTest.cpp')
+remote_scene_action_test = scene_test_env.Program('remote_scene_action_test',
+                                                  remote_scene_action_test_src)
 Alias("remote_scene_action_test", remote_scene_action_test)
 scene_test_env.AppendTarget('remote_scene_action_test')
 
 if env.get('TEST') == '1':
     if env.get('SECURED') != '1':
-        run_test(scene_test_env,
-               '',
-            'service/scene-manager/unittests/scene_list_test')
-        run_test(scene_test_env,
-               '',
-            'service/scene-manager/unittests/scene_collection_test')
-        run_test(scene_test_env,
-               '',
-            'service/scene-manager/unittests/scene_test')
-        run_test(scene_test_env,
-               '',
-            'service/scene-manager/unittests/scene_action_test')
-        run_test(scene_test_env,
-               '',
-            'service/scene-manager/unittests/remote_scene_list_test')
-        run_test(scene_test_env,
-               '',
-            'service/scene-manager/unittests/remote_scene_col_test')
-        run_test(scene_test_env,
-               '',
-            'service/scene-manager/unittests/remote_scene_test')
-        run_test(scene_test_env,
-               '',
-            'service/scene-manager/unittests/remote_scene_action_test')
+        run_test(scene_test_env, '',
+                 'service/scene-manager/unittests/scene_list_test')
+        run_test(scene_test_env, '',
+                 'service/scene-manager/unittests/scene_collection_test')
+        run_test(scene_test_env, '',
+                 'service/scene-manager/unittests/scene_test')
+        run_test(scene_test_env, '',
+                 'service/scene-manager/unittests/scene_action_test')
+        run_test(scene_test_env, '',
+                 'service/scene-manager/unittests/remote_scene_list_test')
+        run_test(scene_test_env, '',
+                 'service/scene-manager/unittests/remote_scene_col_test')
+        run_test(scene_test_env, '',
+                 'service/scene-manager/unittests/remote_scene_test')
+        run_test(scene_test_env, '',
+                 'service/scene-manager/unittests/remote_scene_action_test')
index 4ddeb0c..4d55cd5 100644 (file)
@@ -37,53 +37,58 @@ target_os = env.get('TARGET_OS')
 ######################################################################
 # Build flags
 ######################################################################
-simulator_env.AppendUnique(CPPPATH = ['inc', 'src/client', 'src/server', 'src/common'])
-simulator_env.AppendUnique(CPPPATH = [
-               '../../resource/include/',
-               '../../resource/csdk/include',
-               '../../resource/csdk/stack/include',
-               '../../resource/c_common/ocrandom/include',
-               '../../resource/csdk/logger/include',
-               '../../resource/oc_logger/include',
-               './ramlparser/raml',
-               './ramlparser/raml/model',              
-               './ramlparser/raml/jsonSchemaParser',   
-               '../../extlibs/yaml/yaml/include'
-               ])
+simulator_env.AppendUnique(CPPPATH=[
+    'inc',
+    'src/client',
+    'src/server',
+    'src/common',
+    '../../resource/include/',
+    '../../resource/csdk/include',
+    '../../resource/csdk/stack/include',
+    '../../resource/c_common/ocrandom/include',
+    '../../resource/csdk/logger/include',
+    '../../resource/oc_logger/include',
+    './ramlparser/raml',
+    './ramlparser/raml/model',
+    './ramlparser/raml/jsonSchemaParser',
+    '../../extlibs/yaml/yaml/include',
+])
 
 # Including Java path for building JNI files
 try:
-       os.environ['JAVA_HOME']
+    os.environ['JAVA_HOME']
 except KeyError:
-       print '''
+    print '''
 *************************************** Error *********************************
 * JAVA_HOME environment variable not set                                      
 * Simulator has dependency on java, Please set environment variable JAVA_HOME
 *******************************************************************************
        '''
-       sys.exit(1)
-       
+    sys.exit(1)
+
 java_headers = [os.path.join(os.environ['JAVA_HOME'], 'include')]
 java_headers.append(os.path.join(java_headers[0], 'win32'))
 java_headers.append(os.path.join(java_headers[0], 'linux'))
 java_headers.append(os.path.join(java_headers[0], 'solaris'))
-simulator_env.AppendUnique(CPPPATH = java_headers)
+simulator_env.AppendUnique(CPPPATH=java_headers)
 
-simulator_env.Append( RPATH = env.Literal('\\$$ORIGIN'))
+simulator_env.Append(RPATH=env.Literal('\\$$ORIGIN'))
 
-simulator_env.AppendUnique(CPPPATH = ['../../extlibs/cjson'])
-simulator_env.PrependUnique(LIBS = ['oc', 'octbstack', 'RamlParser'])
-simulator_env.AppendUnique(LIBS = ['pthread'])
+simulator_env.AppendUnique(CPPPATH=['../../extlibs/cjson'])
+simulator_env.PrependUnique(LIBS=['oc', 'octbstack', 'RamlParser'])
+simulator_env.AppendUnique(LIBS=['pthread'])
 
-simulator_env.AppendUnique(CXXFLAGS = ['-O2', '-Wall', '-fmessage-length=0', '-std=c++0x'])
+simulator_env.AppendUnique(
+    CXXFLAGS=['-O2', '-Wall', '-fmessage-length=0', '-std=c++0x'])
 
 ######################################################################
 # Source files and Targets
 ######################################################################
-simulator_src = [env.Glob('src/*.cpp')
-                 ,env.Glob('src/*/*.cpp')
-                 ,env.Glob('java/jni/*.cpp')
-                ]
+simulator_src = [
+    env.Glob('src/*.cpp'),
+    env.Glob('src/*/*.cpp'),
+    env.Glob('java/jni/*.cpp')
+]
 simulatorsdk = simulator_env.SharedLibrary('SimulatorManager', simulator_src)
 
 simulator_env.InstallTarget(simulatorsdk, 'libSimulatorManager')
index fd4cf5f..590b364 100644 (file)
@@ -6,23 +6,23 @@ sim_env = lib_env.Clone()
 ######################################################################
 # Build flags
 ######################################################################
-sim_env.AppendUnique(CPPPATH = [
+sim_env.AppendUnique(CPPPATH=[
     '../../inc',
     '#/resource/csdk/include',
     '#/resource/csdk/stack/include',
     '#/resource/include',
     '#/resource/oc_logger/include'
 ])
-sim_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-pthread'])
-sim_env.AppendUnique(CPPDEFINES = ['LINUX'])
-sim_env.AppendUnique(LIBS = ['SimulatorManager'])
+sim_env.AppendUnique(CXXFLAGS=['-std=c++0x', '-Wall', '-pthread'])
+sim_env.AppendUnique(CPPDEFINES=['LINUX'])
+sim_env.AppendUnique(LIBS=['SimulatorManager'])
 
-sim_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
-sim_env.AppendUnique(RPATH = [env.get('BUILD_DIR')])
-sim_env.PrependUnique(LIBS = ['SimulatorManager'])
+sim_env.AppendUnique(LIBPATH=[env.get('BUILD_DIR')])
+sim_env.AppendUnique(RPATH=[env.get('BUILD_DIR')])
+sim_env.PrependUnique(LIBS=['SimulatorManager'])
 
 if sim_env.get('SECURED') == '1':
-    sim_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509', 'mbedcrypto'])
+    sim_env.AppendUnique(LIBS=['mbedtls', 'mbedx509', 'mbedcrypto'])
 
 ######################################################################
 # Source files and Targets
index 805281c..c2f54ed 100644 (file)
@@ -6,7 +6,7 @@ sim_env = lib_env.Clone()
 ######################################################################
 # Build flags
 ######################################################################
-sim_env.AppendUnique(CPPPATH = [
+sim_env.AppendUnique(CPPPATH=[
     '#/resource/c_common/octimer/include',
     '../../inc',
     '#/resource/csdk/include',
@@ -14,16 +14,16 @@ sim_env.AppendUnique(CPPPATH = [
     '#/resource/include',
     '#/resource/oc_logger/include'
 ])
-sim_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-pthread'])
-sim_env.AppendUnique(CPPDEFINES = ['LINUX'])
-sim_env.AppendUnique(LIBS = ['SimulatorManager'])
+sim_env.AppendUnique(CXXFLAGS=['-std=c++0x', '-Wall', '-pthread'])
+sim_env.AppendUnique(CPPDEFINES=['LINUX'])
+sim_env.AppendUnique(LIBS=['SimulatorManager'])
 
-sim_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
-sim_env.AppendUnique(RPATH = [env.get('BUILD_DIR')])
-sim_env.PrependUnique(LIBS = ['SimulatorManager'])
+sim_env.AppendUnique(LIBPATH=[env.get('BUILD_DIR')])
+sim_env.AppendUnique(RPATH=[env.get('BUILD_DIR')])
+sim_env.PrependUnique(LIBS=['SimulatorManager'])
 
 if sim_env.get('SECURED') == '1':
-    sim_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509', 'mbedcrypto'])
+    sim_env.AppendUnique(LIBS=['mbedtls', 'mbedx509', 'mbedcrypto'])
 
 ######################################################################
 # Source files and Targets
index 59ff637..cdd7faa 100644 (file)
@@ -28,24 +28,33 @@ SConscript('#/extlibs/yaml/SConscript')
 ######################################################################
 # Build flags
 ######################################################################
-raml_env.AppendUnique(CPPPATH = ['#/resource/c_common/octimer/include',
-                                 '#/extlibs/cjson',
-                                 '#/extlibs/yaml/yaml/src' ,
-                                 '#/extlibs/yaml/yaml/include',
-                                 'raml/model',
-                                 'raml/jsonSchemaParser',
-                                 'raml'])
-raml_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-pthread', '-O2', '-g', '-Wall', '-fmessage-length=0'])
-raml_env.AppendUnique(CPPDEFINES = ['LINUX'])
-raml_env.Append( RPATH = env.Literal('\\$$ORIGIN'))
+raml_env.AppendUnique(CPPPATH=[
+    '#/resource/c_common/octimer/include',
+    '#/extlibs/cjson',
+    '#/extlibs/yaml/yaml/src',
+    '#/extlibs/yaml/yaml/include',
+    'raml/model',
+    'raml/jsonSchemaParser',
+    'raml'
+])
+raml_env.AppendUnique(CXXFLAGS=[
+    '-std=c++0x', '-Wall', '-pthread', '-O2', '-g', '-Wall',
+    '-fmessage-length=0'
+])
+raml_env.AppendUnique(CPPDEFINES=['LINUX'])
+raml_env.Append(RPATH=env.Literal('\\$$ORIGIN'))
 
-raml_env.PrependUnique(LIBS = ['octbstack', 'YamlParser'])
-raml_env.AppendUnique(LIBS = ['pthread', 'm', 'cjson'])
+raml_env.PrependUnique(LIBS=['octbstack', 'YamlParser'])
+raml_env.AppendUnique(LIBS=['pthread', 'm', 'cjson'])
 
 ######################################################################
 # Source files and Targets
 ######################################################################
-raml_src = [env.Glob('raml/model/*.cpp'), env.Glob('raml/jsonSchemaParser/*.cpp'), env.Glob('raml/*.cpp')]
+raml_src = [
+    env.Glob('raml/model/*.cpp'),
+    env.Glob('raml/jsonSchemaParser/*.cpp'),
+    env.Glob('raml/*.cpp')
+]
 
 ramlsdk = raml_env.SharedLibrary('RamlParser', raml_src)
 
index ee41d3a..4c24208 100644 (file)
@@ -49,13 +49,14 @@ if target_os in ['linux']:
 
         conf = Configure(lib_env.Clone(LIBS=[]))
 
-        if target_os not in ['tizen'] and not conf.CheckLib('boost_thread', language='C++'):
-            print 'Did not find boost_thread, exiting!'
-            Exit(1)
+        if target_os not in ['tizen']:
+            if not conf.CheckLib('boost_thread', language='C++'):
+                print 'Did not find boost_thread, exiting!'
+                Exit(1)
 
-        if target_os not in ['tizen'] and not conf.CheckLib('boost_system', language='C++'):
-            print 'Did not find boost_system, exiting!'
-            Exit(1)
+            if not conf.CheckLib('boost_system', language='C++'):
+                print 'Did not find boost_system, exiting!'
+                Exit(1)
 
         conf.Finish()
 
@@ -89,7 +90,8 @@ if target_os == 'android':
         lib_env.AppendUnique(CCFLAGS=['-w'])
 
 elif target_os == 'ios':
-    lib_env.AppendUnique(FRAMEWORKPATH=[src_dir + '/extlibs/boost/ios/framework'])
+    lib_env.AppendUnique(
+        FRAMEWORKPATH=[src_dir + '/extlibs/boost/ios/framework'])
     lib_env.AppendUnique(FRAMEWORKS=['boost'])
 elif target_os == 'darwin':
     lib_env.AppendUnique(CPPPATH=['/usr/local/include'])