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