Fixes for scons builds
authorDavid Warburton <david.warburton@intel.com>
Mon, 22 Dec 2014 16:52:17 +0000 (11:52 -0500)
committerDavid Warburton <david.warburton@intel.com>
Mon, 22 Dec 2014 21:16:38 +0000 (16:16 -0500)
1) Remove oic-utilities as a requirement

2) Fail the build if one step fails

Setting this option in the bash script will cause the
script to terminate if any of the commands returns a
with non-zero value.  This is necessary for the build
server to understand when a build is failed.  Without this
flag, the script will exit with the status of the last command,
which in this script is "echo" so it will be 0, regardless if
a scons build step failed.

Ideally we would try each step and then report the failures
at the end, set -e will do the job until that can be developed.

3) Conditionaly enable android build

4) Correct a build issue in occoap.c with typecasting

Change-Id: I2711db6ff0814cff64b170cba20455e8ef52f905
Signed-off-by: David Warburton <david.warburton@intel.com>
auto_build.sh
extra_options.scons
resource/csdk/occoap/src/occoap.c
resource/third_party_libs.scons
service/third_party_libs.scons

index 9f947eb..efe7530 100755 (executable)
@@ -1,5 +1,9 @@
 #! /bin/bash
 
+# Ideally we will capture the exit code of each step and try them all before failing
+# the build script.  For now, use set -e and fail the build at first failure.
+set -e
+
 function clean()
 {
        echo "*********** Clean build *************"
@@ -19,17 +23,21 @@ function build()
        # it requires gcc-4.9, currently only android-ndk-r10(for linux)
        # and windows android-ndk-r10(64bit target version) support these features.
 
-       echo "*********** Build for android x86 *************"
-       scons TARGET_OS=android TARGET_ARCH=x86 ANDROID_NDK=$1 RELEASE=$3
+       if [ "$BUILD_FOR_ANDROID" = "true" ]
+               then
+
+               echo "*********** Build for android x86 *************"
+               scons TARGET_OS=android TARGET_ARCH=x86 ANDROID_NDK=$1 RELEASE=$3
 
-       echo "*********** Build for android armeabi *************"
-       scons TARGET_OS=android TARGET_ARCH=armeabi ANDROID_NDK=$1 RELEASE=$3
+               echo "*********** Build for android armeabi *************"
+               scons TARGET_OS=android TARGET_ARCH=armeabi ANDROID_NDK=$1 RELEASE=$3
 
-       echo "*********** Build for android armeabi-v7a *************"
-       scons TARGET_OS=android TARGET_ARCH=armeabi-v7a ANDROID_NDK=$1 RELEASE=$3
+               echo "*********** Build for android armeabi-v7a *************"
+               scons TARGET_OS=android TARGET_ARCH=armeabi-v7a ANDROID_NDK=$1 RELEASE=$3
 
-       echo "*********** Build for android armeabi-v7a-hard *************"
-       scons TARGET_OS=android TARGET_ARCH=armeabi-v7a-hard ANDROID_NDK=$1 RELEASE=$3
+               echo "*********** Build for android armeabi-v7a-hard *************"
+               scons TARGET_OS=android TARGET_ARCH=armeabi-v7a-hard ANDROID_NDK=$1 RELEASE=$3
+       fi
 
        echo "*********** Build for arduino avr *************"
        scons TARGET_OS=arduino TARGET_ARCH=avr ARDUINO_HOME=$2 RELEASE=$3
index e1280da..dc2e48e 100644 (file)
@@ -11,36 +11,6 @@ target_os = env.get('TARGET_OS')
 target_arch = env.get('TARGET_ARCH')
 src_dir = env.get('SRC_DIR')
 
-# Add 'OIC_UTILS' build option for user to set oic-utilities project path
-if target_os not in ['linux', 'darwin', 'arduino']:
-       default_dir = os.environ.get('OIC_UTILS')
-       if not default_dir:
-               default_dir = os.path.abspath(src_dir + '/../oic-utilities')
-       else:
-               default_dir = os.path.abspath(default_dir)
-
-       if not os.path.exists(default_dir):
-               default_dir = None
-
-       help_vars = Variables()
-       help_vars.Add(PathVariable('OIC_UTILS', 'oic-utilities project path', default_dir))
-       help_vars.Update(env)
-       Help(help_vars.GenerateHelpText(env))
-
-       utils_path = env.get('OIC_UTILS', default_dir)
-       if utils_path:
-               utils_path = os.path.abspath(utils_path)
-
-       if not utils_path or not os.path.exists(utils_path):
-               print '''
-*********************************** Error: ************************************
-*   oic-utilities project directory isn't set properly, please set enviornment*
-* variable OIC_UTILS or set it in command line:                               *
-*     # scons  OIC_UTILS=<path to oic-utilities> ...                          *
-*******************************************************************************
-'''
-               Exit(1)
-
 if target_os == 'arduino':
        # Add 'NET' build option, let user select board network connection type
        vars = Variables()
index 947c8ee..755ac6c 100644 (file)
@@ -131,7 +131,7 @@ static void HandleCoAPRequests(struct coap_context_t *ctx,
     coap_block_t rcvdBlock2;
     memset(&rcvdBlock1, COAP_BLOCK_FILL_VALUE, sizeof(coap_block_t));
     memset(&rcvdBlock2, COAP_BLOCK_FILL_VALUE, sizeof(coap_block_t));
-    size_t rcvdSize1 = 0;
+    uint16_t rcvdSize1 = 0;
     coap_pdu_t * rcvdPdu = rcvdRequest->pdu;
     coap_pdu_t * sendPdu = NULL;
     coap_send_flags_t sendFlag;
index a22bc36..de307f3 100644 (file)
@@ -12,8 +12,6 @@ target_os = env.get('TARGET_OS')
 target_arch = env.get('TARGET_ARCH')
 src_dir = env.get('SRC_DIR')
 
-if target_os not in ['linux', 'darwin']:
-       utils_path = env.get('OIC_UTILS')
 
 ######################################################################
 # Check dependent packages (Linux only)
@@ -36,11 +34,6 @@ if target_os == 'linux':
 
                conf.Finish()
 
-######################################################################
-# The 'include' path of third party libraries
-######################################################################
-if target_os == 'android':
-       lib_env.AppendUnique(CPPPATH = [utils_path + '/android/boost/include'])
 
 ######################################################################
 # The path of third party libraries binary
@@ -57,12 +50,10 @@ if target_os == 'android':
 *******************************************************************************
 '''
        else:
-               lib_env.AppendUnique(LIBPATH = [utils_path + '/android/boost/libs/' + target_arch])
                # Too much boost warning, suppress the warning
                lib_env.AppendUnique(CCFLAGS = ['-w'])
 
 elif target_os == 'ios':
-       lib_env.AppendUnique(FRAMEWORKPATH = [utils_path + '/ios/frameworks/'])
        lib_env.AppendUnique(FRAMEWORKS = ['boost'])
 elif target_os == 'darwin':
        lib_env.AppendUnique(CPPPATH = ['/usr/local/include'])
index e9a140c..718e296 100644 (file)
@@ -12,9 +12,6 @@ target_os = env.get('TARGET_OS')
 target_arch = env.get('TARGET_ARCH')
 src_dir = env.get('SRC_DIR')
 
-if target_os not in ['linux', 'darwin']:
-       utils_path = env.get('OIC_UTILS')
-
 resource_path = src_dir + '/resource'
 
 ######################################################################
@@ -56,16 +53,6 @@ lib_env.AppendUnique(CPPPATH = [
                ])
 
 ######################################################################
-# The 'include' path of third party libraries
-######################################################################
-if target_os == 'android':
-       lib_env.AppendUnique(CPPPATH = [
-                                       utils_path + '/android/boost/include',
-                                       utils_path + '/android/expat/include/expat/',
-                                       utils_path + '/android/openssl/include',
-                               ])
-
-######################################################################
 # The path of third party libraries binary
 ######################################################################
 if target_os == 'android':
@@ -80,16 +67,10 @@ if target_os == 'android':
 *******************************************************************************
 '''
        else:
-               lib_env.AppendUnique(LIBPATH = [
-                                                               utils_path + '/android/boost/libs/' + target_arch,
-                                                               utils_path + '/android/expat/lib/' + target_arch,
-                                                               utils_path + '/android/openssl/lib/' + target_arch,
-                                                       ])
                # Too much boost warning, suppress the warning
                lib_env.AppendUnique(CCFLAGS = ['-w'])
 
 elif target_os == 'ios':
-       lib_env.AppendUnique(FRAMEWORKPATH = [utils_path + '/ios/frameworks/'])
        lib_env.AppendUnique(FRAMEWORKS = ['boost', 'expat', 'openssl'])
 elif target_os == 'darwin':
        lib_env.AppendUnique(CPPPATH = ['/usr/local/include'])