From 35ff106cda5bd33f5ee4dbc0a19b68685fb0fed9 Mon Sep 17 00:00:00 2001 From: Paul Duffin Date: Tue, 5 Dec 2017 18:36:55 +0000 Subject: [PATCH] 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. * apps/CtsVerifier/Android.mk Removed legacy-android-test from LOCAL_JAVA_LIBRARIES because it is unnecessary as CtsVerifier's source does not depend on classes from legacy-android-test. 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 CtsVerifier specifies in its manifest. * common/device-side/device-info/Android.mk Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES because compatibility-device-info is not a package so does not need to statically include the classes Added 'android.test.base' to LOCAL_JAVA_LIBRARIES because compatibility-device-info has a source dependency on its classes * common/device-side/device-info/tests/Android.mk Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES because compatibility-device-info-tests is not a package so does not need to statically include the classes Added 'android.test.base' to LOCAL_JAVA_LIBRARIES because compatibility-device-info-tests has a source dependency on its classes * common/device-side/util/Android.mk Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES because compatibility-device-util is not a package so does not need to statically include the classes * hostsidetests/abioverride/app/Android.mk Added 'legacy-android-test' to LOCAL_STATIC_JAVA_LIBRARIES because CtsAbiOverrideTestApp was statically linked to it through its dependency on compatibility-device-util * hostsidetests/appsecurity/test-apps/AccessSerialModern/Android.mk Added 'legacy-android-test' to LOCAL_STATIC_JAVA_LIBRARIES because CtsAccessSerialModern was statically linked to it through its dependency on compatibility-device-util * hostsidetests/appsecurity/test-apps/DocumentClient/Android.mk Added 'android.test.runner.stubs' to LOCAL_JAVA_LIBRARIES because CtsDocumentClient's source depends on its classes and because of these changes they are no longer present on the compilation path. 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 CtsDocumentClient specifies in its manifest. * hostsidetests/appsecurity/test-apps/DocumentProvider/Android.mk Added 'legacy-android-test' to LOCAL_STATIC_JAVA_LIBRARIES because CtsDocumentProvider was statically linked to it through its dependency on compatibility-device-util * hostsidetests/appsecurity/test-apps/PermissionPolicy25/Android.mk Removed legacy-android-test from LOCAL_JAVA_LIBRARIES because it is unnecessary as CtsPermissionPolicyTest25's source does not depend on classes from legacy-android-test. 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 CtsPermissionPolicyTest25 specifies in its manifest. * hostsidetests/appsecurity/test-apps/UsePermissionApp22/Android.mk Replaced 'legacy-android-test' with 'android.test.base' in LOCAL_JAVA_LIBRARIES because CtsUsePermissionApp22'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 CtsUsePermissionApp22 specifies in its manifest. * hostsidetests/appsecurity/test-apps/UsePermissionApp23/Android.mk Added 'legacy-android-test' to LOCAL_STATIC_JAVA_LIBRARIES because CtsUsePermissionApp23 was statically linked to it through its dependency on compatibility-device-util Removed legacy-android-test from LOCAL_JAVA_LIBRARIES because it is unnecessary as CtsUsePermissionApp23 already statically includes legacy-android-test * hostsidetests/appsecurity/test-apps/UsePermissionApp25/Android.mk Added 'legacy-android-test' to LOCAL_STATIC_JAVA_LIBRARIES because CtsUsePermissionApp25 was statically linked to it through its dependency on compatibility-device-util * hostsidetests/appsecurity/test-apps/UsePermissionApp26/Android.mk Added 'legacy-android-test' to LOCAL_STATIC_JAVA_LIBRARIES because CtsUsePermissionApp26 was statically linked to it through its dependency on compatibility-device-util * hostsidetests/appsecurity/test-apps/UsePermissionAppLatest/Android.mk Added 'legacy-android-test' to LOCAL_STATIC_JAVA_LIBRARIES because CtsUsePermissionAppLatest was statically linked to it through its dependency on compatibility-device-util * hostsidetests/devicepolicy/app/Assistant/Android.mk Added 'legacy-android-test' to LOCAL_STATIC_JAVA_LIBRARIES because CtsDevicePolicyAssistApp was statically linked to it through its dependency on compatibility-device-util * hostsidetests/devicepolicy/app/CustomizationApp/Android.mk Added 'legacy-android-test' to LOCAL_STATIC_JAVA_LIBRARIES because CtsCustomizationApp was statically linked to it through its dependency on compatibility-device-util * hostsidetests/devicepolicy/app/DeviceAndProfileOwner/api23/Android.mk Replaced 'legacy-android-test' with 'android.test.runner.stubs' in LOCAL_JAVA_LIBRARIES because CtsDeviceAndProfileOwnerApp23'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 CtsDeviceAndProfileOwnerApp23 specifies in its manifest. * hostsidetests/devicepolicy/app/DeviceAndProfileOwner/api25/Android.mk Replaced 'legacy-android-test' with 'android.test.runner.stubs' in LOCAL_JAVA_LIBRARIES because CtsDeviceAndProfileOwnerApp25'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 CtsDeviceAndProfileOwnerApp25 specifies in its manifest. * hostsidetests/devicepolicy/app/DeviceAndProfileOwner/latest/Android.mk Added 'android.test.runner.stubs' to LOCAL_JAVA_LIBRARIES because CtsDeviceAndProfileOwnerApp's source depends on its classes and because of these changes they are no longer present on the compilation path. 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 CtsDeviceAndProfileOwnerApp specifies in its manifest. * hostsidetests/devicepolicy/app/WifiConfigCreator/Android.mk Added 'legacy-android-test' to LOCAL_STATIC_JAVA_LIBRARIES because CtsWifiConfigCreator was statically linked to it through its dependency on compatibility-device-util * hostsidetests/dumpsys/apps/ProcStatsHelperApp/Android.mk Added 'legacy-android-test' to LOCAL_STATIC_JAVA_LIBRARIES because CtsProcStatsHelperApp was statically linked to it through its dependency on compatibility-device-util * hostsidetests/media/app/MediaSessionTest/Android.mk Added 'legacy-android-test' to LOCAL_STATIC_JAVA_LIBRARIES because CtsMediaSessionHostTestApp was statically linked to it through its dependency on compatibility-device-util * hostsidetests/net/app/Android.mk Added 'android.test.runner.stubs' to LOCAL_JAVA_LIBRARIES because CtsHostsideNetworkTestsApp's source depends on its classes and because of these changes they are no longer present on the compilation path. 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 CtsHostsideNetworkTestsApp specifies in its manifest. * hostsidetests/os/test-apps/StaticSharedLibConsumerApp1/Android.mk Added 'legacy-android-test' to LOCAL_STATIC_JAVA_LIBRARIES because CtsStaticSharedLibConsumerApp1 was statically linked to it through its dependency on compatibility-device-util * hostsidetests/shortcuts/deviceside/backup/launcher1/Android.mk Added 'legacy-android-test' to LOCAL_STATIC_JAVA_LIBRARIES because CtsShortcutBackupLauncher1 was statically linked to it through its dependency on compatibility-device-util * hostsidetests/shortcuts/deviceside/backup/launcher2/Android.mk Added 'legacy-android-test' to LOCAL_STATIC_JAVA_LIBRARIES because CtsShortcutBackupLauncher2 was statically linked to it through its dependency on compatibility-device-util * hostsidetests/shortcuts/deviceside/backup/launcher3/Android.mk Added 'legacy-android-test' to LOCAL_STATIC_JAVA_LIBRARIES because CtsShortcutBackupLauncher3 was statically linked to it through its dependency on compatibility-device-util * hostsidetests/shortcuts/deviceside/backup/launcher4new/Android.mk Added 'legacy-android-test' to LOCAL_STATIC_JAVA_LIBRARIES because CtsShortcutBackupLauncher4new was statically linked to it through its dependency on compatibility-device-util * hostsidetests/shortcuts/deviceside/backup/launcher4old/Android.mk Added 'legacy-android-test' to LOCAL_STATIC_JAVA_LIBRARIES because CtsShortcutBackupLauncher4old was statically linked to it through its dependency on compatibility-device-util * hostsidetests/shortcuts/deviceside/backup/publisher1/Android.mk Added 'legacy-android-test' to LOCAL_STATIC_JAVA_LIBRARIES because CtsShortcutBackupPublisher1 was statically linked to it through its dependency on compatibility-device-util * hostsidetests/shortcuts/deviceside/backup/publisher2/Android.mk Added 'legacy-android-test' to LOCAL_STATIC_JAVA_LIBRARIES because CtsShortcutBackupPublisher2 was statically linked to it through its dependency on compatibility-device-util * hostsidetests/shortcuts/deviceside/backup/publisher3/Android.mk Added 'legacy-android-test' to LOCAL_STATIC_JAVA_LIBRARIES because CtsShortcutBackupPublisher3 was statically linked to it through its dependency on compatibility-device-util * hostsidetests/shortcuts/deviceside/backup/publisher4new/Android.mk Added 'legacy-android-test' to LOCAL_STATIC_JAVA_LIBRARIES because CtsShortcutBackupPublisher4new was statically linked to it through its dependency on compatibility-device-util * hostsidetests/shortcuts/deviceside/backup/publisher4new_nobackup/Android.mk Added 'legacy-android-test' to LOCAL_STATIC_JAVA_LIBRARIES because CtsShortcutBackupPublisher4new_nobackup was statically linked to it through its dependency on compatibility-device-util * hostsidetests/shortcuts/deviceside/backup/publisher4new_nomanifest/Android.mk Added 'legacy-android-test' to LOCAL_STATIC_JAVA_LIBRARIES because CtsShortcutBackupPublisher4new_nomanifest was statically linked to it through its dependency on compatibility-device-util * hostsidetests/shortcuts/deviceside/backup/publisher4new_wrongkey/Android.mk Added 'legacy-android-test' to LOCAL_STATIC_JAVA_LIBRARIES because CtsShortcutBackupPublisher4new_wrongkey was statically linked to it through its dependency on compatibility-device-util * hostsidetests/shortcuts/deviceside/backup/publisher4old/Android.mk Added 'legacy-android-test' to LOCAL_STATIC_JAVA_LIBRARIES because CtsShortcutBackupPublisher4old was statically linked to it through its dependency on compatibility-device-util * hostsidetests/shortcuts/deviceside/backup/publisher4old_nomanifest/Android.mk Added 'legacy-android-test' to LOCAL_STATIC_JAVA_LIBRARIES because CtsShortcutBackupPublisher4old_nomanifest was statically linked to it through its dependency on compatibility-device-util * hostsidetests/shortcuts/deviceside/multiuser/Android.mk Added 'legacy-android-test' to LOCAL_STATIC_JAVA_LIBRARIES because CtsShortcutMultiuserTest was statically linked to it through its dependency on compatibility-device-util * hostsidetests/shortcuts/deviceside/upgrade/Android.mk Added 'legacy-android-test' to LOCAL_STATIC_JAVA_LIBRARIES because CtsShortcutUpgradeVersion1 was statically linked to it through its dependency on compatibility-device-util Added 'legacy-android-test' to LOCAL_STATIC_JAVA_LIBRARIES because CtsShortcutUpgradeVersion2 was statically linked to it through its dependency on compatibility-device-util * hostsidetests/ui/appA/Android.mk Added 'legacy-android-test' to LOCAL_STATIC_JAVA_LIBRARIES because CtsDeviceTaskSwitchingAppA was statically linked to it through its dependency on compatibility-device-util * hostsidetests/ui/appB/Android.mk Added 'legacy-android-test' to LOCAL_STATIC_JAVA_LIBRARIES because CtsDeviceTaskSwitchingAppB was statically linked to it through its dependency on compatibility-device-util * hostsidetests/webkit/app/Android.mk Added 'android.test.runner.stubs' to LOCAL_JAVA_LIBRARIES because CtsWebViewStartupApp's source depends on its classes and because of these changes they are no longer present on the compilation path. 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 CtsWebViewStartupApp specifies in its manifest. * libs/deviceutillegacy/Android.mk Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES because ctsdeviceutillegacy is not a package so does not need to statically include the classes Added 'android.test.base' to LOCAL_JAVA_LIBRARIES because ctsdeviceutillegacy has a source dependency on its classes * tests/JobScheduler/Android.mk Added 'android.test.base' to LOCAL_JAVA_LIBRARIES because CtsJobSchedulerTestCases's source depends on its classes and because of these changes they are no longer present on the compilation path. 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 CtsJobSchedulerTestCases specifies in its manifest. * tests/JobScheduler/jobperm/Android.mk Added 'legacy-android-test' to LOCAL_STATIC_JAVA_LIBRARIES because CtsJobSchedulerJobPerm was statically linked to it through its dependency on compatibility-device-util * tests/JobScheduler/shareduid/Android.mk Added 'legacy-android-test' to LOCAL_STATIC_JAVA_LIBRARIES because CtsJobSchedulerSharedUid was statically linked to it through its dependency on compatibility-device-util * tests/admin/Android.mk Added 'android.test.runner.stubs' to LOCAL_JAVA_LIBRARIES because CtsAdminTestCases's source depends on its classes and because of these changes they are no longer present on the compilation path. 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 CtsAdminTestCases specifies in its manifest. * tests/app/app2/Android.mk Added 'legacy-android-test' to LOCAL_STATIC_JAVA_LIBRARIES because CtsAppTestStubsDifferentUid was statically linked to it through its dependency on compatibility-device-util * tests/backup/app/fullbackup/Android.mk Added 'legacy-android-test' to LOCAL_STATIC_JAVA_LIBRARIES because CtsFullBackupApp was statically linked to it through its dependency on compatibility-device-util * tests/backup/app/keyvalue/Android.mk Added 'legacy-android-test' to LOCAL_STATIC_JAVA_LIBRARIES because CtsKeyValueBackupApp was statically linked to it through its dependency on compatibility-device-util * tests/framework/base/windowmanager/alertwindowservice/Android.mk Added 'legacy-android-test' to LOCAL_STATIC_JAVA_LIBRARIES because CtsAlertWindowService was statically linked to it through its dependency on compatibility-device-util * tests/leanbackjank/app/Android.mk Added 'legacy-android-test' to LOCAL_STATIC_JAVA_LIBRARIES because CtsLeanbackJankApp was statically linked to it through its dependency on compatibility-device-util * tests/tests/alarmclock/Android.mk Added 'android.test.runner.stubs' to LOCAL_JAVA_LIBRARIES because CtsAlarmClockTestCases's source depends on its classes and because of these changes they are no longer present on the compilation path. 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 CtsAlarmClockTestCases specifies in its manifest. * tests/tests/assist/Android.mk Added 'android.test.runner.stubs' to LOCAL_JAVA_LIBRARIES because CtsAssistTestCases's source depends on its classes and because of these changes they are no longer present on the compilation path. 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 CtsAssistTestCases specifies in its manifest. * tests/tests/dpi/Android.mk Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES because android.cts.dpi is not a package so does not need to statically include the classes Added 'android.test.base' to LOCAL_JAVA_LIBRARIES because android.cts.dpi has a source dependency on its classes * tests/tests/dpi2/Android.mk Removed legacy-android-test from LOCAL_JAVA_LIBRARIES because it is unnecessary as CtsDpiTestCases2's source does not depend on classes from legacy-android-test. 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 CtsDpiTestCases2 specifies in its manifest. * tests/tests/externalservice/service/Android.mk Added 'legacy-android-test' to LOCAL_STATIC_JAVA_LIBRARIES because CtsExternalServiceService was statically linked to it through its dependency on compatibility-device-util * tests/tests/mediastress/Android.mk Added 'android.test.runner.stubs' to LOCAL_JAVA_LIBRARIES because CtsMediaStressTestCases's source depends on its classes and because of these changes they are no longer present on the compilation path. 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 CtsMediaStressTestCases specifies in its manifest. * tests/tests/openglperf/Android.mk Added 'android.test.runner.stubs' to LOCAL_JAVA_LIBRARIES because CtsOpenGlPerfTestCases's source depends on its classes and because of these changes they are no longer present on the compilation path. 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 CtsOpenGlPerfTestCases specifies in its manifest. * tests/tests/provider/Android.mk Replaced 'legacy-android-test' with 'android.test.base' and 'android.test.runner' in LOCAL_JAVA_LIBRARIES because CtsProviderTestCases's source depends on their 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 CtsProviderTestCases specifies in its manifest. * tests/tests/selinux/selinuxTargetSdk/Android.mk Removed legacy-android-test from LOCAL_JAVA_LIBRARIES because it is unnecessary as CtsSelinuxTargetSdkTestCases's source does not depend on classes from legacy-android-test. 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 CtsSelinuxTargetSdkTestCases specifies in its manifest. * tests/tests/shortcutmanager/packages/launchermanifest/Android.mk Added 'legacy-android-test' to LOCAL_STATIC_JAVA_LIBRARIES because CtsShortcutManagerLauncher1 was statically linked to it through its dependency on compatibility-device-util Added 'legacy-android-test' to LOCAL_STATIC_JAVA_LIBRARIES because CtsShortcutManagerLauncher2 was statically linked to it through its dependency on compatibility-device-util Added 'legacy-android-test' to LOCAL_STATIC_JAVA_LIBRARIES because CtsShortcutManagerLauncher3 was statically linked to it through its dependency on compatibility-device-util * tests/tests/shortcutmanager/packages/launchermanifest_nonshared/Android.mk Added 'legacy-android-test' to LOCAL_STATIC_JAVA_LIBRARIES because CtsShortcutManagerLauncher4 was statically linked to it through its dependency on compatibility-device-util * tests/tests/shortcutmanager/packages/packagemanifest/Android.mk Added 'legacy-android-test' to LOCAL_STATIC_JAVA_LIBRARIES because CtsShortcutManagerPackage1 was statically linked to it through its dependency on compatibility-device-util Added 'legacy-android-test' to LOCAL_STATIC_JAVA_LIBRARIES because CtsShortcutManagerPackage2 was statically linked to it through its dependency on compatibility-device-util Added 'legacy-android-test' to LOCAL_STATIC_JAVA_LIBRARIES because CtsShortcutManagerPackage3 was statically linked to it through its dependency on compatibility-device-util * tests/tests/shortcutmanager/packages/packagemanifest_nonshared/Android.mk Added 'legacy-android-test' to LOCAL_STATIC_JAVA_LIBRARIES because CtsShortcutManagerPackage4 was statically linked to it through its dependency on compatibility-device-util * tests/tests/shortcutmanager/throttling/Android.mk Added 'legacy-android-test' to LOCAL_STATIC_JAVA_LIBRARIES because CtsShortcutManagerThrottlingTest was statically linked to it through its dependency on compatibility-device-util * tests/tests/voiceinteraction/Android.mk Added 'android.test.runner.stubs' to LOCAL_JAVA_LIBRARIES because CtsVoiceInteractionTestCases's source depends on its classes and because of these changes they are no longer present on the compilation path. 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 CtsVoiceInteractionTestCases specifies in its manifest. * tests/tests/webkit/Android.mk Added 'android.test.base' to LOCAL_JAVA_LIBRARIES because CtsWebkitTestCases's source depends on its classes and because of these changes they are no longer present on the compilation path. 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 CtsWebkitTestCases specifies in its manifest. * tests/ui/Android.mk Added 'android.test.runner.stubs' to LOCAL_JAVA_LIBRARIES because CtsUiDeviceTestCases's source depends on its classes and because of these changes they are no longer present on the compilation path. 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 CtsUiDeviceTestCases specifies in its manifest. * tools/cts-reference-app-lib/Android.mk Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES because android.cts.refapp is not a package so does not need to statically include the classes Added 'android.test.runner.stubs' to LOCAL_JAVA_LIBRARIES because android.cts.refapp has a source dependency on its classes Bug: 30188076 Test: make checkbuild Change-Id: Ief6940eacf333043e2324462d37d1fd35db15165 --- tests/cts/hostside/app/Android.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/cts/hostside/app/Android.mk b/tests/cts/hostside/app/Android.mk index f094f3f4a1..66adea7a3b 100644 --- a/tests/cts/hostside/app/Android.mk +++ b/tests/cts/hostside/app/Android.mk @@ -23,6 +23,8 @@ LOCAL_SDK_VERSION := current LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util ctstestrunner ub-uiautomator \ CtsHostsideNetworkTestsAidl +LOCAL_JAVA_LIBRARIES := android.test.runner.stubs + LOCAL_SRC_FILES := $(call all-java-files-under, src) LOCAL_PACKAGE_NAME := CtsHostsideNetworkTestsApp