From 82cb38e573c3be5a24b00d44dd8008297975b972 Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Thu, 16 Oct 2014 14:27:25 -0700 Subject: Fix a wonderful copy/paste time bomb. While trying to move projects over to libc++, I came across a link error where these tests were failing to link when built with mma, but not with mm. When building with mma, they would fail to link because of symbols missing from the NDK's stlport. Huh? When cleaning up this makefile a while ago, I removed the redundant static_libraries := gtest/stlport, but missed removing the LOCAL_STATIC_LIBRARIES :+ $(static_libraries). The Android.mk in bootable/recovery/tests was being loaded before this one, and _did_ in fact define static_libraries. It defined it to, redundantly, include the stlport flavored gtest libraries (another wonderful piece of copy/paste if I do say so myself). Because of this, running mma with this project set to use libc++ meant that the final binary was linked with not just libc++ and the libc++ gtest libraries, but also the stlport gtest libraries and the NDK's stlport. Change-Id: Ibc545f95f701126ec9f0d0d0ac3d2a0feba78f8a --- services/input/tests/Android.mk | 67 +++++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 32 deletions(-) diff --git a/services/input/tests/Android.mk b/services/input/tests/Android.mk index 3eb93dc5e7cf..68093ecce44f 100644 --- a/services/input/tests/Android.mk +++ b/services/input/tests/Android.mk @@ -1,39 +1,42 @@ -# Build the unit tests. -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) +# +# Copyright (C) 2014 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. +# -# Build the unit tests. -test_src_files := \ - InputReader_test.cpp \ - InputDispatcher_test.cpp +LOCAL_PATH:= $(call my-dir) -shared_libraries := \ - libcutils \ +INPUT_SERVICE_TEST_SHARED_LIBRARIES := \ liblog \ - libandroidfw \ libutils \ - libhardware \ - libhardware_legacy \ - libui \ - libskia \ libinput \ - libinputservice - -c_includes := \ - external/skia/include/core - -module_tags := eng tests + libskia \ + libinputservice \ -$(foreach file,$(test_src_files), \ - $(eval include $(CLEAR_VARS)) \ - $(eval LOCAL_SHARED_LIBRARIES := $(shared_libraries)) \ - $(eval LOCAL_STATIC_LIBRARIES := $(static_libraries)) \ - $(eval LOCAL_C_INCLUDES := $(c_includes)) \ - $(eval LOCAL_SRC_FILES := $(file)) \ - $(eval LOCAL_MODULE := $(notdir $(file:%.cpp=%))) \ - $(eval LOCAL_MODULE_TAGS := $(module_tags)) \ - $(eval include $(BUILD_NATIVE_TEST)) \ -) +include $(CLEAR_VARS) +LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk +LOCAL_MODULE := InputReader_test +LOCAL_MODULE_TAGS := eng tests +LOCAL_C_INCLUDES := external/skia/include/core +LOCAL_SRC_FILES := InputReader_test.cpp +LOCAL_SHARED_LIBRARIES := $(INPUT_SERVICE_TEST_SHARED_LIBRARIES) +include $(BUILD_NATIVE_TEST) -# Build the manual test programs. -include $(call all-makefiles-under, $(LOCAL_PATH)) +include $(CLEAR_VARS) +LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk +LOCAL_MODULE := InputDispatcher_test +LOCAL_MODULE_TAGS := eng tests +LOCAL_C_INCLUDES := external/skia/include/core +LOCAL_SRC_FILES := InputDispatcher_test.cpp +LOCAL_SHARED_LIBRARIES := $(INPUT_SERVICE_TEST_SHARED_LIBRARIES) +include $(BUILD_NATIVE_TEST) -- cgit v1.2.3-59-g8ed1b