From bfaa58925ca56a73853401b88452cf3b40f0b081 Mon Sep 17 00:00:00 2001 From: Mark Renouf Date: Fri, 18 Aug 2023 23:13:47 -0400 Subject: Adds AConfig flag infrastructure to IntentResolver Build: Inlcudes Some general build hygeine and simplification Creates an aconfig flag declaration and java library Add java_defaults rules for library and app for common settings Tests: Added direct dep on JUnit (was indirectly pulled in) Remove source dependency (on main code) from the test app target Remove optimization and dexopt from the debug app target Test: All existing tests pass; atest IntentResolverUnitTests Test: Setup using ASfP (Android studio for platform) Bug: 296633726 Change-Id: I8046f76aa20957342ddddabc8861c0a8fe25e0fb --- java/tests/Android.bp | 36 +++++++++++++++++++++++++----------- java/tests/AndroidManifest.xml | 3 +-- java/tests/README.md | 7 +++++++ 3 files changed, 33 insertions(+), 13 deletions(-) create mode 100644 java/tests/README.md (limited to 'java') diff --git a/java/tests/Android.bp b/java/tests/Android.bp index 29ecd95d..e4d24eb5 100644 --- a/java/tests/Android.bp +++ b/java/tests/Android.bp @@ -1,11 +1,26 @@ +// +// Copyright (C) 2023 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. +// + package { - // See: http://go/android-license-faq - default_applicable_licenses: ["packages_modules_IntentResolver_license"], + default_applicable_licenses: ["Android-Apache-2.0"], } android_test { name: "IntentResolverUnitTests", - + manifest: "AndroidManifest.xml", // Include all test java files. srcs: ["src/**/*.java", "src/**/*.kt"], @@ -17,10 +32,10 @@ android_test { "framework-res", ], + resource_dirs: ["res"], + test_config: "AndroidTest.xml", static_libs: [ - "IntentResolver-core", "androidx.test.core", - "androidx.test.rules", "androidx.test.ext.junit", "androidx.test.ext.truth", "androidx.test.espresso.contrib", @@ -28,19 +43,18 @@ android_test { "androidx.test.rules", "androidx.lifecycle_lifecycle-common-java8", "androidx.lifecycle_lifecycle-extensions", - "androidx.lifecycle_lifecycle-runtime-ktx", "androidx.lifecycle_lifecycle-runtime-testing", + "IntentResolver-core", + "junit", "kotlinx_coroutines_test", "mockito-target-minus-junit4", "testables", "truth-prebuilt", ], - min_sdk_version: "current", - target_sdk_version: "current", plugins: ["dagger2-compiler"], test_suites: ["general-tests"], sdk_version: "core_platform", - compile_multilib: "both", - - dont_merge_manifests: true, + min_sdk_version: "current", + target_sdk_version: "current", + platform_apis: true, } diff --git a/java/tests/AndroidManifest.xml b/java/tests/AndroidManifest.xml index 4517a60c..ae6a2205 100644 --- a/java/tests/AndroidManifest.xml +++ b/java/tests/AndroidManifest.xml @@ -34,8 +34,7 @@ + android:targetPackage="com.android.intentresolver.tests"> diff --git a/java/tests/README.md b/java/tests/README.md new file mode 100644 index 00000000..b42e8d27 --- /dev/null +++ b/java/tests/README.md @@ -0,0 +1,7 @@ + +__ABOUT__ + +This is package is configured as a self-instrumenting test APK. The IntentResolver application code +is bundled in and the instrumentation APK targets itself. This is used for in-process mocking and +verification involving live components that many tests rely on. + -- cgit v1.2.3-59-g8ed1b