Android.mk revision 929d6517dfd338f0d481dbe6587643d5aef27ec6
1#
2# Copyright (C) 2014 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17# ==========================================================
18# Setup some common variables for the different build
19# targets here.
20# ==========================================================
21LOCAL_PATH:= $(call my-dir)
22
23testFiles := \
24    ApkAssets_test.cpp \
25    AppAsLib_test.cpp \
26    Asset_test.cpp \
27    AssetManager2_test.cpp \
28    AttributeFinder_test.cpp \
29    AttributeResolution_test.cpp \
30    ByteBucketArray_test.cpp \
31    Config_test.cpp \
32    ConfigLocale_test.cpp \
33    Idmap_test.cpp \
34    LoadedArsc_test.cpp \
35    ResourceUtils_test.cpp \
36    ResTable_test.cpp \
37    Split_test.cpp \
38    StringPiece_test.cpp \
39    TestHelpers.cpp \
40    TestMain.cpp \
41    Theme_test.cpp \
42    TypeWrappers_test.cpp \
43    ZipUtils_test.cpp
44
45benchmarkFiles := \
46    AssetManager2_bench.cpp \
47    BenchMain.cpp \
48    TestHelpers.cpp \
49    Theme_bench.cpp
50
51androidfw_test_cflags := \
52    -Wall \
53    -Werror \
54    -Wunused \
55    -Wunreachable-code \
56    -Wno-missing-field-initializers
57
58# gtest is broken.
59androidfw_test_cflags += -Wno-unnamed-type-template-args
60
61# ==========================================================
62# Build the host tests: libandroidfw_tests
63# ==========================================================
64include $(CLEAR_VARS)
65
66LOCAL_MODULE := libandroidfw_tests
67LOCAL_CFLAGS := $(androidfw_test_cflags)
68LOCAL_SRC_FILES := $(testFiles)
69LOCAL_STATIC_LIBRARIES := \
70    libandroidfw \
71    libbase \
72    libutils \
73    libcutils \
74    liblog \
75    libz \
76    libziparchive
77LOCAL_PICKUP_FILES := $(LOCAL_PATH)/data
78
79include $(BUILD_HOST_NATIVE_TEST)
80
81# ==========================================================
82# Build the device tests: libandroidfw_tests
83# ==========================================================
84ifneq ($(SDK_ONLY),true)
85include $(CLEAR_VARS)
86
87LOCAL_MODULE := libandroidfw_tests
88LOCAL_CFLAGS := $(androidfw_test_cflags)
89LOCAL_SRC_FILES := $(testFiles) \
90    BackupData_test.cpp \
91    ObbFile_test.cpp \
92
93LOCAL_SHARED_LIBRARIES := \
94    libandroidfw \
95    libbase \
96    libcutils \
97    libutils \
98    libui \
99    libziparchive 
100LOCAL_PICKUP_FILES := $(LOCAL_PATH)/data
101
102include $(BUILD_NATIVE_TEST)
103
104# ==========================================================
105# Build the device benchmarks: libandroidfw_benchmarks
106# ==========================================================
107include $(CLEAR_VARS)
108
109LOCAL_MODULE := libandroidfw_benchmarks
110LOCAL_CFLAGS := $(androidfw_test_cflags)
111LOCAL_SRC_FILES := $(benchmarkFiles)
112LOCAL_STATIC_LIBRARIES := \
113    libgoogle-benchmark
114LOCAL_SHARED_LIBRARIES := \
115    libandroidfw \
116    libbase \
117    libcutils \
118    libutils \
119    libziparchive
120LOCAL_PICKUP_FILES := $(LOCAL_PATH)/data
121
122include $(BUILD_NATIVE_TEST)
123endif # Not SDK_ONLY
124
125