1#
2# Copyright 2017 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
17LOCAL_PATH:= $(call my-dir)
18
19# Build a tiny library that the test app can dynamically load
20
21include $(CLEAR_VARS)
22
23LOCAL_MODULE_TAGS := tests
24LOCAL_MODULE := DynamicCodeLoggerTestLibrary
25LOCAL_SRC_FILES := $(call all-java-files-under, src/com/android/dcl)
26
27include $(BUILD_JAVA_LIBRARY)
28
29dynamiccodeloggertest_jar := $(LOCAL_BUILT_MODULE)
30
31
32# Also build a native library that the test app can dynamically load
33
34include $(CLEAR_VARS)
35
36LOCAL_MODULE_TAGS := tests
37LOCAL_MODULE := DynamicCodeLoggerNativeTestLibrary
38LOCAL_SRC_FILES := src/cpp/com_android_dcl_Jni.cpp
39LOCAL_HEADER_LIBRARIES := jni_headers
40LOCAL_SDK_VERSION := 28
41LOCAL_NDK_STL_VARIANT := c++_static
42
43include $(BUILD_SHARED_LIBRARY)
44
45# And a standalone native executable that we can exec.
46
47include $(CLEAR_VARS)
48
49LOCAL_MODULE_TAGS := tests
50LOCAL_MODULE := DynamicCodeLoggerNativeExecutable
51LOCAL_SRC_FILES := src/cpp/test_executable.cpp
52
53include $(BUILD_EXECUTABLE)
54
55dynamiccodeloggertest_executable := $(LOCAL_BUILT_MODULE)
56
57# Build the test app itself
58
59include $(CLEAR_VARS)
60
61LOCAL_MODULE_TAGS := tests
62LOCAL_PACKAGE_NAME := DynamicCodeLoggerIntegrationTests
63LOCAL_SDK_VERSION := current
64LOCAL_COMPATIBILITY_SUITE := device-tests
65LOCAL_CERTIFICATE := shared
66LOCAL_SRC_FILES := $(call all-java-files-under, src/com/android/server/pm)
67
68LOCAL_STATIC_JAVA_LIBRARIES := \
69    androidx.test.rules \
70    truth-prebuilt \
71
72# Include both versions of the .so if we have 2 arch
73LOCAL_MULTILIB := both
74LOCAL_JNI_SHARED_LIBRARIES := \
75    DynamicCodeLoggerNativeTestLibrary \
76
77# This gets us the javalib.jar built by DynamicCodeLoggerTestLibrary above as well as the various
78# native binaries.
79LOCAL_JAVA_RESOURCE_FILES := \
80    $(dynamiccodeloggertest_jar) \
81    $(dynamiccodeloggertest_executable) \
82
83include $(BUILD_PACKAGE)
84