LatinIME/tests/Android.mk

43 lines
1.3 KiB
Makefile
Raw Normal View History

# Copyright (C) 2011 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
# We only want this apk build for tests.
LOCAL_MODULE_TAGS := tests
LOCAL_CERTIFICATE := shared
# Do not compress dictionary files to mmap dict data runtime
LOCAL_AAPT_FLAGS += -0 .dict
# Do not compress test data file
LOCAL_AAPT_FLAGS += -0 .txt
LOCAL_STATIC_JAVA_LIBRARIES := \
android-support-test \
Fix dependencies of packages that target earlier releases A previous change added legacy-android-test as a static dependency to all packages that build against the current, test_current or system_current and failed to compile when the junit and android.test classes were removed from the API. Unfortunately, those changes did not take into account that some of those packages target earlier API versions and so will always have the classes available at runtime. This change replaces those static dependencies with dynamic dependencies for any package that targets an earlier API version. The file changes were made automatically by a tool that constructed and then analyzed a full dependency graph of all the Android Java modules. The individual changes were checked manually to ensure that the changes matched the intent. The affected modules were built against an API with the junit and android.test classes removed. Any issues found during this process resulted in either the tool being updated to address the issue or a separate change being made to fix an existing problem with the build. A sample of the affected packages were run to ensure that they worked as expected at runtime; no issues were found during testing. The following change descriptions were generated automatically and so may be a little repetitive. They are provided to give the reviewer enough information to check the comments match what has actually been changed and check the reasoning behind the changes. * tests/Android.mk Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES because LatinIMETests's manifest file (AndroidManifest.xml) targets API level 21 and dynamically includes the android.test.runner library at runtime so there is no point in statically including the classes. Added 'android.test.mock.sdk' and 'legacy-android-test' to LOCAL_JAVA_LIBRARIES because module LatinIMETests builds against 'LOCAL_SDK_VERSION := current' and uses classes from packages android.test and android.test.mock (possibly indirectly) so will no longer compile once they are removed from the API. Dependency 'android.test.mock.sdk' is used instead of 'android.test.mock' because module LatinIMETests builds against the API not internal jars and so should use libraries that build against the API not internal jars. A future change will replace the dependency on 'legacy-android-test', which builds against the internal jars with a dependency on 'android.legacy.test' which will build against the API. Bug: 30188076 Test: make checkbuild and ran a sample of tests Change-Id: Icab8a4c4801536f112e29dfd2dc66be8b90b811d
2017-06-13 14:53:11 +00:00
mockito-target-minus-junit4
Flatten dependency hierarchy of legacy-android-test Previous changes statically included legacy-android-test in preparation for removing android.test.* and junit.* classes from the android.jar. Unfortunately, that lead to duplicate classes between APKs and the bootclasspath which caused build problems (Proguard) and also runtime problems (when targeting and running on older releases). Switching from statically including the classes to using the runtime libraries cannot be done in one step because legacy-android-test is statically included in libraries which are used in many APKs and so removing it from those libraries requires that all APKs be updated at once. Doing that atomically across dozens of projects is not practical. This change modifies APKS that statically include the legacy-android-test library indirectly. * If the APK manifest uses the android.test.runner library then the APK is modified to stop statically including legacy-android-test and instead build against android.test.base/mock/runner libraries instead. * Otherwise, the APK statically includes legacy-android-test. Also, any libraries that statically include are modified to stop statically including it and if it has source dependencies on the classes is changed to build against the android.test.base/mock/runner libraries. The following change descriptions were generated automatically and so may be a little repetitive. They are provided to give the reviewer enough information to check the comments match what has actually been changed and check the reasoning behind the changes. * tests/Android.mk Replaced 'legacy-android-test' with 'android.test.runner.stubs' in LOCAL_JAVA_LIBRARIES because LatinIMETests's source depends on its classes. The classes do not need to be statically included because the classes will be provided by the runtime, either from the default bootclasspath or from the android.test.runner library that LatinIMETests specifies in its manifest. Bug: 30188076 Test: make checkbuild Change-Id: I3c70889b35d402626f79c986771b9c2ea8823b8a
2017-12-05 18:36:57 +00:00
LOCAL_JAVA_LIBRARIES := android.test.mock.stubs android.test.runner.stubs
# Include all test java files.
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_PACKAGE_NAME := LatinIMETests
LOCAL_INSTRUMENTATION_FOR := LatinIME
LOCAL_SDK_VERSION := current
include $(BUILD_PACKAGE)