Heemin Seog | d0cfab0 | 2019-10-23 16:52:31 -0700 | [diff] [blame] | 1 | # Copyright (C) 2019 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 | |
| 15 | LOCAL_PATH := $(call my-dir) |
| 16 | include $(CLEAR_VARS) |
| 17 | |
| 18 | LOCAL_USE_AAPT2 := true |
| 19 | LOCAL_MODULE_TAGS := tests |
| 20 | |
| 21 | LOCAL_JACK_FLAGS := --multi-dex native |
| 22 | LOCAL_DX_FLAGS := --multi-dex |
| 23 | |
| 24 | LOCAL_PACKAGE_NAME := CarSystemUITests |
| 25 | LOCAL_PRIVATE_PLATFORM_APIS := true |
| 26 | LOCAL_COMPATIBILITY_SUITE := device-tests |
| 27 | |
| 28 | LOCAL_STATIC_ANDROID_LIBRARIES := \ |
| 29 | CarSystemUI-tests |
| 30 | |
| 31 | LOCAL_MULTILIB := both |
| 32 | |
| 33 | LOCAL_JNI_SHARED_LIBRARIES := \ |
| 34 | libdexmakerjvmtiagent \ |
| 35 | libmultiplejvmtiagentsinterferenceagent |
| 36 | |
| 37 | LOCAL_JAVA_LIBRARIES := \ |
| 38 | android.test.runner \ |
| 39 | telephony-common \ |
| 40 | android.test.base \ |
| 41 | |
| 42 | LOCAL_AAPT_FLAGS := --extra-packages com.android.systemui |
| 43 | |
| 44 | # sign this with platform cert, so this test is allowed to inject key events into |
| 45 | # UI it doesn't own. This is necessary to allow screenshots to be taken |
| 46 | LOCAL_CERTIFICATE := platform |
| 47 | |
| 48 | # Provide jack a list of classes to exclude from code coverage. |
| 49 | # This is needed because the CarSystemUITests compile CarSystemUI source directly, rather than using |
| 50 | # LOCAL_INSTRUMENTATION_FOR := CarSystemUI. |
| 51 | # |
| 52 | # We want to exclude the test classes from code coverage measurements, but they share the same |
| 53 | # package as the rest of SystemUI so they can't be easily filtered by package name. |
| 54 | # |
| 55 | # Generate a comma separated list of patterns based on the test source files under src/ |
| 56 | # SystemUI classes are in ../src/ so they won't be excluded. |
| 57 | # Example: |
| 58 | # Input files: src/com/android/systemui/Test.java src/com/android/systemui/AnotherTest.java |
| 59 | # Generated exclude list: com.android.systemui.Test*,com.android.systemui.AnotherTest* |
| 60 | |
| 61 | # Filter all src files under src/ to just java files |
| 62 | local_java_files := $(filter %.java,$(call all-java-files-under, src)) |
| 63 | |
| 64 | # Transform java file names into full class names. |
| 65 | # This only works if the class name matches the file name and the directory structure |
| 66 | # matches the package. |
| 67 | local_classes := $(subst /,.,$(patsubst src/%.java,%,$(local_java_files))) |
| 68 | local_comma := , |
| 69 | local_empty := |
| 70 | local_space := $(local_empty) $(local_empty) |
| 71 | |
| 72 | # Convert class name list to jacoco exclude list |
| 73 | # This appends a * to all classes and replace the space separators with commas. |
| 74 | jacoco_exclude := $(subst $(space),$(comma),$(patsubst %,%*,$(local_classes))) |
| 75 | |
| 76 | LOCAL_JACK_COVERAGE_INCLUDE_FILTER := com.android.systemui.*,com.android.keyguard.* |
| 77 | LOCAL_JACK_COVERAGE_EXCLUDE_FILTER := $(jacoco_exclude) |
| 78 | |
| 79 | ifeq ($(EXCLUDE_SYSTEMUI_TESTS),) |
| 80 | include $(BUILD_PACKAGE) |
| 81 | endif |
| 82 | |
| 83 | # Reset variables |
| 84 | local_java_files := |
| 85 | local_classes := |
| 86 | local_comma := |
| 87 | local_space := |
| 88 | jacoco_exclude := |