Ignore VisibleForTests in all test libraries
In test libraries, the lint warning that you shouldn't use code
annotated with @VisibleForTests is a false positive. While the code is
technically production code, it should only be run as test code.
This CL introduces two new library types: PUBLISHED_TEST_LIBRARY and
INTERNAL_TEST_LIBRARY. The first one has the same properties as
PUBLISHED_LIBRARY and the latter one has the same properties as UNSET.
The difference is that for these test library types, the
"VisibleForTests" lint warning is disabled instead of fatal.
I didn't change the libary type of the following libraries, mostly
because they did not have a type (so UNSET), but did have publish set to
SNAPSHOT_AND_RELEASE (with some exceptions, e.g. LINT libraries).
Setting these libraries to INTERNAL_TEST_LIBRARY would be incorrect
(they are not internal), but setting them to PUBLISHED_TEST_LIBRARY
**may** affect how they are published.
* arch/core/core-testing
* camera/camera-camera2-pipe-testing
* compose/lint/common-test
* core/core-animation-testing
* enterprise/enterprise-feedback-testing
* fragment/fragment-testing
* fragment/fragment-testing-lint
* lifecycle/lifecycle-runtime-testing
* mediarouter/mediarouter-testing
* navigation/navigation-testing
* room/room-compiler-processing-testing
* room/room-testing
* wear/wear-input-testing
* wear/tiles/tiles-testing
* work/work-testing
Fix: 207828221
Test: ./gradlew bOS
Change-Id: I3d7a1cb601bb95ebbad319b1dc739e827a8ece8f
diff --git a/ads/ads-identifier-testing/build.gradle b/ads/ads-identifier-testing/build.gradle
index e4458f8..e7d05c0 100644
--- a/ads/ads-identifier-testing/build.gradle
+++ b/ads/ads-identifier-testing/build.gradle
@@ -13,6 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
+import androidx.build.LibraryType
+
plugins {
id("AndroidXPlugin")
id("com.android.library")
@@ -29,3 +32,7 @@
disable "InvalidPackage" // Lint is unhappy about mockito package
}
}
+
+androidx {
+ type = LibraryType.INTERNAL_TEST_LIBRARY
+}
\ No newline at end of file
diff --git a/appsearch/appsearch-test-util/build.gradle b/appsearch/appsearch-test-util/build.gradle
index c6fdcaa..107b4b0 100644
--- a/appsearch/appsearch-test-util/build.gradle
+++ b/appsearch/appsearch-test-util/build.gradle
@@ -14,6 +14,7 @@
* limitations under the License.
*/
import androidx.build.LibraryGroups
+import androidx.build.LibraryType
import androidx.build.LibraryVersions
import androidx.build.Publish
@@ -37,6 +38,7 @@
androidx {
name = 'AppSearch Test Util'
+ type = LibraryType.INTERNAL_TEST_LIBRARY
publish = Publish.NONE
mavenGroup = LibraryGroups.APPSEARCH
inceptionYear = '2021'
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/LintConfiguration.kt b/buildSrc/private/src/main/kotlin/androidx/build/LintConfiguration.kt
index 05effe5..53d7c42 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/LintConfiguration.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/LintConfiguration.kt
@@ -233,7 +233,15 @@
// We run lint on each library, so we don't want transitive checking of each dependency
checkDependencies = false
- fatal.add("VisibleForTests")
+ if (
+ extension.type == LibraryType.PUBLISHED_TEST_LIBRARY ||
+ extension.type == LibraryType.INTERNAL_TEST_LIBRARY
+ ) {
+ // Test libraries are allowed to call @VisibleForTests code
+ disable.add("VisibleForTests")
+ } else {
+ fatal.add("VisibleForTests")
+ }
// Disable dependency checks that suggest to change them. We want libraries to be
// intentional with their dependency version bumps.
diff --git a/buildSrc/public/src/main/kotlin/androidx/build/LibraryType.kt b/buildSrc/public/src/main/kotlin/androidx/build/LibraryType.kt
index 276651e..5579270 100644
--- a/buildSrc/public/src/main/kotlin/androidx/build/LibraryType.kt
+++ b/buildSrc/public/src/main/kotlin/androidx/build/LibraryType.kt
@@ -66,6 +66,14 @@
sourceJars = true,
checkApi = RunApiTasks.Yes()
),
+ PUBLISHED_TEST_LIBRARY(
+ publish = Publish.SNAPSHOT_AND_RELEASE,
+ sourceJars = true,
+ checkApi = RunApiTasks.Yes()
+ ),
+ INTERNAL_TEST_LIBRARY(
+ checkApi = RunApiTasks.No("Internal Library")
+ ),
SAMPLES(
publish = Publish.SNAPSHOT_AND_RELEASE,
sourceJars = true,
diff --git a/camera/camera-testing/build.gradle b/camera/camera-testing/build.gradle
index d6c1368..4e709b5 100644
--- a/camera/camera-testing/build.gradle
+++ b/camera/camera-testing/build.gradle
@@ -16,6 +16,7 @@
import androidx.build.LibraryGroups
+import androidx.build.LibraryType
import androidx.build.Publish
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
@@ -79,6 +80,7 @@
androidx {
name = "Jetpack Camera Testing Library"
+ type = LibraryType.INTERNAL_TEST_LIBRARY
publish = Publish.NONE
mavenGroup = LibraryGroups.CAMERA
inceptionYear = "2019"
diff --git a/car/app/app-testing/build.gradle b/car/app/app-testing/build.gradle
index 9ab6dbb..ec190c2 100644
--- a/car/app/app-testing/build.gradle
+++ b/car/app/app-testing/build.gradle
@@ -54,7 +54,7 @@
androidx {
name = "androidx.car.app:app-testing"
- type = LibraryType.PUBLISHED_LIBRARY
+ type = LibraryType.PUBLISHED_TEST_LIBRARY
mavenGroup = LibraryGroups.CAR_APP
inceptionYear = "2021"
description = "androidx.car.app:app-testing"
diff --git a/compose/test-utils/build.gradle b/compose/test-utils/build.gradle
index bf81a8d..e792129 100644
--- a/compose/test-utils/build.gradle
+++ b/compose/test-utils/build.gradle
@@ -15,6 +15,7 @@
*/
import androidx.build.AndroidXComposePlugin
+import androidx.build.LibraryType
import androidx.build.Publish
plugins {
@@ -99,6 +100,7 @@
androidx {
name = "Compose Internal Test Utils"
+ type = LibraryType.INTERNAL_TEST_LIBRARY
publish = Publish.NONE
inceptionYear = "2020"
description = "Compose internal test utils."
diff --git a/compose/test-utils/lint-baseline.xml b/compose/test-utils/lint-baseline.xml
deleted file mode 100644
index a49e666..0000000
--- a/compose/test-utils/lint-baseline.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<issues format="6" by="lint 7.1.0-beta02" type="baseline" client="gradle" dependencies="false" name="AGP (7.1.0-beta02)" variant="all" version="7.1.0-beta02">
-
- <issue
- id="VisibleForTests"
- message="This method should only be accessed from tests or within private scope"
- errorLine1=" view = findViewRootForTest(activity)!!.view"
- errorLine2=" ~~~~">
- <location
- file="src/androidMain/kotlin/androidx/compose/testutils/AndroidComposeTestCaseRunner.android.kt"
- line="126"
- column="48"/>
- </issue>
-
-</issues>
diff --git a/compose/ui/ui-test-font/build.gradle b/compose/ui/ui-test-font/build.gradle
index e8c0acd..d4d503e 100644
--- a/compose/ui/ui-test-font/build.gradle
+++ b/compose/ui/ui-test-font/build.gradle
@@ -16,6 +16,7 @@
import androidx.build.AndroidXComposePlugin
import androidx.build.LibraryGroups
+import androidx.build.LibraryType
import androidx.build.Publish
import androidx.build.RunApiTasks
@@ -49,6 +50,7 @@
androidx {
name = "Compose Test Font resources"
+ type = LibraryType.INTERNAL_TEST_LIBRARY
publish = Publish.NONE
mavenGroup = LibraryGroups.Compose.UI
inceptionYear = "2020"
diff --git a/compose/ui/ui-test-junit4/build.gradle b/compose/ui/ui-test-junit4/build.gradle
index 21e551d..752cb1e 100644
--- a/compose/ui/ui-test-junit4/build.gradle
+++ b/compose/ui/ui-test-junit4/build.gradle
@@ -141,7 +141,7 @@
androidx {
name = "Compose Testing for JUnit4"
- type = LibraryType.PUBLISHED_LIBRARY
+ type = LibraryType.PUBLISHED_TEST_LIBRARY
mavenGroup = LibraryGroups.Compose.UI
inceptionYear = "2020"
description = "Compose testing integration with JUnit4"
diff --git a/compose/ui/ui-test-junit4/lint-baseline.xml b/compose/ui/ui-test-junit4/lint-baseline.xml
deleted file mode 100644
index cd86c96..0000000
--- a/compose/ui/ui-test-junit4/lint-baseline.xml
+++ /dev/null
@@ -1,103 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<issues format="6" by="lint 7.1.0-beta02" type="baseline" client="gradle" dependencies="false" name="AGP (7.1.0-beta02)" variant="all" version="7.1.0-beta02">
-
- <issue
- id="VisibleForTests"
- message="This method should only be accessed from tests or within private scope"
- errorLine1=" hadPendingMeasureLayout = composeRoots.any { it.hasPendingMeasureOrLayout }"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/androidMain/kotlin/androidx/compose/ui/test/junit4/ComposeIdlingResource.android.kt"
- line="67"
- column="61"/>
- </issue>
-
- <issue
- id="VisibleForTests"
- message="This method should only be accessed from tests or within private scope"
- errorLine1=" return view.rootView.parent != null && !view.isAttachedToWindow"
- errorLine2=" ~~~~">
- <location
- file="src/androidMain/kotlin/androidx/compose/ui/test/junit4/ComposeIdlingResource.android.kt"
- line="111"
- column="16"/>
- </issue>
-
- <issue
- id="VisibleForTests"
- message="This method should only be accessed from tests or within private scope"
- errorLine1=" return view.rootView.parent != null && !view.isAttachedToWindow"
- errorLine2=" ~~~~">
- <location
- file="src/androidMain/kotlin/androidx/compose/ui/test/junit4/ComposeIdlingResource.android.kt"
- line="111"
- column="49"/>
- </issue>
-
- <issue
- id="VisibleForTests"
- message="This method should only be accessed from tests or within private scope"
- errorLine1=" get() = ViewRootForTest.onViewCreatedCallback == ::onViewRootCreated"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/androidMain/kotlin/androidx/compose/ui/test/junit4/ComposeRootRegistry.android.kt"
- line="53"
- column="33"/>
- </issue>
-
- <issue
- id="VisibleForTests"
- message="This method should only be accessed from tests or within private scope"
- errorLine1=" ViewRootForTest.onViewCreatedCallback = ::onViewRootCreated"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/androidMain/kotlin/androidx/compose/ui/test/junit4/ComposeRootRegistry.android.kt"
- line="59"
- column="25"/>
- </issue>
-
- <issue
- id="VisibleForTests"
- message="This method should only be accessed from tests or within private scope"
- errorLine1=" root.view.addOnAttachStateChangeListener(StateChangeHandler(root))"
- errorLine2=" ~~~~">
- <location
- file="src/androidMain/kotlin/androidx/compose/ui/test/junit4/ComposeRootRegistry.android.kt"
- line="87"
- column="22"/>
- </issue>
-
- <issue
- id="VisibleForTests"
- message="This method should only be accessed from tests or within private scope"
- errorLine1=" if (composeRoot == this.composeRoot && !registered) {"
- errorLine2=" ~~">
- <location
- file="src/androidMain/kotlin/androidx/compose/ui/test/junit4/ComposeRootRegistry.android.kt"
- line="222"
- column="29"/>
- </issue>
-
- <issue
- id="VisibleForTests"
- message="This method should only be accessed from tests or within private scope"
- errorLine1=" return composeRoots.filter { it.hasPendingMeasureOrLayout }"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/androidMain/kotlin/androidx/compose/ui/test/junit4/RobolectricIdlingStrategy.android.kt"
- line="91"
- column="41"/>
- </issue>
-
- <issue
- id="VisibleForTests"
- message="This method should only be accessed from tests or within private scope"
- errorLine1=" .onEach { it.view.requestLayout() }"
- errorLine2=" ~~~~">
- <location
- file="src/androidMain/kotlin/androidx/compose/ui/test/junit4/RobolectricIdlingStrategy.android.kt"
- line="92"
- column="26"/>
- </issue>
-
-</issues>
diff --git a/compose/ui/ui-test-manifest/build.gradle b/compose/ui/ui-test-manifest/build.gradle
index ce28047..d162a53 100644
--- a/compose/ui/ui-test-manifest/build.gradle
+++ b/compose/ui/ui-test-manifest/build.gradle
@@ -29,7 +29,7 @@
androidx {
name = "Compose Testing manifest dependency"
- type = LibraryType.PUBLISHED_LIBRARY
+ type = LibraryType.PUBLISHED_TEST_LIBRARY
mavenGroup = LibraryGroups.Compose.UI
inceptionYear = "2021"
description = "Compose testing library that should be added as a debugImplementation dependency to add properties to the debug manifest necessary for testing an application"
diff --git a/compose/ui/ui-test/build.gradle b/compose/ui/ui-test/build.gradle
index 0e9a2ba..1a5db16 100644
--- a/compose/ui/ui-test/build.gradle
+++ b/compose/ui/ui-test/build.gradle
@@ -143,7 +143,7 @@
androidx {
name = "Compose Testing"
- type = LibraryType.PUBLISHED_LIBRARY
+ type = LibraryType.PUBLISHED_TEST_LIBRARY
mavenGroup = LibraryGroups.Compose.UI
inceptionYear = "2019"
description = "Compose testing library"
diff --git a/compose/ui/ui-test/lint-baseline.xml b/compose/ui/ui-test/lint-baseline.xml
deleted file mode 100644
index 071d07e..0000000
--- a/compose/ui/ui-test/lint-baseline.xml
+++ /dev/null
@@ -1,70 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<issues format="6" by="lint 7.1.0-beta03" type="baseline" client="gradle" dependencies="false" name="AGP (7.1.0-beta03)" variant="all" version="7.1.0-beta03">
-
- <issue
- id="VisibleForTests"
- message="This method should only be accessed from tests or within private scope"
- errorLine1=" if (!ViewMatchers.isDisplayed().matches(it.view)) {"
- errorLine2=" ~~~~">
- <location
- file="src/androidMain/kotlin/androidx/compose/ui/test/AndroidAssertions.android.kt"
- line="41"
- column="52"/>
- </issue>
-
- <issue
- id="VisibleForTests"
- message="This method should only be accessed from tests or within private scope"
- errorLine1=" val composeView = (root as ViewRootForTest).view"
- errorLine2=" ~~~~">
- <location
- file="src/androidMain/kotlin/androidx/compose/ui/test/AndroidAssertions.android.kt"
- line="56"
- column="49"/>
- </issue>
-
- <issue
- id="VisibleForTests"
- message="This method should only be accessed from tests or within private scope"
- errorLine1=" val composeView = (root as ViewRootForTest).view"
- errorLine2=" ~~~~">
- <location
- file="src/androidMain/kotlin/androidx/compose/ui/test/AndroidAssertions.android.kt"
- line="65"
- column="49"/>
- </issue>
-
- <issue
- id="VisibleForTests"
- message="This method should only be accessed from tests or within private scope"
- errorLine1=" val view = root.view"
- errorLine2=" ~~~~">
- <location
- file="src/androidMain/kotlin/androidx/compose/ui/test/AndroidInputDispatcher.android.kt"
- line="48"
- column="21"/>
- </issue>
-
- <issue
- id="VisibleForTests"
- message="This method should only be accessed from tests or within private scope"
- errorLine1=" root.view.getLocationOnScreen(array)"
- errorLine2=" ~~~~">
- <location
- file="src/androidMain/kotlin/androidx/compose/ui/test/AndroidInputDispatcher.android.kt"
- line="221"
- column="22"/>
- </issue>
-
- <issue
- id="VisibleForTests"
- message="This method should only be accessed from tests or within private scope"
- errorLine1=" root.view.getLocationOnScreen(array)"
- errorLine2=" ~~~~">
- <location
- file="src/androidMain/kotlin/androidx/compose/ui/test/AndroidInputDispatcher.android.kt"
- line="306"
- column="22"/>
- </issue>
-
-</issues>
diff --git a/compose/ui/ui-test/src/androidMain/kotlin/androidx/compose/ui/test/AndroidImageHelpers.android.kt b/compose/ui/ui-test/src/androidMain/kotlin/androidx/compose/ui/test/AndroidImageHelpers.android.kt
index 9b39bd5..70047e6 100644
--- a/compose/ui/ui-test/src/androidMain/kotlin/androidx/compose/ui/test/AndroidImageHelpers.android.kt
+++ b/compose/ui/ui-test/src/androidMain/kotlin/androidx/compose/ui/test/AndroidImageHelpers.android.kt
@@ -16,7 +16,6 @@
package androidx.compose.ui.test
-import android.annotation.SuppressLint
import android.app.Activity
import android.content.Context
import android.content.ContextWrapper
@@ -56,7 +55,6 @@
)
}
- @SuppressLint("VisibleForTests")
val view = (node.root as ViewRootForTest).view
// If we are in dialog use its window to capture the bitmap
diff --git a/inspection/inspection-testing/build.gradle b/inspection/inspection-testing/build.gradle
index b93b52d..d57636b 100644
--- a/inspection/inspection-testing/build.gradle
+++ b/inspection/inspection-testing/build.gradle
@@ -15,6 +15,7 @@
*/
import androidx.build.LibraryGroups
+import androidx.build.LibraryType
import androidx.build.Publish
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
@@ -38,6 +39,7 @@
androidx {
name = "AndroidX Inspection Testing"
+ type = LibraryType.INTERNAL_TEST_LIBRARY
publish = Publish.NONE
mavenGroup = LibraryGroups.INSPECTION
inceptionYear = "2019"
diff --git a/security/security-app-authenticator-testing/build.gradle b/security/security-app-authenticator-testing/build.gradle
index 4bee868..7d1d4da 100644
--- a/security/security-app-authenticator-testing/build.gradle
+++ b/security/security-app-authenticator-testing/build.gradle
@@ -40,7 +40,7 @@
androidx {
name = "Android Security App Package Authenticator Testing"
- type = LibraryType.PUBLISHED_LIBRARY
+ type = LibraryType.PUBLISHED_TEST_LIBRARY
mavenVersion = LibraryVersions.SECURITY_APP_AUTHENTICATOR_TESTING
mavenGroup = LibraryGroups.SECURITY
inceptionYear = "2021"
diff --git a/security/security-app-authenticator-testing/src/main/java/androidx/security/app/authenticator/TestAppAuthenticatorBuilder.java b/security/security-app-authenticator-testing/src/main/java/androidx/security/app/authenticator/TestAppAuthenticatorBuilder.java
index 8460b83..372a166 100644
--- a/security/security-app-authenticator-testing/src/main/java/androidx/security/app/authenticator/TestAppAuthenticatorBuilder.java
+++ b/security/security-app-authenticator-testing/src/main/java/androidx/security/app/authenticator/TestAppAuthenticatorBuilder.java
@@ -312,7 +312,7 @@
*/
// This class is provided so that apps can inject a configurable AppAuthenticator for their
// tests, so it needs access to the restricted test APIs.
- @SuppressLint({"RestrictedApi", "VisibleForTests"})
+ @SuppressLint("RestrictedApi")
@NonNull
public AppAuthenticator build() throws AppAuthenticatorXmlException, IOException {
// Obtain the config from the AppAuthenticator class to ensure that the provided XML is
diff --git a/slice/slice-test/build.gradle b/slice/slice-test/build.gradle
index 901074e..582583a 100644
--- a/slice/slice-test/build.gradle
+++ b/slice/slice-test/build.gradle
@@ -16,6 +16,7 @@
import androidx.build.LibraryVersions
import androidx.build.LibraryGroups
+import androidx.build.LibraryType
import androidx.build.Publish
plugins {
@@ -40,6 +41,7 @@
androidx {
name = "Slice test code"
+ type = LibraryType.INTERNAL_TEST_LIBRARY
publish = Publish.NONE
mavenVersion = LibraryVersions.SLICE
mavenGroup = LibraryGroups.SLICE
diff --git a/test/screenshot/screenshot/build.gradle b/test/screenshot/screenshot/build.gradle
index 08a239a..3d10daa 100644
--- a/test/screenshot/screenshot/build.gradle
+++ b/test/screenshot/screenshot/build.gradle
@@ -15,6 +15,7 @@
*/
import androidx.build.LibraryGroups
+import androidx.build.LibraryType
plugins {
id("AndroidXPlugin")
@@ -40,5 +41,6 @@
androidx {
name = "AndroidX Library Screenshot Test"
+ type = LibraryType.INTERNAL_TEST_LIBRARY
mavenGroup = LibraryGroups.TESTSCREENSHOT
}
diff --git a/testutils/testutils-appcompat/build.gradle b/testutils/testutils-appcompat/build.gradle
index ee9a25e..832c172 100644
--- a/testutils/testutils-appcompat/build.gradle
+++ b/testutils/testutils-appcompat/build.gradle
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+import androidx.build.LibraryType
+
plugins {
id("AndroidXPlugin")
id("com.android.library")
@@ -36,3 +38,7 @@
disable "InvalidPackage" // Lint is unhappy about junit package
}
}
+
+androidx {
+ type = LibraryType.INTERNAL_TEST_LIBRARY
+}
diff --git a/testutils/testutils-common/build.gradle b/testutils/testutils-common/build.gradle
index dccc2a9..19480c5 100644
--- a/testutils/testutils-common/build.gradle
+++ b/testutils/testutils-common/build.gradle
@@ -16,6 +16,8 @@
* limitations under the License.
*/
+import androidx.build.LibraryType
+
plugins {
id("AndroidXPlugin")
id("kotlin")
@@ -32,3 +34,7 @@
freeCompilerArgs += ["-Xopt-in=kotlin.RequiresOptIn"]
}
}
+
+androidx {
+ type = LibraryType.INTERNAL_TEST_LIBRARY
+}
diff --git a/testutils/testutils-espresso/build.gradle b/testutils/testutils-espresso/build.gradle
index 8ac3572..db5fcf70 100644
--- a/testutils/testutils-espresso/build.gradle
+++ b/testutils/testutils-espresso/build.gradle
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+import androidx.build.LibraryType
+
plugins {
id("AndroidXPlugin")
id("com.android.library")
@@ -33,3 +35,7 @@
disable "InvalidPackage" // Lint is unhappy about junit package
}
}
+
+androidx {
+ type = LibraryType.INTERNAL_TEST_LIBRARY
+}
diff --git a/testutils/testutils-gradle-plugin/build.gradle b/testutils/testutils-gradle-plugin/build.gradle
index 127a4bf..e8d7ab2 100644
--- a/testutils/testutils-gradle-plugin/build.gradle
+++ b/testutils/testutils-gradle-plugin/build.gradle
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+import androidx.build.LibraryType
+
plugins {
id("AndroidXPlugin")
id("kotlin")
@@ -25,3 +27,7 @@
implementation(libs.testCore)
implementation(libs.testRules)
}
+
+androidx {
+ type = LibraryType.INTERNAL_TEST_LIBRARY
+}
diff --git a/testutils/testutils-ktx/build.gradle b/testutils/testutils-ktx/build.gradle
index eda09a6..1998abd 100644
--- a/testutils/testutils-ktx/build.gradle
+++ b/testutils/testutils-ktx/build.gradle
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+import androidx.build.LibraryType
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
@@ -34,3 +35,7 @@
freeCompilerArgs += ["-Xopt-in=kotlin.RequiresOptIn"]
}
}
+
+androidx {
+ type = LibraryType.INTERNAL_TEST_LIBRARY
+}
diff --git a/testutils/testutils-macrobenchmark/build.gradle b/testutils/testutils-macrobenchmark/build.gradle
index f698e9a..a239cb8 100644
--- a/testutils/testutils-macrobenchmark/build.gradle
+++ b/testutils/testutils-macrobenchmark/build.gradle
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+import androidx.build.LibraryType
+
plugins {
id("AndroidXPlugin")
id("com.android.library")
@@ -32,3 +34,7 @@
minSdkVersion 23
}
}
+
+androidx {
+ type = LibraryType.INTERNAL_TEST_LIBRARY
+}
diff --git a/testutils/testutils-mockito/build.gradle b/testutils/testutils-mockito/build.gradle
index 40d784c..36831bb 100644
--- a/testutils/testutils-mockito/build.gradle
+++ b/testutils/testutils-mockito/build.gradle
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+import androidx.build.LibraryType
+
plugins {
id("AndroidXPlugin")
id("com.android.library")
@@ -30,4 +32,8 @@
lintOptions {
disable "InvalidPackage" // Lint is unhappy about java.lang.instrument package
}
-}
\ No newline at end of file
+}
+
+androidx {
+ type = LibraryType.INTERNAL_TEST_LIBRARY
+}
diff --git a/testutils/testutils-navigation/build.gradle b/testutils/testutils-navigation/build.gradle
index 4123407..78d5517 100644
--- a/testutils/testutils-navigation/build.gradle
+++ b/testutils/testutils-navigation/build.gradle
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+import androidx.build.LibraryType
+
plugins {
id("AndroidXPlugin")
id("com.android.library")
@@ -35,3 +37,7 @@
androidTestImplementation(libs.espressoCore)
androidTestImplementation(libs.truth)
}
+
+androidx {
+ type = LibraryType.INTERNAL_TEST_LIBRARY
+}
diff --git a/testutils/testutils-paging/build.gradle b/testutils/testutils-paging/build.gradle
index 7287ed7..3be7e842 100644
--- a/testutils/testutils-paging/build.gradle
+++ b/testutils/testutils-paging/build.gradle
@@ -15,6 +15,7 @@
*/
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
+import androidx.build.LibraryType
plugins {
id("AndroidXPlugin")
@@ -34,3 +35,7 @@
freeCompilerArgs += ["-Xopt-in=kotlin.RequiresOptIn"]
}
}
+
+androidx {
+ type = LibraryType.INTERNAL_TEST_LIBRARY
+}
diff --git a/testutils/testutils-runtime/build.gradle b/testutils/testutils-runtime/build.gradle
index 795f410..310a3ab 100644
--- a/testutils/testutils-runtime/build.gradle
+++ b/testutils/testutils-runtime/build.gradle
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+import androidx.build.LibraryType
+
plugins {
id("AndroidXPlugin")
id("com.android.library")
@@ -37,3 +39,7 @@
testInstrumentationRunner "androidx.testutils.ActivityRecyclingAndroidJUnitRunner"
}
}
+
+androidx {
+ type = LibraryType.INTERNAL_TEST_LIBRARY
+}
diff --git a/testutils/testutils-truth/build.gradle b/testutils/testutils-truth/build.gradle
index 2c984ec..1e46a9e 100644
--- a/testutils/testutils-truth/build.gradle
+++ b/testutils/testutils-truth/build.gradle
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+import androidx.build.LibraryType
+
plugins {
id("AndroidXPlugin")
id("kotlin")
@@ -23,3 +25,7 @@
api(libs.truth)
api(libs.kotlinStdlib)
}
+
+androidx {
+ type = LibraryType.INTERNAL_TEST_LIBRARY
+}
diff --git a/wear/tiles/tiles-testing/build.gradle b/wear/tiles/tiles-testing/build.gradle
index 4c78089..210a2ca 100644
--- a/wear/tiles/tiles-testing/build.gradle
+++ b/wear/tiles/tiles-testing/build.gradle
@@ -61,7 +61,7 @@
androidx {
name = "Android Wear Tiles Testing Utilities"
- type = LibraryType.PUBLISHED_LIBRARY
+ type = LibraryType.PUBLISHED_TEST_LIBRARY
mavenGroup = LibraryGroups.WEAR_TILES
inceptionYear = "2021"
description = "Testing utilities for Android Wear Tiles."
diff --git a/window/window-testing/build.gradle b/window/window-testing/build.gradle
index e9ad9b4..bedbf25 100644
--- a/window/window-testing/build.gradle
+++ b/window/window-testing/build.gradle
@@ -48,7 +48,7 @@
androidx {
name = "WindowManager Test Library"
- type = LibraryType.PUBLISHED_LIBRARY
+ type = LibraryType.PUBLISHED_TEST_LIBRARY
mavenGroup = LibraryGroups.WINDOW
inceptionYear = "2021"
description = "WindowManager Test Library"