aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2020-04-23 01:04:50 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2020-04-23 01:04:50 +0000
commit1bd2d95fb8abf609b073e0b35b80b5923dac2b57 (patch)
treec732933a09971575311105d3f262c7f3da5d4484
parent0ddd107af46b0485236bd807c667789118792d3a (diff)
parenta221d0544b0e7124a1c7790aeeb06790b3f3bd38 (diff)
downloadplatform_tools_metalava-1bd2d95fb8abf609b073e0b35b80b5923dac2b57.tar.gz
platform_tools_metalava-1bd2d95fb8abf609b073e0b35b80b5923dac2b57.tar.bz2
platform_tools_metalava-1bd2d95fb8abf609b073e0b35b80b5923dac2b57.zip
Snap for 6420265 from a221d0544b0e7124a1c7790aeeb06790b3f3bd38 to rvc-release
Change-Id: Iaa71819f112a5f6ba3c6f21fdd1d47ef18fc3977
-rw-r--r--src/main/java/com/android/tools/metalava/ApiLint.kt5
-rw-r--r--src/test/java/com/android/tools/metalava/DriverTest.kt9
2 files changed, 10 insertions, 4 deletions
diff --git a/src/main/java/com/android/tools/metalava/ApiLint.kt b/src/main/java/com/android/tools/metalava/ApiLint.kt
index b0da03c5..60158dec 100644
--- a/src/main/java/com/android/tools/metalava/ApiLint.kt
+++ b/src/main/java/com/android/tools/metalava/ApiLint.kt
@@ -211,7 +211,10 @@ class ApiLint(private val codebase: Codebase, private val oldCodebase: Codebase?
options.stdout.println("""
************************************************************
Your API changes are triggering API Lint warnings or errors.
- To make these errors go away, you have two choices:
+ To make these errors go away, fix the code according to the
+ error and/or warning messages above.
+
+ If it's not possible to do so, there are two workarounds:
1. You can suppress the errors with @SuppressLint("<id>")
2. You can update the baseline by executing the following
diff --git a/src/test/java/com/android/tools/metalava/DriverTest.kt b/src/test/java/com/android/tools/metalava/DriverTest.kt
index 874063e0..97153155 100644
--- a/src/test/java/com/android/tools/metalava/DriverTest.kt
+++ b/src/test/java/com/android/tools/metalava/DriverTest.kt
@@ -115,7 +115,9 @@ abstract class DriverTest {
Disposer.setDebugMode(true)
- if (!run(arrayOf(*args), writer, writer)) {
+ if (run(arrayOf(*args), writer, writer)) {
+ assertTrue("Test expected to fail but didn't. Expected failure: $expectedFail", expectedFail.isEmpty())
+ } else {
val actualFail = cleanupString(sw.toString(), null)
if (cleanupString(expectedFail, null).replace(".", "").trim() !=
actualFail.replace(".", "").trim()
@@ -420,10 +422,11 @@ abstract class DriverTest {
Issues.resetLevels()
@Suppress("NAME_SHADOWING")
- val expectedFail = expectedFail ?: if (checkCompatibilityApi != null ||
+ val expectedFail = expectedFail ?: if ((checkCompatibilityApi != null ||
checkCompatibilityApiReleased != null ||
checkCompatibilityRemovedApiCurrent != null ||
- checkCompatibilityRemovedApiReleased != null
+ checkCompatibilityRemovedApiReleased != null) &&
+ (warnings != null && !warnings.trim().isEmpty())
) {
"Aborting: Found compatibility problems with --check-compatibility"
} else {