1# Copyright (C) 2015 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15LOCAL_PATH:= $(call my-dir)
16
17# Make mock HAL library
18# ============================================================
19
20include $(CLEAR_VARS)
21
22LOCAL_REQUIRED_MODULES :=
23
24LOCAL_CFLAGS += -Wall -Werror -Wextra -Wno-unused-parameter -Wno-unused-function \
25                -Wunused-variable -Winit-self -Wwrite-strings -Wshadow
26
27LOCAL_C_INCLUDES += \
28	$(JNI_H_INCLUDE) \
29	$(LOCAL_PATH)/../../service/jni \
30	$(call include-path-for, libhardware)/hardware \
31	$(call include-path-for, libhardware_legacy)/hardware_legacy \
32	packages/apps/Test/connectivity/sl4n/rapidjson/include \
33	libcore/include
34
35LOCAL_SRC_FILES := \
36	jni/wifi_hal_mock.cpp
37
38ifdef INCLUDE_NAN_FEATURE
39LOCAL_SRC_FILES += \
40	jni/wifi_nan_hal_mock.cpp
41endif
42
43LOCAL_MODULE := libwifi-hal-mock
44
45LOCAL_STATIC_LIBRARIES += libwifi-hal
46LOCAL_SHARED_LIBRARIES += \
47	libnativehelper \
48	libcutils \
49	libutils \
50	libhardware \
51	libhardware_legacy \
52	libnl \
53	libdl \
54	libwifi-service
55
56include $(BUILD_SHARED_LIBRARY)
57
58# Make test APK
59# ============================================================
60include $(CLEAR_VARS)
61
62LOCAL_MODULE_TAGS := tests
63
64RESOURCE_FILES := $(call all-named-files-under, R.java, $(intermediates.COMMON))
65
66LOCAL_SRC_FILES := $(call all-subdir-java-files) \
67	$RESOURCE_FILES
68
69ifndef INCLUDE_NAN_FEATURE
70LOCAL_SRC_FILES := $(filter-out $(call all-java-files-under, \
71          src/com/android/server/wifi/nan),$(LOCAL_SRC_FILES))
72endif
73
74# Provide jack a list of classes to exclude form code coverage
75# This list is generated from the java source files in this module
76# The list is a comma separated list of class names with * matching zero or more characters.
77# Example:
78#   Input files: src/com/android/server/wifi/Test.java src/com/android/server/wifi/AnotherTest.java
79#   Generated exclude list: com.android.server.wifi.Test*,com.android.server.wifi.AnotherTest*
80
81# Filter all src files to just java files
82local_java_files := $(filter %.java,$(LOCAL_SRC_FILES))
83# Transform java file names into full class names.
84# This only works if the class name matches the file name and the directory structure
85# matches the package.
86local_classes := $(subst /,.,$(patsubst src/%.java,%,$(local_java_files)))
87# Utility variables to allow replacing a space with a comma
88comma:= ,
89empty:=
90space:= $(empty) $(empty)
91# Convert class name list to jacoco exclude list
92# This appends a * to all classes and replace the space separators with commas.
93# These patterns will match all classes in this module and their inner classes.
94jacoco_exclude := $(subst $(space),$(comma),$(patsubst %,%*,$(local_classes)))
95
96jacoco_include := com.android.server.wifi.*,android.net.wifi.*
97
98LOCAL_JACK_COVERAGE_INCLUDE_FILTER := $(jacoco_include)
99LOCAL_JACK_COVERAGE_EXCLUDE_FILTER := $(jacoco_exclude)
100
101# wifi-service and services must be included here so that the latest changes
102# will be used when tests. Otherwise the tests would run against the installed
103# system.
104# TODO figure out if this is the correct thing to do, this seems to not be right
105# since neither is declared a static java library.
106LOCAL_STATIC_JAVA_LIBRARIES := \
107	android-support-test \
108	mockito-target \
109	services \
110	wifi-service \
111
112LOCAL_JAVA_LIBRARIES := \
113	android.test.runner \
114	wifi-service \
115	services \
116
117# These must be explicitly included because they are not normally accessible
118# from apps.
119LOCAL_JNI_SHARED_LIBRARIES := \
120	libwifi-service \
121	libc++ \
122	libLLVM \
123	libutils \
124	libunwind \
125	libhardware_legacy \
126	libbase \
127	libhardware \
128	libnl \
129	libcutils \
130	libnetutils \
131	libbacktrace \
132	libnativehelper \
133	liblzma \
134
135ifdef WPA_SUPPLICANT_VERSION
136LOCAL_JNI_SHARED_LIBRARIES += libwpa_client
137endif
138
139LOCAL_PACKAGE_NAME := FrameworksWifiTests
140LOCAL_JNI_SHARED_LIBRARIES += libwifi-hal-mock
141
142include $(BUILD_PACKAGE)
143