aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Wiley <wiley@google.com>2015-07-24 16:27:31 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2015-07-24 16:27:31 +0000
commit9539beb282149fec80fd7150060b22ea7e379a3c (patch)
treeb0f7837651699054356333348bc7dc1eee4ceac5
parent370e17e756ed236ba635b9c4fe6632adead7a83f (diff)
parenta3318c945e9997cc6c2865d2691ac25687a53634 (diff)
downloadgmock-9539beb282149fec80fd7150060b22ea7e379a3c.tar.gz
Merge "Tweaks for googlemock."
-rw-r--r--Android.mk17
-rw-r--r--CleanSpec.mk49
-rw-r--r--MODULE_LICENSE_BSD_LIKE0
-rw-r--r--NOTICE28
-rw-r--r--README.android33
-rw-r--r--src/Android.mk141
-rw-r--r--test/Android.mk84
7 files changed, 337 insertions, 15 deletions
diff --git a/Android.mk b/Android.mk
new file mode 100644
index 0000000..44199ab
--- /dev/null
+++ b/Android.mk
@@ -0,0 +1,17 @@
+# Copyright (C) 2009 The Android Open Source Project
+#
+# 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.
+#
+#
+
+include $(call all-subdir-makefiles)
diff --git a/CleanSpec.mk b/CleanSpec.mk
new file mode 100644
index 0000000..b84e1b6
--- /dev/null
+++ b/CleanSpec.mk
@@ -0,0 +1,49 @@
+# Copyright (C) 2007 The Android Open Source Project
+#
+# 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.
+#
+
+# If you don't need to do a full clean build but would like to touch
+# a file or delete some intermediate files, add a clean step to the end
+# of the list. These steps will only be run once, if they haven't been
+# run before.
+#
+# E.g.:
+# $(call add-clean-step, touch -c external/sqlite/sqlite3.h)
+# $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates)
+#
+# Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with
+# files that are missing or have been moved.
+#
+# Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory.
+# Use $(OUT_DIR) to refer to the "out" directory.
+#
+# If you need to re-do something that's already mentioned, just copy
+# the command and add it to the bottom of the list. E.g., if a change
+# that you made last week required touching a file and a change you
+# made today requires touching the same file, just copy the old
+# touch step and add it to the end of the list.
+#
+# ************************************************
+# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
+# ************************************************
+
+# For example:
+#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates)
+#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates)
+#$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f)
+#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*)
+
+# ************************************************
+# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
+# ************************************************
diff --git a/MODULE_LICENSE_BSD_LIKE b/MODULE_LICENSE_BSD_LIKE
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/MODULE_LICENSE_BSD_LIKE
diff --git a/NOTICE b/NOTICE
new file mode 100644
index 0000000..1941a11
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1,28 @@
+Copyright 2008, Google Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ * Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with the
+distribution.
+ * Neither the name of Google Inc. nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/README.android b/README.android
index 2454a58..4ba95d5 100644
--- a/README.android
+++ b/README.android
@@ -1,17 +1,20 @@
-# URL: https://code.google.com/p/googlemock/downloads/list
-# Version: 1.7.0
+URL:http://code.google.com/p/googlemock/downloads/list
+Version: 1.7.0
-# Removed non Android build files and source of gtest:
- rm -f aclocal.m4
- rm -f CMakeLists.txt
- rm -f configure
- rm -f configure.ac
- rm -f Makefile.am
- rm -f Makefile.in
- rm -rf build-aux
- rm -rf fused-src
- rm -rf gtest
- rm -rf make
- rm -rf msvc
- rm -rf scripts
+Added Android.mk, src/Android.mk and test/Android.mk files.
+Added NOTICE and the module license file.
+
+Removed non Android build files:
+ rm -f aclocal.m4
+ rm -f CMakeLists.txt
+ rm -f configure
+ rm -f configure.ac
+ rm -f Makefile.am
+ rm -f Makefile.in
+ rm -rf build-aux/
+ rm -rf fused-src/
+ rm -rf gtest/
+ rm -rf make/
+ rm -rf msvc/
+ rm -rf scripts/
diff --git a/src/Android.mk b/src/Android.mk
new file mode 100644
index 0000000..fc7b74e
--- /dev/null
+++ b/src/Android.mk
@@ -0,0 +1,141 @@
+# Copyright (C) 2015 The Android Open Source Project
+#
+# 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.
+#
+#
+
+# Gmock builds 2 libraries: libgmock and libgmock_main. libgmock
+# contains most of the code (assertions...) and libgmock_main just
+# provide a common main to run the test (ie if you link against
+# libgmock_main you won't/should not provide a main() entry point.
+#
+# We build these 2 libraries for the target device and for the host if
+# it is running linux and using ASTL.
+#
+
+# TODO: The targets below have some redundancy. Check if we cannot
+# condense them using function(s) for the common code.
+
+LOCAL_PATH := $(call my-dir)
+
+libgmock_target_includes := \
+ $(LOCAL_PATH)/.. \
+ $(LOCAL_PATH)/../include \
+ $(TOP)/external/gtest/include
+
+libgmock_host_includes := \
+ $(LOCAL_PATH)/.. \
+ $(LOCAL_PATH)/../include \
+ $(TOP)/external/gtest/include
+
+libgmock_cflags := \
+ -Wno-missing-field-initializers \
+
+#######################################################################
+# gmock lib for the NDK
+
+include $(CLEAR_VARS)
+LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
+
+LOCAL_SDK_VERSION := 9
+LOCAL_NDK_STL_VARIANT := gnustl_static
+
+LOCAL_CPP_EXTENSION := .cc
+LOCAL_SRC_FILES := gmock-all.cc
+LOCAL_C_INCLUDES := $(libgmock_target_includes)
+LOCAL_CPPFLAGS := -std=c++11
+LOCAL_C_FLAGS += $(libgmock_cflags)
+LOCAL_MODULE := libgmock_ndk
+
+include $(BUILD_STATIC_LIBRARY)
+
+#######################################################################
+# gmock_main for the NDK
+
+include $(CLEAR_VARS)
+LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
+
+LOCAL_SDK_VERSION := 9
+LOCAL_NDK_STL_VARIANT := gnustl_static
+
+LOCAL_CPP_EXTENSION := .cc
+LOCAL_SRC_FILES := gmock_main.cc
+LOCAL_C_INCLUDES := $(libgmock_target_includes)
+LOCAL_CPPFLAGS := -std=c++11
+LOCAL_C_FLAGS += $(libgmock_cflags)
+LOCAL_MODULE := libgmock_main_ndk
+
+include $(BUILD_STATIC_LIBRARY)
+
+# Don't build for unbundled branches
+ifeq (,$(TARGET_BUILD_APPS))
+#######################################################################
+# gmock lib host
+
+include $(CLEAR_VARS)
+
+LOCAL_CPP_EXTENSION := .cc
+LOCAL_SRC_FILES := gmock-all.cc
+LOCAL_C_INCLUDES := $(libgmock_host_includes)
+LOCAL_C_FLAGS += $(libgmock_cflags)
+LOCAL_MODULE := libgmock_host
+LOCAL_MULTILIB := both
+LOCAL_ADDRESS_SANITIZER := false
+
+include $(BUILD_HOST_STATIC_LIBRARY)
+
+#######################################################################
+# gmock_main lib target
+
+include $(CLEAR_VARS)
+
+LOCAL_CLANG := true
+LOCAL_CPP_EXTENSION := .cc
+LOCAL_SRC_FILES := gmock_main.cc
+LOCAL_C_INCLUDES := $(libgmock_host_includes)
+LOCAL_C_FLAGS += $(libgmock_cflags)
+LOCAL_MODULE := libgmock_main_host
+LOCAL_MULTILIB := both
+LOCAL_ADDRESS_SANITIZER := false
+
+include $(BUILD_HOST_STATIC_LIBRARY)
+
+#######################################################################
+# gmock lib target
+
+include $(CLEAR_VARS)
+
+LOCAL_CLANG := true
+LOCAL_CPP_EXTENSION := .cc
+LOCAL_SRC_FILES := gmock-all.cc
+LOCAL_C_INCLUDES := $(libgmock_target_includes)
+LOCAL_CFLAGS += $(libgmock_cflags)
+LOCAL_MODULE := libgmock
+LOCAL_ADDRESS_SANITIZER := false
+
+include $(BUILD_STATIC_LIBRARY)
+
+#######################################################################
+# gmock_main lib target
+
+include $(CLEAR_VARS)
+
+LOCAL_CPP_EXTENSION := .cc
+LOCAL_SRC_FILES := gmock_main.cc
+LOCAL_C_INCLUDES := $(libgmock_target_includes)
+LOCAL_CFLAGS += $(libgmock_cflags)
+LOCAL_MODULE := libgmock_main
+LOCAL_ADDRESS_SANITIZER := false
+
+include $(BUILD_STATIC_LIBRARY)
+endif
diff --git a/test/Android.mk b/test/Android.mk
new file mode 100644
index 0000000..8aca24b
--- /dev/null
+++ b/test/Android.mk
@@ -0,0 +1,84 @@
+# Copyright (C) 2015 The Android Open Source Project
+#
+# 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.
+#
+#
+
+# Test for gmock. Run using 'runtest'.
+# The linux build and tests are run under valgrind by 'runtest'.
+
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+# TODO: Refactor these as 1st class build templates as suggested in
+# review of the original import.
+
+libgmock_test_common_includes := \
+ $(LOCAL_PATH)/../include \
+ $(LOCAL_PATH)/.. \
+ $(TOP)/external/gtest/include \
+
+libgmock_test_includes := $(libgmock_test_common_includes)
+libgmock_test_static_lib := libgmock_main libgmock libgtest libgtest_main
+libgmock_test_ldflags :=
+
+libgmock_test_host_includes := $(libgmock_test_common_includes)
+libgmock_test_host_static_lib := libgmock_main_host libgmock_host libgtest_host libgtest_main_host
+libgmock_test_host_ldflags := -lpthread
+
+# $(2) and $(4) must be set or cleared in sync. $(2) is used to
+# generate the right make target (host vs device). $(4) is used in the
+# module's name and to have different module names for the host vs
+# device builds. Finally $(4) is used to pick up the right set of
+# libraries, typically the host libs have a _host suffix in their
+# names.
+# $(1): source list
+# $(2): "HOST_" or empty
+# $(3): extra CFLAGS or empty
+# $(4): "_host" or empty
+# $(5): "TARGET_OUT_DATA_NATIVE_TESTS" or empty (where to install)
+define _define-test
+$(foreach file,$(1), \
+ $(eval include $(CLEAR_VARS)) \
+ $(eval LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk) \
+ $(eval LOCAL_CPP_EXTENSION := .cc) \
+ $(eval LOCAL_SRC_FILES := $(file)) \
+ $(eval LOCAL_C_INCLUDES := $(libgmock_test$(4)_includes)) \
+ $(eval LOCAL_MODULE := $(notdir $(file:%.cc=%))$(4)) \
+ $(eval LOCAL_CFLAGS += $(3) -Wno-empty-body) \
+ $(eval LOCAL_LDFLAGS += $(libgmock_test$(4)_ldflags)) \
+ $(eval LOCAL_STATIC_LIBRARIES := $(libgmock_test$(4)_static_lib)) \
+ $(eval LOCAL_SHARED_LIBRARIES := $(libgmock_test$(4)_shared_lib)) \
+ $(if $(2),,$(eval LOCAL_MODULE_TAGS := tests)) \
+ $(eval LOCAL_MODULE_PATH := $($(5))) \
+ $(eval include $(BUILD_$(2)EXECUTABLE)) \
+)
+endef
+
+define host-test
+$(call _define-test,$(1),HOST_,-O0,_host,)
+endef
+
+define target-test
+$(call _define-test,$(1),,,,TARGET_OUT_DATA_NATIVE_TESTS)
+endef
+
+sources := \
+ gmock_test.cc \
+ gmock-spec-builders_test.cc \
+ gmock_link_test.cc \
+
+# The remaining tests aren't executed by the configure/make/make check sequence.
+
+$(call host-test, $(sources))
+$(call target-test, $(sources))