hippomocks: Update to latest release (v5.0)
authorPhilippe Coval <philippe.coval@osg.samsung.com>
Fri, 24 Mar 2017 10:20:01 +0000 (11:20 +0100)
committerUze Choi <uzchoi@samsung.com>
Mon, 10 Apr 2017 10:16:52 +0000 (10:16 +0000)
Refactor build scripts too

Previously we used revision:
8e210c5808d490b26fff69151c801fa28d291fcb

Since upstream tagged a version, so it's safer to align to it.

Bug: https://jira.iotivity.org/browse/IOT-1745
Change-Id: Ib6674b60f70dbae163feea447273324bf7827d6d
Signed-off-by: Philippe Coval <philippe.coval@osg.samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/18365
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: C.J. Collier <cjcollier@linuxfoundation.org>
Reviewed-by: JungYong KIM <jyong2.kim@samsung.com>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
19 files changed:
.gitignore
extlibs/hippomocks/SConscript [moved from extlibs/hippomocks.scons with 53% similarity]
extlibs/hippomocks/prep.sh [new file with mode: 0644]
resource/csdk/resource-directory/unittests/SConscript
resource/provisioning/unittests/SConscript
resource/unit_tests.scons
resource/unittests/SConscript
service/coap-http-proxy/unittests/SConscript
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/resourceBroker/unittest/SConscript
service/resource-encapsulation/src/resourceCache/unittests/SConscript
service/resource-encapsulation/src/serverBuilder/SConscript
service/resource-encapsulation/unittests/SConscript
service/scene-manager/unittests/SConscript

index ccdaa84..fbf4bac 100644 (file)
@@ -103,6 +103,7 @@ tmp/
 extlibs/libcoap/libcoap
 extlibs/gtest/gtest-*
 extlibs/hippomocks-master/
+extlibs/hippomocks/hippomocks/
 extlibs/master.zip
 extlibs/cereal/cereal
 extlibs/cereal
similarity index 53%
rename from extlibs/hippomocks.scons
rename to extlibs/hippomocks/SConscript
index 0826f97..6359ee0 100644 (file)
@@ -32,26 +32,18 @@ target_os = env.get('TARGET_OS')
 src_dir = env.get('SRC_DIR')
 
 if target_os in ['linux', 'windows']:
-       print '*** Checking for installation of hippomocks ***'
-
-       hippomocks_sha      = '8e210c5808d490b26fff69151c801fa28d291fcb'
-       hippomocks_dir_src  = src_dir + '/extlibs/hippomocks-' + hippomocks_sha
-       hippomocks_dir_dest = src_dir + '/extlibs/hippomocks-master'
-       hippomocks_zip_file = src_dir + '/extlibs/hippomocks-' + hippomocks_sha + '.zip'
-       hippomocks_url      = 'https://github.com/dascandy/hippomocks/archive/' + hippomocks_sha + '.zip'
-
-       if not os.path.exists(hippomocks_dir_dest):
-               # If the hippomocks zip file is not already present, download it
-               if not os.path.exists(hippomocks_zip_file):
-                       hippomocks_zip = env.Download(hippomocks_zip_file, hippomocks_url)
-               else:
-                       hippomocks_zip = hippomocks_zip_file
-
-               # Unzip hippomocks
-               print 'Unzipping hippomocks'
-               env.UnpackAll(hippomocks_dir_src, hippomocks_zip)
-               print 'Renaming hippomocks directory'
-               os.rename(hippomocks_dir_src, hippomocks_dir_dest)
-
-
-
+    print '*** Checking for installation of hippomocks ***'
+    hippomocks_version = '5.0'
+    hippomocks_revision = 'v' + hippomocks_version
+    hippomocks_src_dir = src_dir + '/extlibs/hippomocks/hippomocks-' + hippomocks_version
+    hippomocks_dest_dir = src_dir + '/extlibs/hippomocks/hippomocks'
+    hippomocks_zip_file = src_dir + '/extlibs/hippomocks/' + hippomocks_revision + '.zip'
+    hippomocks_url = 'https://github.com/dascandy/hippomocks/archive/' + hippomocks_revision + '.zip'
+    if not os.path.exists(hippomocks_dest_dir):
+        if not os.path.exists(hippomocks_zip_file):
+            hippomocks_zip = env.Download(hippomocks_zip_file, hippomocks_url)
+        else:
+            hippomocks_zip = hippomocks_zip_file
+        print 'hippomocks: Unzipping %s to %s' % (hippomocks_zip_file, hippomocks_dest_dir)
+        env.UnpackAll(hippomocks_src_dir, hippomocks_zip)
+        os.rename(hippomocks_src_dir, hippomocks_dest_dir)
diff --git a/extlibs/hippomocks/prep.sh b/extlibs/hippomocks/prep.sh
new file mode 100644 (file)
index 0000000..5e4c7f6
--- /dev/null
@@ -0,0 +1,76 @@
+#!/bin/bash
+#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+
+set -e
+
+[ ! -z ${EXEC_MODE} ] || EXEC_MODE=false
+
+topdir="${PWD}"
+
+# Keep packageRevision in sync with extlibs/tinycbor/SConscript's setting
+# Right now this script assumes packageRevision is a tag; 
+# comment out the second clause 
+# if packageRevision becomes a branch or a specific commit.
+package="hippomocks"
+packageUrl="https://github.com/dascandy/hippomocks"
+packageDir="./extlibs/${package}/${package}"
+packageRevision="v5.0"
+
+
+do_()
+{
+    set +f
+    if $EXEC_MODE; then
+        echo "warning: fetching online resources may not be reproductible"
+        printf "%s \n" "trying: \"$@\""
+        eval "$@"
+    else
+cat<<EOF
+error: Something should be prepared, please manually execute from shell
+EOF
+        printf "%s \n" "$@"
+        exit 1
+    fi
+}
+
+
+main_()
+{
+    if [ ! -d "${packageDir}" ]; then
+        do_ "git clone ${packageUrl} ${packageDir} -b ${packageRevision}"
+    elif [ ! -z $(git tag -l "${packageRevision}") ]; then
+        cat<<EOF
+error: $packageDir is unaligned with supported release of ${package}
+Please update ${package} using "cd ${packageDir} && git fetch"
+For more support please refer to:
+https://wiki.iotivity.org/build
+EOF
+        exit 2
+    elif [ -d "${packageDir}/.git" ]; then
+        cd "${packageDir}"
+        git reset --hard "${packageRevision}"
+        cd -
+        rm -rf -- "${packageDir}/.git"
+    else
+        echo "log: Assuming ${package} is already on correct revision: \"${packageRevision}\""
+    fi
+}
+
+
+main_ "$@"
+
index a5a6f9f..984919f 100644 (file)
@@ -41,9 +41,7 @@ if lib_env.get('LOGGING'):
 SConscript('#resource/third_party_libs.scons', 'lib_env')
 
 if target_os in ['linux']:
-    # Verify that 'hippomocks' mocking code is installed.  If not,
-    # get it and install it
-    SConscript('#extlibs/hippomocks.scons')
+    SConscript('#extlibs/hippomocks/SConscript')
 
 rd_test_env = lib_env.Clone()
 
@@ -57,7 +55,7 @@ src_dir = lib_env.get('SRC_DIR')
 ######################################################################
 rd_test_env.AppendUnique(
         CPPPATH = [
-                src_dir + '/extlibs/hippomocks-master',
+                src_dir + '/extlibs/hippomocks/hippomocks',
                 '../include',
                 src_dir + '/resource/include',
                 src_dir + '/resource/csdk/connectivity/api',
index 6a9dde5..7f7a139 100755 (executable)
@@ -52,8 +52,8 @@ provisiontests_env.PrependUnique(CPPPATH = [
                '../../csdk/ocrandom/include',
                '../../csdk/logger/include',
                '../../csdk/connectivity/lib/libcoap-4.1.1/include',
-               '../../../extlibs/hippomocks-master/HippoMocks',
-               '../../../extlibs/hippomocks-master/HippoMocksTest'
+               '../../../extlibs/hippomocks/hippomocks/',
+               '../../../extlibs/hippomocks/hippomocks/'
                ])
 
 provisiontests_env.PrependUnique(LIBS = [
index ae080c8..02ffff6 100644 (file)
@@ -35,7 +35,7 @@ if target_os in ['linux', 'windows', 'darwin', 'msys_nt']:
     if target_os in ['linux', 'windows']:
         # Verify that 'hippomocks' mocking code is installed.  If not,
         # get it and install it
-        SConscript('#extlibs/hippomocks.scons')
+        SConscript('#extlibs/hippomocks/SConscript')
 
         # Build Common unit tests
         SConscript('c_common/unittests/SConscript', 'test_env')
index 76606da..f9e0119 100644 (file)
@@ -45,8 +45,7 @@ unittests_env.PrependUnique(CPPPATH = [
                '../csdk/ocsocket/include',
                '../c_common/ocrandom/include',
                '../csdk/logger/include',
-               '#extlibs/hippomocks-master/HippoMocks',
-               '#extlibs/hippomocks-master/HippoMocksTest'
+               '#extlibs/hippomocks/hippomocks',
                ])
 
 if target_os in ['windows']:
index 46aa0ad..4adbac0 100644 (file)
@@ -62,7 +62,7 @@ if not CoAP_test_env.get('RELEASE'):
     CoAP_test_env.PrependUnique(LIBS = ['gcov'])
     CoAP_test_env.AppendUnique(CXXFLAGS = ['--coverage'])
 
-CoAP_test_env.AppendUnique(CPPPATH = [src_dir + '/extlibs/hippomocks-master',
+CoAP_test_env.AppendUnique(CPPPATH = ['#/extlibs/hippomocks/hippomocks',
                         '../include',
                         os.path.join(src_dir, 'resource/csdk/include'),
                         os.path.join(src_dir, 'resource/csdk/stack/include'),
index 4ffe2d4..ff38cd5 100644 (file)
@@ -66,7 +66,7 @@ easysetup_test_env.AppendUnique(CXXFLAGS = ['-pthread'])
 easysetup_test_env.AppendUnique(LIBS = ['pthread'])
 
 easysetup_test_env.PrependUnique(CPPPATH = [
-    '#/extlibs/hippomocks-master',
+    '#/extlibs/hippomocks/hippomocks',
     gtest_dir + '/include',
     '#/resource/include',
     '#/resource/csdk/connectivity/api',
index 2766d18..51cddc4 100644 (file)
@@ -63,7 +63,7 @@ easysetup_test_env.AppendUnique(CXXFLAGS = ['-pthread'])
 easysetup_test_env.AppendUnique(LIBS = ['pthread'])
 
 easysetup_test_env.PrependUnique(CPPPATH = [
-    '#/extlibs/hippomocks-master',
+    '#/extlibs/hippomocks/hippomocks',
     gtest_dir + '/include',
     '#/resource/csdk/include',
     '#/resource/csdk/connectivity/api',
index c2d67df..ad6dbae 100644 (file)
@@ -70,7 +70,7 @@ notification_wrapper_test_env.AppendUnique(CXXFLAGS = ['-pthread'])
 notification_wrapper_test_env.AppendUnique(LIBS = ['pthread'])
 
 notification_wrapper_test_env.PrependUnique(CPPPATH = [
-    '#/extlibs/hippomocks-master',
+    '#/extlibs/hippomocks/hippomocks',
     gtest_dir + '/include',
     '../provider/inc',
     '../consumer/inc',
index 1c891da..2d9bc11 100644 (file)
@@ -68,7 +68,7 @@ notification_test_env.AppendUnique(LINKFLAGS = ['-Wl,--no-as-needed'])
 notification_test_env.AppendUnique(CXXFLAGS = ['-pthread'])
 notification_test_env.AppendUnique(LIBS = ['pthread'])
 
-notification_test_env.PrependUnique(CPPPATH = [ src_dir + '/extlibs/hippomocks-master', gtest_dir + '/include'])
+notification_test_env.PrependUnique(CPPPATH = [ '#/extlibs/hippomocks/hippomocks', gtest_dir + '/include'])
 notification_test_env.AppendUnique(CPPPATH = ['../include'])
 notification_test_env.AppendUnique(CPPPATH = ['../src/consumer'])
 notification_test_env.AppendUnique(CPPPATH = ['../src/provider'])
index 4b38a3d..0ef115d 100644 (file)
@@ -117,7 +117,7 @@ if target_os in ['android']:
     container_gtest_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
     container_gtest_env.PrependUnique(LIBS = ['gnustl_shared', 'compatibility', 'log'])
 
-container_gtest_env.PrependUnique(CPPPATH = [src_dir + '/extlibs/hippomocks-master'])
+container_gtest_env.PrependUnique(CPPPATH = ['#/extlibs/hippomocks/hippomocks'])
 
 if int(containerJavaSupport):
     try:
index 189bc45..1c2b9e2 100644 (file)
@@ -105,7 +105,7 @@ if target_os in ['linux']:
        rcs_common_test_env = rcs_common_env.Clone();
 
        rcs_common_test_env.PrependUnique(CPPPATH = [
-               rcs_common_test_env.get('SRC_DIR')+'/extlibs/hippomocks-master',
+               '#/extlibs/hippomocks/hippomocks',
                'utils/include'
                ])
 
index 2003c25..0d07127 100644 (file)
@@ -60,7 +60,7 @@ broker_test_env.AppendUnique(CPPPATH = [
     '#/resource/oc_logger/include'
 ])
 
-broker_test_env.PrependUnique(CPPPATH = [broker_test_env.get('SRC_DIR')+'/extlibs/hippomocks-master'])
+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'])
index 88ecfd5..828700f 100644 (file)
@@ -58,7 +58,7 @@ cache_test_env.AppendUnique(CPPPATH = [
     '#/resource/include',
     '#/resource/oc_logger/include'
 ])
-cache_test_env.PrependUnique(CPPPATH = [cache_test_env.get('SRC_DIR')+'/extlibs/hippomocks-master'])
+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',
index 52af1cb..1215629 100644 (file)
@@ -97,7 +97,7 @@ if target_os in ['linux']:
        server_builder_test_env = server_builder_env.Clone();
 
        server_builder_test_env.AppendUnique(CPPPATH = [
-               server_builder_test_env.get('SRC_DIR')+'/extlibs/hippomocks-master',
+               '#/extlibs/hippomocks/hippomocks',
                '../common/utils/include'
                ])
 
index cbfa921..baf9450 100644 (file)
@@ -41,9 +41,7 @@ if lib_env.get('LOGGING'):
 SConscript('#service/third_party_libs.scons', 'lib_env')
 
 if target_os in ['linux']:
-    # Verify that 'hippomocks' mocking code is installed.  If not,
-    # get it and install it
-    SConscript('#extlibs/hippomocks.scons')
+    SConscript('#extlibs/hippomocks/SConscript')
 
 rcs_test_env = lib_env.Clone()
 
@@ -57,7 +55,7 @@ src_dir = lib_env.get('SRC_DIR')
 ######################################################################
 rcs_test_env.AppendUnique(
         CPPPATH = [
-                '#/extlibs/hippomocks-master',
+                '#/extlibs/hippomocks/hippomocks',
                 '../include',
                 '../src/common/utils/include',
                 '#/resource/csdk/include',
index 6860b4e..f64e250 100644 (file)
@@ -61,7 +61,7 @@ if not scene_test_env.get('RELEASE'):
     scene_test_env.AppendUnique(CXXFLAGS = ['--coverage'])
 
 scene_test_env.PrependUnique(CPPPATH = [
-    '#/extlibs/hippomocks-master',
+    '#/extlibs/hippomocks/hippomocks',
     '../include',
     '../src',
     '#/service/resource-encapsulation/include',