Merge "Migrate room to use Gradle Version Catalogs" into androidx-main
diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
index 5422d22..8adc3d2 100644
--- a/.idea/codeStyles/Project.xml
+++ b/.idea/codeStyles/Project.xml
@@ -71,15 +71,6 @@
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
<value />
</option>
- <option name="PACKAGES_IMPORT_LAYOUT">
- <value>
- <package name="" alias="false" withSubpackages="true" />
- <package name="java" alias="false" withSubpackages="true" />
- <package name="javax" alias="false" withSubpackages="true" />
- <package name="kotlin" alias="false" withSubpackages="true" />
- <package name="" alias="true" withSubpackages="true" />
- </value>
- </option>
<option name="NAME_COUNT_TO_USE_STAR_IMPORT" value="2147483647" />
<option name="NAME_COUNT_TO_USE_STAR_IMPORT_FOR_MEMBERS" value="2147483647" />
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
diff --git a/annotation/annotation-experimental-lint/build.gradle b/annotation/annotation-experimental-lint/build.gradle
index 17d9220..517db7f 100644
--- a/annotation/annotation-experimental-lint/build.gradle
+++ b/annotation/annotation-experimental-lint/build.gradle
@@ -17,9 +17,6 @@
import androidx.build.LibraryGroups
import androidx.build.LibraryType
import androidx.build.LibraryVersions
-import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
-
-import static androidx.build.dependencies.DependenciesKt.*
plugins {
id("AndroidXPlugin")
@@ -34,13 +31,13 @@
}
dependencies {
- compileOnly(LINT_API_MIN)
- compileOnly(KOTLIN_STDLIB)
+ compileOnly(libs.androidLintMinApi)
+ compileOnly(libs.kotlinStdlib)
- testImplementation(KOTLIN_STDLIB)
- testImplementation(LINT_CORE)
- testImplementation(LINT_TESTS)
- testImplementation(JUNIT)
+ testImplementation(libs.kotlinStdlib)
+ testImplementation(libs.androidLint)
+ testImplementation(libs.androidLintTests)
+ testImplementation(libs.junit)
}
androidx {
diff --git a/annotation/annotation-experimental-lint/integration-tests/build.gradle b/annotation/annotation-experimental-lint/integration-tests/build.gradle
index 99a9bf2..fb5f92a 100644
--- a/annotation/annotation-experimental-lint/integration-tests/build.gradle
+++ b/annotation/annotation-experimental-lint/integration-tests/build.gradle
@@ -16,8 +16,6 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
-import static androidx.build.dependencies.DependenciesKt.KOTLIN_STDLIB
-
plugins {
id("AndroidXPlugin")
id("com.android.library")
@@ -25,7 +23,7 @@
}
dependencies {
- implementation(KOTLIN_STDLIB)
+ implementation(libs.kotlinStdlib)
implementation(project(":annotation:annotation-experimental"))
}
diff --git a/annotation/annotation-experimental/build.gradle b/annotation/annotation-experimental/build.gradle
index 2ff61bb..1c16de4 100644
--- a/annotation/annotation-experimental/build.gradle
+++ b/annotation/annotation-experimental/build.gradle
@@ -18,8 +18,6 @@
import androidx.build.LibraryVersions
import androidx.build.Publish
-import static androidx.build.dependencies.DependenciesKt.getKOTLIN_STDLIB
-
plugins {
id("AndroidXPlugin")
id("com.android.library")
@@ -27,7 +25,7 @@
}
dependencies {
- compileOnly(KOTLIN_STDLIB)
+ compileOnly(libs.kotlinStdlib)
lintPublish(project(":annotation:annotation-experimental-lint"))
}
diff --git a/annotation/annotation-sampled/build.gradle b/annotation/annotation-sampled/build.gradle
index fb71b74..d450e7e 100644
--- a/annotation/annotation-sampled/build.gradle
+++ b/annotation/annotation-sampled/build.gradle
@@ -14,15 +14,11 @@
* limitations under the License.
*/
-import static androidx.build.dependencies.DependenciesKt.*
-
-import androidx.build.Publish
-
plugins {
id("AndroidXPlugin")
id("kotlin")
}
dependencies {
- implementation(KOTLIN_STDLIB)
+ implementation(libs.kotlinStdlib)
}
diff --git a/arch/core/core-common/build.gradle b/arch/core/core-common/build.gradle
index d02da56..fca66dd 100644
--- a/arch/core/core-common/build.gradle
+++ b/arch/core/core-common/build.gradle
@@ -14,10 +14,7 @@
* limitations under the License.
*/
-import static androidx.build.dependencies.DependenciesKt.*
import androidx.build.LibraryGroups
-import androidx.build.LibraryVersions
-import androidx.build.AndroidXExtension
import androidx.build.Publish
plugins {
@@ -28,8 +25,8 @@
dependencies {
api("androidx.annotation:annotation:1.1.0")
- testImplementation(JUNIT)
- testImplementation(MOCKITO_CORE)
+ testImplementation(libs.junit)
+ testImplementation(libs.mockitoCore)
}
androidx {
diff --git a/arch/core/core-runtime/build.gradle b/arch/core/core-runtime/build.gradle
index 9459162..89e0b18 100644
--- a/arch/core/core-runtime/build.gradle
+++ b/arch/core/core-runtime/build.gradle
@@ -14,10 +14,7 @@
* limitations under the License.
*/
-import static androidx.build.dependencies.DependenciesKt.*
import androidx.build.LibraryGroups
-import androidx.build.AndroidXExtension
-import androidx.build.LibraryVersions
import androidx.build.Publish
plugins {
diff --git a/arch/core/core-testing/build.gradle b/arch/core/core-testing/build.gradle
index af6d38f..4a86ad7 100644
--- a/arch/core/core-testing/build.gradle
+++ b/arch/core/core-testing/build.gradle
@@ -14,10 +14,7 @@
* limitations under the License.
*/
-import static androidx.build.dependencies.DependenciesKt.*
import androidx.build.LibraryGroups
-import androidx.build.LibraryVersions
-import androidx.build.AndroidXExtension
import androidx.build.Publish
plugins {
@@ -28,16 +25,16 @@
dependencies {
api(project(":arch:core:core-runtime"))
api("androidx.annotation:annotation:1.1.0")
- api(JUNIT)
- api(MOCKITO_CORE, excludes.bytebuddy)
+ api(libs.junit)
+ api(libs.mockitoCore, excludes.bytebuddy)
- testImplementation(JUNIT)
+ testImplementation(libs.junit)
- androidTestImplementation(JUNIT)
- androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
- androidTestImplementation(ANDROIDX_TEST_CORE)
- androidTestImplementation(ANDROIDX_TEST_RUNNER)
- androidTestImplementation(ESPRESSO_CORE)
+ androidTestImplementation(libs.junit)
+ androidTestImplementation(libs.testExtJunit)
+ androidTestImplementation(libs.testCore)
+ androidTestImplementation(libs.testRunner)
+ androidTestImplementation(libs.espressoCore)
}
androidx {
diff --git a/asynclayoutinflater/asynclayoutinflater/build.gradle b/asynclayoutinflater/asynclayoutinflater/build.gradle
index 9d560a7..839d5b1 100644
--- a/asynclayoutinflater/asynclayoutinflater/build.gradle
+++ b/asynclayoutinflater/asynclayoutinflater/build.gradle
@@ -1,5 +1,4 @@
import androidx.build.LibraryGroups
-import androidx.build.LibraryVersions
import androidx.build.Publish
plugins {
diff --git a/autofill/autofill/build.gradle b/autofill/autofill/build.gradle
index c6b4e56..6379a81 100644
--- a/autofill/autofill/build.gradle
+++ b/autofill/autofill/build.gradle
@@ -14,9 +14,7 @@
* limitations under the License.
*/
-import static androidx.build.dependencies.DependenciesKt.*
import androidx.build.LibraryGroups
-import androidx.build.LibraryVersions
import androidx.build.Publish
plugins {
@@ -28,11 +26,11 @@
dependencies {
implementation("androidx.core:core:1.1.0")
- androidTestImplementation(ANDROIDX_TEST_CORE)
- androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
- androidTestImplementation(ANDROIDX_TEST_RUNNER)
- androidTestImplementation(ANDROIDX_TEST_RULES)
- androidTestImplementation(TRUTH)
+ androidTestImplementation(libs.testCore)
+ androidTestImplementation(libs.testExtJunit)
+ androidTestImplementation(libs.testRunner)
+ androidTestImplementation(libs.testRules)
+ androidTestImplementation(libs.truth)
androidTestImplementation("junit:junit:4.12")
}
diff --git a/cardview/cardview/build.gradle b/cardview/cardview/build.gradle
index 8cf7e02..163a152 100644
--- a/cardview/cardview/build.gradle
+++ b/cardview/cardview/build.gradle
@@ -1,5 +1,4 @@
import androidx.build.LibraryGroups
-import androidx.build.LibraryVersions
import androidx.build.Publish
plugins {
diff --git a/collection/collection-benchmark/build.gradle b/collection/collection-benchmark/build.gradle
index 0e8855c..8e1681e 100644
--- a/collection/collection-benchmark/build.gradle
+++ b/collection/collection-benchmark/build.gradle
@@ -13,9 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import static androidx.build.dependencies.DependenciesKt.*
-import androidx.build.LibraryGroups
-import androidx.build.LibraryVersions
+
import androidx.build.Publish
plugins {
@@ -28,13 +26,13 @@
dependencies {
androidTestImplementation(project(":collection:collection"))
androidTestImplementation(project(":collection:collection-ktx"))
- androidTestImplementation(KOTLIN_STDLIB)
+ androidTestImplementation(libs.kotlinStdlib)
androidTestImplementation(project(":benchmark:benchmark-junit4"))
- androidTestImplementation(JUNIT)
- androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
- androidTestImplementation(ANDROIDX_TEST_CORE)
- androidTestImplementation(ANDROIDX_TEST_RUNNER)
- androidTestImplementation(ANDROIDX_TEST_RULES)
+ androidTestImplementation(libs.junit)
+ androidTestImplementation(libs.testExtJunit)
+ androidTestImplementation(libs.testCore)
+ androidTestImplementation(libs.testRunner)
+ androidTestImplementation(libs.testRules)
}
androidx {
diff --git a/collection/collection-ktx/build.gradle b/collection/collection-ktx/build.gradle
index b9a9230..d161552 100644
--- a/collection/collection-ktx/build.gradle
+++ b/collection/collection-ktx/build.gradle
@@ -14,9 +14,7 @@
* limitations under the License.
*/
-import static androidx.build.dependencies.DependenciesKt.*
import androidx.build.LibraryGroups
-import androidx.build.LibraryVersions
import androidx.build.Publish
plugins {
@@ -26,9 +24,9 @@
dependencies {
api(project(":collection:collection"))
- api(KOTLIN_STDLIB)
- testImplementation(JUNIT)
- testImplementation(TRUTH)
+ api(libs.kotlinStdlib)
+ testImplementation(libs.junit)
+ testImplementation(libs.truth)
testImplementation(project(":internal-testutils-truth"))
}
diff --git a/collection/collection/build.gradle b/collection/collection/build.gradle
index e8acec8..0692fa8 100644
--- a/collection/collection/build.gradle
+++ b/collection/collection/build.gradle
@@ -14,9 +14,7 @@
* limitations under the License.
*/
-import static androidx.build.dependencies.DependenciesKt.*
import androidx.build.LibraryGroups
-import androidx.build.LibraryVersions
import androidx.build.Publish
plugins {
@@ -27,10 +25,10 @@
dependencies {
api("androidx.annotation:annotation:1.1.0")
- annotationProcessor(NULLAWAY)
- testImplementation(KOTLIN_STDLIB)
- testImplementation(JUNIT)
- testImplementation(TRUTH)
+ annotationProcessor(libs.nullaway)
+ testImplementation(libs.kotlinStdlib)
+ testImplementation(libs.junit)
+ testImplementation(libs.truth)
}
androidx {
diff --git a/collection/collection2/build.gradle b/collection/collection2/build.gradle
index 2960a65..62f7c17 100644
--- a/collection/collection2/build.gradle
+++ b/collection/collection2/build.gradle
@@ -14,8 +14,6 @@
* limitations under the License.
*/
-import static androidx.build.dependencies.DependenciesKt.*
-
plugins {
id("AndroidXPlugin")
id("org.jetbrains.kotlin.multiplatform")
@@ -29,12 +27,12 @@
sourceSets {
commonMain {
dependencies {
- api(KOTLIN_STDLIB_COMMON)
+ api(libs.kotlinStdlibCommon)
}
}
jvmMain {
dependencies {
- api(KOTLIN_STDLIB)
+ api(libs.kotlinStdlib)
api("androidx.annotation:annotation:1.1.0")
}
}
diff --git a/collection/integration-tests/testapp/build.gradle b/collection/integration-tests/testapp/build.gradle
index 0ff7471..a8d529f 100644
--- a/collection/integration-tests/testapp/build.gradle
+++ b/collection/integration-tests/testapp/build.gradle
@@ -14,11 +14,8 @@
* limitations under the License.
*/
-
import androidx.build.Publish
-import static androidx.build.dependencies.DependenciesKt.getKOTLIN_STDLIB
-
plugins {
id("AndroidXPlugin")
id("kotlin")
@@ -26,8 +23,7 @@
dependencies {
implementation(project(":collection:collection"))
- implementation(KOTLIN_STDLIB)
-
+ implementation(libs.kotlinStdlib)
implementation("androidx.annotation:annotation:1.1.0")
}
diff --git a/compose/foundation/foundation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/Offset.kt b/compose/foundation/foundation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/Offset.kt
index 99fbe46..354bea8 100644
--- a/compose/foundation/foundation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/Offset.kt
+++ b/compose/foundation/foundation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/Offset.kt
@@ -93,8 +93,9 @@
* Applying an offset only changes the position of the content, without interfering with
* its size measurement.
*
- * This modifier is designed to be used for offsets that change, possibly due to user interactions,
- * the advantage being that it avoids recomposition when the offset is changing.
+ * This modifier is designed to be used for offsets that change, possibly due to user interactions.
+ * It avoids recomposition when the offset is changing, and also adds a graphics layer that
+ * prevents unnecessary redrawing of the context when the offset is changing.
*
* This modifier will automatically adjust the horizontal offset according to the layout direction:
* when the LD is LTR, positive horizontal offsets will move the content to the right and
@@ -122,8 +123,9 @@
* Applying an offset only changes the position of the content, without interfering with
* its size measurement.
*
- * This modifier is designed to be used for offsets that change, possibly due to user interactions,
- * the advantage being that it avoids recomposition when the offset is changing.
+ * This modifier is designed to be used for offsets that change, possibly due to user interactions.
+ * It avoids recomposition when the offset is changing, and also adds a graphics layer that
+ * prevents unnecessary redrawing of the context when the offset is changing.
*
* This modifier will not consider layout direction when calculating the position of the content:
* a positive horizontal offset will always move the content to the right.
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/BackdropScaffoldTest.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/BackdropScaffoldTest.kt
index 87e89af..9aa84bc 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/BackdropScaffoldTest.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/BackdropScaffoldTest.kt
@@ -494,6 +494,37 @@
}
@Test
+ fun backdropScaffold_concealByTapingOnFrontLayer_withUnspecifiedColorScrim() {
+ lateinit var scaffoldState: BackdropScaffoldState
+ rule.setContent {
+ scaffoldState = rememberBackdropScaffoldState(Revealed)
+ BackdropScaffold(
+ scaffoldState = scaffoldState,
+ peekHeight = peekHeight,
+ headerHeight = headerHeight,
+ frontLayerScrimColor = Color.Unspecified,
+ appBar = { Box(Modifier.height(peekHeight)) },
+ backLayerContent = { Box(Modifier.height(contentHeight)) },
+ frontLayerContent = { Box(Modifier.fillMaxSize().testTag(frontLayer)) }
+ )
+ }
+
+ rule.runOnIdle {
+ assertThat(scaffoldState.currentValue).isEqualTo(Revealed)
+ }
+
+ rule.onNodeWithTag(frontLayer)
+ .performGesture { click() }
+
+ advanceClock()
+
+ // still revealed if the color is unspecified
+ rule.runOnIdle {
+ assertThat(scaffoldState.currentValue).isEqualTo(Revealed)
+ }
+ }
+
+ @Test
fun backdropScaffold_tapOnFrontLayerScrim_respectsVeto() {
lateinit var scaffoldState: BackdropScaffoldState
rule.setContent {
@@ -529,7 +560,7 @@
}
@Test
- fun backdropScaffold_scrimIsDisabledWhenTransparent() {
+ fun backdropScaffold_scrimIsDisabledWhenUnspecified() {
var frontLayerClicks = 0
lateinit var scaffoldState: BackdropScaffoldState
rule.setContent {
@@ -538,7 +569,7 @@
scaffoldState = scaffoldState,
peekHeight = peekHeight,
headerHeight = headerHeight,
- frontLayerScrimColor = Color.Transparent,
+ frontLayerScrimColor = Color.Unspecified,
appBar = { Box(Modifier.height(peekHeight)) },
backLayerContent = { Box(Modifier.height(contentHeight)) },
frontLayerContent = {
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/DrawerTest.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/DrawerTest.kt
index fa7efb3..36655fa 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/DrawerTest.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/DrawerTest.kt
@@ -24,6 +24,7 @@
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.runtime.CompositionLocalProvider
+import androidx.compose.runtime.mutableStateOf
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalLayoutDirection
@@ -734,6 +735,47 @@
}
@Test
+ fun bottomDrawer_scrim_doesNotClickWhenTransparent() {
+ val topTag = "BottomDrawer"
+ val scrimColor = mutableStateOf(Color.Red)
+ rule.setMaterialContent {
+ BottomDrawer(
+ modifier = Modifier.testTag(topTag),
+ scrimColor = scrimColor.value,
+ drawerState = rememberBottomDrawerState(BottomDrawerValue.Open),
+ drawerContent = {
+ Box(Modifier.height(shortBottomDrawerHeight).testTag(bottomDrawerTag))
+ },
+ content = {
+ Box(Modifier.fillMaxSize().testTag("body"))
+ }
+ )
+ }
+
+ val height = rule.rootHeight()
+ val topWhenOpened = height - shortBottomDrawerHeight
+
+ // The drawer should be opened
+ rule.onNodeWithTag(bottomDrawerTag).assertTopPositionInRootIsEqualTo(topWhenOpened)
+
+ var topNode = rule.onNodeWithTag(topTag).fetchSemanticsNode()
+ assertEquals(3, topNode.children.size)
+
+ rule.onNodeWithTag(topTag)
+ .onChildAt(1)
+ .assertHasClickAction()
+
+ rule.runOnIdle {
+ scrimColor.value = Color.Unspecified
+ }
+ rule.waitForIdle()
+
+ topNode = rule.onNodeWithTag(topTag).fetchSemanticsNode()
+ // should be 2 children now
+ assertEquals(2, topNode.children.size)
+ }
+
+ @Test
@LargeTest
fun bottomDrawer_respectsConfirmStateChange(): Unit = runBlocking(AutoTestFrameClock()) {
val contentTag = "contentTestTag"
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/ModalBottomSheetTest.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/ModalBottomSheetTest.kt
index 1c789d1..22c0082 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/ModalBottomSheetTest.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/ModalBottomSheetTest.kt
@@ -20,8 +20,11 @@
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
+import androidx.compose.runtime.LaunchedEffect
+import androidx.compose.runtime.mutableStateOf
import androidx.compose.ui.Modifier
import androidx.compose.ui.geometry.Offset
+import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.onGloballyPositioned
import androidx.compose.ui.layout.positionInRoot
import androidx.compose.ui.platform.testTag
@@ -434,6 +437,38 @@
}
@Test
+ fun modalBottomSheet_scrim_doesNotClickWhenTransparent() {
+ val topTag = "ModalBottomSheetLayout"
+ val scrimColor = mutableStateOf(Color.Red)
+ rule.setMaterialContent {
+ ModalBottomSheetLayout(
+ modifier = Modifier.testTag(topTag),
+ scrimColor = scrimColor.value,
+ sheetState = rememberModalBottomSheetState(ModalBottomSheetValue.HalfExpanded),
+ content = { Box(Modifier.fillMaxSize().testTag(contentTag)) },
+ sheetContent = { Box(Modifier.fillMaxSize().testTag(sheetTag)) }
+ )
+ }
+
+ val height = rule.rootHeight()
+ rule.onNodeWithTag(sheetTag)
+ .assertTopPositionInRootIsEqualTo(height / 2)
+ var topNode = rule.onNodeWithTag(topTag).fetchSemanticsNode()
+ assertEquals(3, topNode.children.size)
+ rule.onNodeWithTag(topTag)
+ .onChildAt(1)
+ .assertHasClickAction()
+
+ rule.runOnIdle {
+ scrimColor.value = Color.Unspecified
+ }
+
+ topNode = rule.onNodeWithTag(topTag).fetchSemanticsNode()
+ // only two nodes since there's no scrim
+ assertEquals(2, topNode.children.size)
+ }
+
+ @Test
fun modalBottomSheet_hideBySwiping_tallBottomSheet() {
lateinit var sheetState: ModalBottomSheetState
rule.setMaterialContent {
@@ -617,4 +652,44 @@
rule.onNodeWithTag(sheetTag)
.assertTopPositionInRootIsEqualTo(height)
}
+
+ @Test
+ fun modalBottomSheet_missingAnchors_findsClosest() {
+ val topTag = "ModalBottomSheetLayout"
+ val showShortContent = mutableStateOf(false)
+ val sheetState = ModalBottomSheetState(ModalBottomSheetValue.Hidden)
+ rule.setMaterialContent {
+ LaunchedEffect(showShortContent.value) {
+ sheetState.show()
+ }
+ ModalBottomSheetLayout(
+ modifier = Modifier.testTag(topTag),
+ sheetState = sheetState,
+ content = { Box(Modifier.fillMaxSize().testTag(contentTag)) },
+ sheetContent = {
+ if (!showShortContent.value) {
+ Box(Modifier.fillMaxSize().testTag(sheetTag))
+ } else {
+ Box(Modifier.fillMaxWidth().height(100.dp))
+ }
+ }
+ )
+ }
+
+ rule.onNodeWithTag(topTag).performGesture {
+ swipeDown()
+ swipeDown()
+ }
+
+ rule.runOnIdle {
+ assertThat(sheetState.currentValue).isEqualTo(ModalBottomSheetValue.Hidden)
+ }
+
+ rule.runOnIdle {
+ showShortContent.value = true
+ }
+ rule.runOnIdle {
+ assertThat(sheetState.currentValue).isEqualTo(ModalBottomSheetValue.Expanded)
+ }
+ }
}
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SwipeableTest.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SwipeableTest.kt
index e44274b..ec819db 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SwipeableTest.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SwipeableTest.kt
@@ -1541,6 +1541,45 @@
}
}
+ /**
+ * Tests that the [SwipeableState] is updated if the anchors change.
+ */
+ @Test
+ fun swipeable_anchorsUpdated_whenAnimationInProgress() = runBlocking(AutoTestFrameClock()) {
+ rule.mainClock.autoAdvance = false
+ lateinit var swipeableState: SwipeableState<String>
+ lateinit var anchors: MutableState<Map<Float, String>>
+ setSwipeableContent {
+ swipeableState = rememberSwipeableState("A")
+ anchors = remember { mutableStateOf(mapOf(10f to "A", 50f to "B", 100f to "C")) }
+ Modifier.swipeable(
+ state = swipeableState,
+ anchors = anchors.value,
+ thresholds = { _, _ -> FractionalThreshold(0.5f) },
+ orientation = Orientation.Horizontal
+ )
+ }
+
+ rule.runOnIdle {
+ assertThat(swipeableState.currentValue).isEqualTo("A")
+ assertThat(swipeableState.offset.value).isEqualTo(10f)
+ }
+
+ swipeableState.animateTo("B")
+
+ rule.mainClock.advanceTimeByFrame()
+
+ anchors.value = mapOf(10f to "A", 100f to "C")
+
+ advanceClock()
+
+ rule.runOnIdle {
+ // closes wins
+ assertThat(swipeableState.currentValue).isEqualTo("A")
+ assertThat(swipeableState.offset.value).isEqualTo(10f)
+ }
+ }
+
@Test
fun testInspectorValue() {
val anchors = mapOf(0f to "A", 100f to "B")
diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/BackdropScaffold.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/BackdropScaffold.kt
index ee2be73..5d6ceee 100644
--- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/BackdropScaffold.kt
+++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/BackdropScaffold.kt
@@ -42,6 +42,7 @@
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.graphics.graphicsLayer
+import androidx.compose.ui.graphics.isSpecified
import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.input.pointer.pointerInput
import androidx.compose.ui.layout.SubcomposeLayout
@@ -245,8 +246,8 @@
* children. Defaults to the matching content color for [frontLayerBackgroundColor], or if that
* is not a color from the theme, this will keep the same content color set above the front layer.
* @param frontLayerScrimColor The color of the scrim applied to the front layer when the back
- * layer is revealed. If you set this to `Color.Transparent`, then a scrim will not be applied
- * and interaction with the front layer will not be blocked when the back layer is revealed.
+ * layer is revealed. If the color passed is [Color.Unspecified], then a scrim will not be
+ * applied and interaction with the front layer will not be blocked when the back layer is revealed.
* @param snackbarHost The component hosting the snackbars shown inside the scaffold.
*/
@Composable
@@ -385,7 +386,7 @@
onDismiss: () -> Unit,
visible: Boolean
) {
- if (color != Color.Transparent) {
+ if (color.isSpecified) {
val alpha by animateFloatAsState(
targetValue = if (visible) 1f else 0f,
animationSpec = TweenSpec()
diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Drawer.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Drawer.kt
index fd28953..d047ba6 100644
--- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Drawer.kt
+++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Drawer.kt
@@ -43,6 +43,7 @@
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Shape
+import androidx.compose.ui.graphics.isSpecified
import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.input.pointer.pointerInput
import androidx.compose.ui.layout.onGloballyPositioned
@@ -483,7 +484,9 @@
* @param drawerContentColor color of the content to use inside the drawer sheet. Defaults to
* either the matching content color for [drawerBackgroundColor], or, if it is not a color from
* the theme, this will keep the same value set above this Surface.
- * @param scrimColor color of the scrim that obscures content when the drawer is open
+ * @param scrimColor color of the scrim that obscures content when the drawer is open. If the
+ * color passed is [Color.Unspecified], then a scrim will no longer be applied and the bottom
+ * drawer will not block interaction with the rest of the screen when visible.
* @param content content of the rest of the UI
*
*/
@@ -613,7 +616,7 @@
onDismiss: () -> Unit,
visible: Boolean
) {
- if (color != Color.Transparent) {
+ if (color.isSpecified) {
val alpha by animateFloatAsState(
targetValue = if (visible) 1f else 0f,
animationSpec = TweenSpec()
diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/ModalBottomSheet.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/ModalBottomSheet.kt
index a576cae..614d6a3 100644
--- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/ModalBottomSheet.kt
+++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/ModalBottomSheet.kt
@@ -44,6 +44,7 @@
import androidx.compose.ui.composed
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Shape
+import androidx.compose.ui.graphics.isSpecified
import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.input.pointer.pointerInput
import androidx.compose.ui.layout.onGloballyPositioned
@@ -224,8 +225,9 @@
* children. Defaults to the matching content color for [sheetBackgroundColor], or if that is not
* a color from the theme, this will keep the same content color set above the bottom sheet.
* @param scrimColor The color of the scrim that is applied to the rest of the screen when the
- * bottom sheet is visible. If you set this to `Color.Transparent`, then a scrim will no longer be
- * applied and the bottom sheet will not block interaction with the rest of the screen when visible.
+ * bottom sheet is visible. If the color passed is [Color.Unspecified], then a scrim will no
+ * longer be applied and the bottom sheet will not block interaction with the rest of the screen
+ * when visible.
* @param content The content of rest of the screen.
*/
@Composable
@@ -358,7 +360,7 @@
onDismiss: () -> Unit,
visible: Boolean
) {
- if (color != Color.Transparent) {
+ if (color.isSpecified) {
val alpha by animateFloatAsState(
targetValue = if (visible) 1f else 0f,
animationSpec = TweenSpec()
diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Swipeable.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Swipeable.kt
index cfb4c74..dec32d4 100644
--- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Swipeable.kt
+++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Swipeable.kt
@@ -164,17 +164,31 @@
// instead. Note that this stops any ongoing animation.
minBound = Float.NEGATIVE_INFINITY
maxBound = Float.POSITIVE_INFINITY
- val targetOffset = newAnchors.getOffset(currentValue)
- ?: newAnchors.keys.minByOrNull { abs(it - offset.value) }!!
+ val animationTargetValue = animationTarget.value
+ // if we're in the animation already, let's find it a new home
+ val targetOffset = if (animationTargetValue != null) {
+ // first, try to map old state to the new state
+ val oldState = oldAnchors[animationTargetValue]
+ val newState = newAnchors.getOffset(oldState)
+ // return new state if exists, or find the closes one among new anchors
+ newState ?: newAnchors.keys.minByOrNull { abs(it - animationTargetValue) }!!
+ } else {
+ // we're not animating, proceed by finding the new anchors for an old value
+ val actualOldValue = oldAnchors[offset.value]
+ val value = if (actualOldValue == currentValue) currentValue else actualOldValue
+ newAnchors.getOffset(value) ?: newAnchors
+ .keys.minByOrNull { abs(it - offset.value) }!!
+ }
try {
animateInternalToOffset(targetOffset, animationSpec)
} catch (c: CancellationException) {
// If the animation was interrupted for any reason, snap as a last resort.
snapInternalToOffset(targetOffset)
+ } finally {
+ currentValue = newAnchors.getValue(targetOffset)
+ minBound = newAnchors.keys.minOrNull()!!
+ maxBound = newAnchors.keys.maxOrNull()!!
}
- currentValue = newAnchors.getValue(targetOffset)
- minBound = newAnchors.keys.minOrNull()!!
- maxBound = newAnchors.keys.maxOrNull()!!
}
}
diff --git a/compose/test-utils/src/androidMain/kotlin/androidx/compose/testutils/AndroidComposeTestCaseRunner.android.kt b/compose/test-utils/src/androidMain/kotlin/androidx/compose/testutils/AndroidComposeTestCaseRunner.android.kt
index fe28c00..2275c67 100644
--- a/compose/test-utils/src/androidMain/kotlin/androidx/compose/testutils/AndroidComposeTestCaseRunner.android.kt
+++ b/compose/test-utils/src/androidMain/kotlin/androidx/compose/testutils/AndroidComposeTestCaseRunner.android.kt
@@ -16,7 +16,6 @@
package androidx.compose.testutils
-import android.annotation.TargetApi
import android.app.Activity
import android.graphics.Bitmap
import android.graphics.Canvas
@@ -28,6 +27,7 @@
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
+import androidx.annotation.RequiresApi
import androidx.activity.ComponentActivity
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionContext
@@ -79,6 +79,8 @@
private val screenWithSpec: Int
private val screenHeightSpec: Int
+
+ @Suppress("NewApi") // NewApi doesn't understand Kotlin `when` (b/189459502)
private val capture = when {
supportsRenderNode -> RenderNodeCapture()
supportsMRenderNode -> MRenderNodeCapture()
@@ -342,7 +344,7 @@
fun endRecording()
}
-@TargetApi(Build.VERSION_CODES.Q)
+@RequiresApi(Build.VERSION_CODES.Q)
private class RenderNodeCapture : DrawCapture {
private val renderNode = RenderNode("Test")
diff --git a/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/LayoutSample.kt b/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/LayoutSample.kt
index 656c402..ef27741 100644
--- a/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/LayoutSample.kt
+++ b/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/LayoutSample.kt
@@ -26,6 +26,7 @@
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.IntrinsicMeasurable
import androidx.compose.ui.layout.IntrinsicMeasureScope
+import androidx.compose.ui.layout.LayoutModifier
import androidx.compose.ui.layout.Measurable
import androidx.compose.ui.layout.MeasurePolicy
import androidx.compose.ui.layout.MeasureResult
@@ -166,19 +167,39 @@
@Sampled
@Composable
+fun LayoutModifierSample() {
+ val verticalPadding = object : LayoutModifier {
+ override fun MeasureScope.measure(
+ measurable: Measurable,
+ constraints: Constraints
+ ): MeasureResult {
+ // an example modifier that adds 50 pixels of vertical padding.
+ val padding = 50
+ val placeable = measurable.measure(constraints.offset(vertical = -padding))
+ return layout(placeable.width, placeable.height + padding) {
+ placeable.placeRelative(0, padding)
+ }
+ }
+ }
+ Box(Modifier.background(Color.Gray).then(verticalPadding)) {
+ Box(Modifier.fillMaxSize().background(Color.DarkGray))
+ }
+}
+
+@Sampled
+@Composable
fun ConvenienceLayoutModifierSample() {
Box(
- modifier = Modifier
- .background(Color.Gray)
+ Modifier.background(Color.Gray)
.layout { measurable, constraints ->
- // an example modifier that adds 50 pixels of vertical padding
+ // an example modifier that adds 50 pixels of vertical padding.
val padding = 50
val placeable = measurable.measure(constraints.offset(vertical = -padding))
- this.layout(placeable.width, placeable.height + padding) {
+ layout(placeable.width, placeable.height + padding) {
placeable.placeRelative(0, padding)
}
}
) {
- Box(Modifier.fillMaxSize().background(Color.DarkGray)) {}
+ Box(Modifier.fillMaxSize().background(Color.DarkGray))
}
}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/LayoutModifier.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/LayoutModifier.kt
index 3888e20..b110868 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/LayoutModifier.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/LayoutModifier.kt
@@ -32,6 +32,8 @@
* the [androidx.compose.ui.layout.Layout] component is used to define the layout behavior of
* multiple children.
*
+ * @sample androidx.compose.ui.samples.LayoutModifierSample
+ *
* @see androidx.compose.ui.layout.Layout
*/
interface LayoutModifier : Modifier.Element {
diff --git a/concurrent/futures-ktx/build.gradle b/concurrent/futures-ktx/build.gradle
index 838f502..8dbb700 100644
--- a/concurrent/futures-ktx/build.gradle
+++ b/concurrent/futures-ktx/build.gradle
@@ -14,15 +14,10 @@
* limitations under the License.
*/
-
-import androidx.build.AndroidXExtension
import androidx.build.LibraryGroups
-import androidx.build.LibraryVersions
import androidx.build.Publish
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
-import static androidx.build.dependencies.DependenciesKt.*
-
plugins {
id("AndroidXPlugin")
id("kotlin")
@@ -30,14 +25,14 @@
dependencies {
api(project(":concurrent:concurrent-futures"))
- api(KOTLIN_STDLIB)
- api(KOTLIN_COROUTINES_CORE)
+ api(libs.kotlinStdlib)
+ api(libs.kotlinCoroutinesCore)
- testImplementation(JUNIT)
- testImplementation(KOTLIN_TEST)
- testImplementation(KOTLIN_COROUTINES_TEST)
- testImplementation(ANDROIDX_TEST_EXT_JUNIT)
- testImplementation(ANDROIDX_TEST_CORE)
+ testImplementation(libs.junit)
+ testImplementation(libs.kotlinTest)
+ testImplementation(libs.kotlinCoroutinesTest)
+ testImplementation(libs.testExtJunit)
+ testImplementation(libs.testCore)
}
androidx {
diff --git a/concurrent/futures/build.gradle b/concurrent/futures/build.gradle
index b1a0910..824efb0 100644
--- a/concurrent/futures/build.gradle
+++ b/concurrent/futures/build.gradle
@@ -14,10 +14,7 @@
* limitations under the License.
*/
-import static androidx.build.dependencies.DependenciesKt.*
-import androidx.build.AndroidXExtension
import androidx.build.LibraryGroups
-import androidx.build.LibraryVersions
import androidx.build.Publish
plugins {
@@ -27,9 +24,9 @@
dependencies {
api("androidx.annotation:annotation:1.1.0")
- api(GUAVA_LISTENABLE_FUTURE)
- testImplementation(JUNIT)
- testImplementation(TRUTH)
+ api(libs.guavaListenableFuture)
+ testImplementation(libs.junit)
+ testImplementation(libs.truth)
}
androidx {
diff --git a/contentpager/contentpager/build.gradle b/contentpager/contentpager/build.gradle
index 17c5064..4e32321 100644
--- a/contentpager/contentpager/build.gradle
+++ b/contentpager/contentpager/build.gradle
@@ -14,9 +14,7 @@
* limitations under the License.
*/
-import static androidx.build.dependencies.DependenciesKt.*
import androidx.build.LibraryGroups
-import androidx.build.LibraryVersions
import androidx.build.Publish
plugins {
@@ -29,12 +27,12 @@
api("androidx.core:core:1.1.0")
implementation("androidx.collection:collection:1.1.0")
- androidTestImplementation(JUNIT)
- androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
- androidTestImplementation(ANDROIDX_TEST_CORE)
- androidTestImplementation(ANDROIDX_TEST_RUNNER)
- androidTestImplementation(ANDROIDX_TEST_RULES)
- androidTestImplementation(ESPRESSO_CORE, excludes.espresso)
+ androidTestImplementation(libs.junit)
+ androidTestImplementation(libs.testExtJunit)
+ androidTestImplementation(libs.testCore)
+ androidTestImplementation(libs.testRunner)
+ androidTestImplementation(libs.testRules)
+ androidTestImplementation(libs.espressoCore, excludes.espresso)
}
androidx {
diff --git a/cursoradapter/cursoradapter/build.gradle b/cursoradapter/cursoradapter/build.gradle
index 9ab41a9..aa304ec 100644
--- a/cursoradapter/cursoradapter/build.gradle
+++ b/cursoradapter/cursoradapter/build.gradle
@@ -1,5 +1,4 @@
import androidx.build.LibraryGroups
-import androidx.build.LibraryVersions
import androidx.build.Publish
plugins {
diff --git a/customview/customview/build.gradle b/customview/customview/build.gradle
index 1bdb442..f1839fa 100644
--- a/customview/customview/build.gradle
+++ b/customview/customview/build.gradle
@@ -1,4 +1,3 @@
-import static androidx.build.dependencies.DependenciesKt.*
import androidx.build.LibraryGroups
import androidx.build.Publish
@@ -13,12 +12,12 @@
api("androidx.core:core:1.3.0-beta01")
implementation("androidx.collection:collection:1.1.0")
- androidTestImplementation(KOTLIN_STDLIB)
- androidTestImplementation(JUNIT)
- androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
- androidTestImplementation(ANDROIDX_TEST_CORE)
- androidTestImplementation(ANDROIDX_TEST_RUNNER)
- androidTestImplementation(ANDROIDX_TEST_RULES)
+ androidTestImplementation(libs.kotlinStdlib)
+ androidTestImplementation(libs.junit)
+ androidTestImplementation(libs.testExtJunit)
+ androidTestImplementation(libs.testCore)
+ androidTestImplementation(libs.testRunner)
+ androidTestImplementation(libs.testRules)
}
androidx {
diff --git a/documentfile/documentfile/build.gradle b/documentfile/documentfile/build.gradle
index 4430a1e..10030ef 100644
--- a/documentfile/documentfile/build.gradle
+++ b/documentfile/documentfile/build.gradle
@@ -1,6 +1,4 @@
-import static androidx.build.dependencies.DependenciesKt.*
import androidx.build.LibraryGroups
-import androidx.build.LibraryVersions
import androidx.build.Publish
plugins {
@@ -11,11 +9,11 @@
dependencies {
api("androidx.annotation:annotation:1.1.0")
- annotationProcessor(NULLAWAY)
+ annotationProcessor(libs.nullaway)
- androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
- androidTestImplementation(ANDROIDX_TEST_CORE)
- androidTestImplementation(ANDROIDX_TEST_RUNNER)
+ androidTestImplementation(libs.testExtJunit)
+ androidTestImplementation(libs.testCore)
+ androidTestImplementation(libs.testRunner)
}
androidx {
diff --git a/dynamic-animation/dynamic-animation-ktx/build.gradle b/dynamic-animation/dynamic-animation-ktx/build.gradle
index e3ec3f0..d1553c9 100644
--- a/dynamic-animation/dynamic-animation-ktx/build.gradle
+++ b/dynamic-animation/dynamic-animation-ktx/build.gradle
@@ -16,8 +16,6 @@
import androidx.build.LibraryGroups
import androidx.build.LibraryVersions
-
-import static androidx.build.dependencies.DependenciesKt.*
import androidx.build.Publish
plugins {
@@ -27,17 +25,17 @@
}
dependencies {
- api(KOTLIN_STDLIB)
+ api(libs.kotlinStdlib)
api(project(":dynamicanimation:dynamicanimation"))
- androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
- androidTestImplementation(ANDROIDX_TEST_CORE)
- androidTestImplementation(ANDROIDX_TEST_RUNNER)
- androidTestImplementation(ANDROIDX_TEST_RULES)
+ androidTestImplementation(libs.testExtJunit)
+ androidTestImplementation(libs.testCore)
+ androidTestImplementation(libs.testRunner)
+ androidTestImplementation(libs.testRules)
- androidTestImplementation(ESPRESSO_CORE, excludes.espresso)
- androidTestImplementation(MOCKITO_CORE, excludes.bytebuddy) // DexMaker has it"s own MockMaker
- androidTestImplementation(DEXMAKER_MOCKITO, excludes.bytebuddy) // DexMaker has it"s own MockMaker
+ androidTestImplementation(libs.espressoCore, excludes.espresso)
+ androidTestImplementation(libs.mockitoCore, excludes.bytebuddy) // DexMaker has it"s own MockMaker
+ androidTestImplementation(libs.dexmakerMockito, excludes.bytebuddy) // DexMaker has it"s own MockMaker
}
androidx {
diff --git a/dynamic-animation/dynamic-animation/build.gradle b/dynamic-animation/dynamic-animation/build.gradle
index 13e952f..50c3e5c 100644
--- a/dynamic-animation/dynamic-animation/build.gradle
+++ b/dynamic-animation/dynamic-animation/build.gradle
@@ -1,4 +1,3 @@
-import static androidx.build.dependencies.DependenciesKt.*
import androidx.build.LibraryGroups
import androidx.build.LibraryVersions
import androidx.build.Publish
@@ -12,13 +11,13 @@
api("androidx.core:core:1.1.0")
implementation("androidx.collection:collection:1.1.0")
- androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
- androidTestImplementation(ANDROIDX_TEST_CORE)
- androidTestImplementation(ANDROIDX_TEST_RUNNER)
- androidTestImplementation(ANDROIDX_TEST_RULES)
- androidTestImplementation(ESPRESSO_CORE, excludes.espresso)
- androidTestImplementation(MOCKITO_CORE, excludes.bytebuddy) // DexMaker has it"s own MockMaker
- androidTestImplementation(DEXMAKER_MOCKITO, excludes.bytebuddy) // DexMaker has it"s own MockMaker
+ androidTestImplementation(libs.testExtJunit)
+ androidTestImplementation(libs.testCore)
+ androidTestImplementation(libs.testRunner)
+ androidTestImplementation(libs.testRules)
+ androidTestImplementation(libs.espressoCore, excludes.espresso)
+ androidTestImplementation(libs.mockitoCore, excludes.bytebuddy) // DexMaker has it"s own MockMaker
+ androidTestImplementation(libs.dexmakerMockito, excludes.bytebuddy) // DexMaker has it"s own MockMaker
}
androidx {
diff --git a/enterprise/feedback/build.gradle b/enterprise/feedback/build.gradle
index 8c912a0..6e9a1bb 100644
--- a/enterprise/feedback/build.gradle
+++ b/enterprise/feedback/build.gradle
@@ -1,6 +1,4 @@
-import static androidx.build.dependencies.DependenciesKt.*
import androidx.build.LibraryGroups
-import androidx.build.LibraryVersions
import androidx.build.Publish
plugins {
@@ -9,13 +7,13 @@
}
dependencies {
api("androidx.annotation:annotation:1.0.1")
- api(AUTO_VALUE_ANNOTATIONS)
- testImplementation(ANDROIDX_TEST_CORE)
- testImplementation(ANDROIDX_TEST_RUNNER)
- annotationProcessor(AUTO_VALUE)
- testImplementation(JUNIT)
- testImplementation(TRUTH)
- testImplementation(ROBOLECTRIC)
+ api(libs.autoValueAnnotations)
+ testImplementation(libs.testCore)
+ testImplementation(libs.testRunner)
+ annotationProcessor(libs.autoValue)
+ testImplementation(libs.junit)
+ testImplementation(libs.truth)
+ testImplementation(libs.robolectric)
}
android {
defaultConfig {
diff --git a/enterprise/feedback/testing/build.gradle b/enterprise/feedback/testing/build.gradle
index e5bc874..ff1db7c 100644
--- a/enterprise/feedback/testing/build.gradle
+++ b/enterprise/feedback/testing/build.gradle
@@ -14,9 +14,7 @@
* limitations under the License.
*/
-import static androidx.build.dependencies.DependenciesKt.*
import androidx.build.LibraryGroups
-import androidx.build.LibraryVersions
import androidx.build.Publish
plugins {
@@ -25,7 +23,7 @@
}
dependencies {
api(project(":enterprise-feedback:"))
- testImplementation(TRUTH)
+ testImplementation(libs.truth)
}
android {
defaultConfig {
diff --git a/exifinterface/exifinterface/build.gradle b/exifinterface/exifinterface/build.gradle
index cad2490..ff3abf5 100644
--- a/exifinterface/exifinterface/build.gradle
+++ b/exifinterface/exifinterface/build.gradle
@@ -1,6 +1,4 @@
-import static androidx.build.dependencies.DependenciesKt.*
import androidx.build.LibraryGroups
-import androidx.build.LibraryVersions
import androidx.build.Publish
plugins {
@@ -11,10 +9,10 @@
dependencies {
implementation("androidx.annotation:annotation:1.2.0")
- androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
- androidTestImplementation(ANDROIDX_TEST_CORE)
- androidTestImplementation(ANDROIDX_TEST_RUNNER)
- androidTestImplementation(ANDROIDX_TEST_RULES)
+ androidTestImplementation(libs.testExtJunit)
+ androidTestImplementation(libs.testCore)
+ androidTestImplementation(libs.testRunner)
+ androidTestImplementation(libs.testRules)
}
androidx {
diff --git a/fragment/integration-tests/testapp/lint-baseline.xml b/fragment/integration-tests/testapp/lint-baseline.xml
deleted file mode 100644
index 64d6c6c..0000000
--- a/fragment/integration-tests/testapp/lint-baseline.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<issues format="6" by="lint 7.0.0-alpha15" type="baseline" client="cli" name="Lint" variant="all" version="7.0.0-alpha15">
-
- <issue
- id="BanTargetApiAnnotation"
- message="Uses @TargetApi annotation"
- errorLine1="@TargetApi(Build.VERSION_CODES.LOLLIPOP)"
- errorLine2="~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/main/java/androidx/fragment/testapp/kittenfragmenttransitions/DetailsTransition.kt"
- line="31"
- column="1"/>
- </issue>
-
-</issues>
diff --git a/fragment/integration-tests/testapp/src/main/java/androidx/fragment/testapp/kittenfragmenttransitions/DetailsTransition.kt b/fragment/integration-tests/testapp/src/main/java/androidx/fragment/testapp/kittenfragmenttransitions/DetailsTransition.kt
index ee8f55d..3d1826c 100644
--- a/fragment/integration-tests/testapp/src/main/java/androidx/fragment/testapp/kittenfragmenttransitions/DetailsTransition.kt
+++ b/fragment/integration-tests/testapp/src/main/java/androidx/fragment/testapp/kittenfragmenttransitions/DetailsTransition.kt
@@ -15,10 +15,10 @@
*/
package androidx.fragment.testapp.kittenfragmenttransitions
-import android.annotation.TargetApi
import android.content.Context
import android.os.Build
import android.util.AttributeSet
+import androidx.annotation.RequiresApi
import androidx.transition.ChangeBounds
import androidx.transition.ChangeImageTransform
import androidx.transition.ChangeTransform
@@ -28,7 +28,7 @@
* Transition that performs almost exactly like [android.transition.AutoTransition], but has
* an added [ChangeImageTransform] to support properly scaling up our gorgeous kittens.
*/
-@TargetApi(Build.VERSION_CODES.LOLLIPOP)
+@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
class DetailsTransition : TransitionSet {
constructor() {
init()
diff --git a/gridlayout/gridlayout/build.gradle b/gridlayout/gridlayout/build.gradle
index b5c5616..0d7f10e 100644
--- a/gridlayout/gridlayout/build.gradle
+++ b/gridlayout/gridlayout/build.gradle
@@ -1,6 +1,4 @@
-import static androidx.build.dependencies.DependenciesKt.*
import androidx.build.LibraryGroups
-import androidx.build.LibraryVersions
import androidx.build.Publish
plugins {
@@ -12,11 +10,11 @@
api("androidx.annotation:annotation:1.1.0")
implementation("androidx.core:core:1.3.0-beta01")
- androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
- androidTestImplementation(ANDROIDX_TEST_CORE)
- androidTestImplementation(ANDROIDX_TEST_RUNNER)
- androidTestImplementation(ANDROIDX_TEST_RULES)
- androidTestImplementation(ESPRESSO_CORE, excludes.espresso)
+ androidTestImplementation(libs.testExtJunit)
+ androidTestImplementation(libs.testCore)
+ androidTestImplementation(libs.testRunner)
+ androidTestImplementation(libs.testRules)
+ androidTestImplementation(libs.espressoCore, excludes.espresso)
}
androidx {
diff --git a/health/health-services-client/build.gradle b/health/health-services-client/build.gradle
index 248825c..51f8485 100644
--- a/health/health-services-client/build.gradle
+++ b/health/health-services-client/build.gradle
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import static androidx.build.dependencies.DependenciesKt.*
+
import androidx.build.LibraryGroups
import androidx.build.LibraryType
import androidx.build.LibraryVersions
@@ -25,10 +25,10 @@
}
dependencies {
- api(KOTLIN_STDLIB)
+ api(libs.kotlinStdlib)
api("androidx.annotation:annotation:1.1.0")
- implementation(GUAVA_LISTENABLE_FUTURE)
- implementation(GUAVA_ANDROID)
+ implementation(libs.guavaListenableFuture)
+ implementation(libs.guavaAndroid)
implementation("androidx.core:core-ktx:1.5.0-alpha04")
}
diff --git a/heifwriter/heifwriter/build.gradle b/heifwriter/heifwriter/build.gradle
index 2df6655..55b7af7 100644
--- a/heifwriter/heifwriter/build.gradle
+++ b/heifwriter/heifwriter/build.gradle
@@ -1,6 +1,4 @@
-import static androidx.build.dependencies.DependenciesKt.*
import androidx.build.LibraryGroups
-import androidx.build.LibraryVersions
import androidx.build.Publish
plugins {
@@ -17,11 +15,11 @@
dependencies {
api("androidx.annotation:annotation:1.1.0")
- androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
- androidTestImplementation(ANDROIDX_TEST_CORE)
- androidTestImplementation(ANDROIDX_TEST_RUNNER)
- androidTestImplementation(ANDROIDX_TEST_RULES)
- androidTestImplementation(ESPRESSO_CORE, excludes.espresso)
+ androidTestImplementation(libs.testExtJunit)
+ androidTestImplementation(libs.testCore)
+ androidTestImplementation(libs.testRunner)
+ androidTestImplementation(libs.testRules)
+ androidTestImplementation(libs.espressoCore, excludes.espresso)
}
androidx {
diff --git a/interpolator/interpolator/build.gradle b/interpolator/interpolator/build.gradle
index 98ec2fc..6a7c619 100644
--- a/interpolator/interpolator/build.gradle
+++ b/interpolator/interpolator/build.gradle
@@ -1,5 +1,4 @@
import androidx.build.LibraryGroups
-import androidx.build.LibraryVersions
import androidx.build.Publish
plugins {
diff --git a/lint-checks/build.gradle b/lint-checks/build.gradle
index 9f72819..00164a2 100644
--- a/lint-checks/build.gradle
+++ b/lint-checks/build.gradle
@@ -32,14 +32,14 @@
}
dependencies {
- compileOnly(LINT_API_LATEST)
+ compileOnly(libs.androidLintApi)
compileOnly(LINT_CHECKS_LATEST)
- compileOnly(KOTLIN_STDLIB)
+ compileOnly(libs.kotlinStdlib)
- testImplementation(KOTLIN_STDLIB)
- testImplementation(LINT_CORE)
- testImplementation(LINT_TESTS)
- testImplementation(JUNIT)
+ testImplementation(libs.kotlinStdlib)
+ testImplementation(libs.androidLint)
+ testImplementation(libs.androidLintTests)
+ testImplementation(libs.junit)
}
androidx {
diff --git a/lint-checks/integration-tests/build.gradle b/lint-checks/integration-tests/build.gradle
index c7f4c61..8b98f67 100644
--- a/lint-checks/integration-tests/build.gradle
+++ b/lint-checks/integration-tests/build.gradle
@@ -16,8 +16,6 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
-import static androidx.build.dependencies.DependenciesKt.KOTLIN_STDLIB
-
plugins {
id("AndroidXPlugin")
id("com.android.library")
@@ -26,7 +24,7 @@
dependencies {
implementation(projectOrArtifact(":annotation:annotation"))
- implementation(KOTLIN_STDLIB)
+ implementation(libs.kotlinStdlib)
}
// Allow usage of Kotlin's @Experimental and @RequiresOptIn annotations.
@@ -48,7 +46,7 @@
lintOptions {
// lint is supposed to detect errors in this project
// We don't need to see the errors in stdout
- textOutput("${buildDir}/lint-output.txt")
+ textOutput("${buildDir}/lint-results-debug.txt") // Set to this value for b/189877657
// We don't want errors to cause lint to fail
abortOnError false
}
diff --git a/lint-checks/src/main/java/androidx/build/lint/AndroidXIssueRegistry.kt b/lint-checks/src/main/java/androidx/build/lint/AndroidXIssueRegistry.kt
index 60769c1..6f93b40 100644
--- a/lint-checks/src/main/java/androidx/build/lint/AndroidXIssueRegistry.kt
+++ b/lint-checks/src/main/java/androidx/build/lint/AndroidXIssueRegistry.kt
@@ -36,7 +36,7 @@
BanConcurrentHashMap.ISSUE,
BanInappropriateExperimentalUsage.ISSUE,
BanKeepAnnotation.ISSUE,
- BanTargetApiAnnotation.ISSUE,
+ TargetApiAnnotationUsageDetector.ISSUE,
SampledAnnotationEnforcer.MISSING_SAMPLED_ANNOTATION,
SampledAnnotationEnforcer.OBSOLETE_SAMPLED_ANNOTATION,
SampledAnnotationEnforcer.MISSING_SAMPLES_DIRECTORY,
diff --git a/lint-checks/src/main/java/androidx/build/lint/BanTargetApiAnnotation.kt b/lint-checks/src/main/java/androidx/build/lint/TargetApiAnnotationUsageDetector.kt
similarity index 63%
rename from lint-checks/src/main/java/androidx/build/lint/BanTargetApiAnnotation.kt
rename to lint-checks/src/main/java/androidx/build/lint/TargetApiAnnotationUsageDetector.kt
index b6e8e0b..4e9fd59 100644
--- a/lint-checks/src/main/java/androidx/build/lint/BanTargetApiAnnotation.kt
+++ b/lint-checks/src/main/java/androidx/build/lint/TargetApiAnnotationUsageDetector.kt
@@ -29,7 +29,10 @@
import com.android.tools.lint.detector.api.Severity
import org.jetbrains.uast.UAnnotation
-class BanTargetApiAnnotation : Detector(), Detector.UastScanner {
+/**
+ * Enforces policy banning use of the `@TargetApi` annotation.
+ */
+class TargetApiAnnotationUsageDetector : Detector(), Detector.UastScanner {
override fun getApplicableUastTypes() = listOf(UAnnotation::class.java)
@@ -42,7 +45,14 @@
if (node.qualifiedName == "android.annotation.TargetApi") {
context.report(
ISSUE, node, context.getNameLocation(node),
- "Uses @TargetApi annotation"
+ "Use `@RequiresApi` instead of `@TargetApi`",
+ fix().name("Replace with `@RequiresApi`")
+ .replace()
+ .pattern("(?:android\\.annotation\\.)?TargetApi")
+ .with("androidx.annotation.RequiresApi")
+ .shortenNames()
+ .autoFix(true, true)
+ .build(),
)
}
}
@@ -51,11 +61,13 @@
companion object {
val ISSUE = Issue.create(
"BanTargetApiAnnotation",
- "Uses @TargetApi annotation",
- "Use of @TargetApi annotation is not allowed, please consider " +
- "using the @RequiresApi annotation instead.",
+ "Replace usage of `@TargetApi` with `@RequiresApi`",
+ "The `@TargetApi` annotation satisfies the `NewApi` lint check, but it does " +
+ "not ensure that calls to the annotated API are correctly guarded on an `SDK_INT`" +
+ " (or equivalent) check. Instead, use the `@RequiresApi` annotation to ensure " +
+ "that all calls are correctly guarded.",
Category.CORRECTNESS, 5, Severity.ERROR,
- Implementation(BanTargetApiAnnotation::class.java, Scope.JAVA_FILE_SCOPE)
+ Implementation(TargetApiAnnotationUsageDetector::class.java, Scope.JAVA_FILE_SCOPE)
)
}
}
diff --git a/lint-checks/src/test/java/androidx/build/lint/BanTargetApiAnnotationTest.kt b/lint-checks/src/test/java/androidx/build/lint/TargetApiAnnotationDetectorTest.kt
similarity index 75%
rename from lint-checks/src/test/java/androidx/build/lint/BanTargetApiAnnotationTest.kt
rename to lint-checks/src/test/java/androidx/build/lint/TargetApiAnnotationDetectorTest.kt
index 49429e0..5ccf192 100644
--- a/lint-checks/src/test/java/androidx/build/lint/BanTargetApiAnnotationTest.kt
+++ b/lint-checks/src/test/java/androidx/build/lint/TargetApiAnnotationDetectorTest.kt
@@ -23,9 +23,9 @@
import org.junit.runners.JUnit4
@RunWith(JUnit4::class)
-class BanTargetApiAnnotationTest : AbstractLintDetectorTest(
- useDetector = BanTargetApiAnnotation(),
- useIssues = listOf(BanTargetApiAnnotation.ISSUE),
+class TargetApiAnnotationDetectorTest : AbstractLintDetectorTest(
+ useDetector = TargetApiAnnotationUsageDetector(),
+ useIssues = listOf(TargetApiAnnotationUsageDetector.ISSUE),
) {
@Test
@@ -36,10 +36,10 @@
/* ktlint-disable max-line-length */
val expected = """
-src/androidx/TargetApiUsageJava.java:22: Error: Uses @TargetApi annotation [BanTargetApiAnnotation]
+src/androidx/TargetApiUsageJava.java:22: Error: Use @RequiresApi instead of @TargetApi [BanTargetApiAnnotation]
@TargetApi(29)
~~~~~~~~~~~~~~
-src/androidx/TargetApiUsageJava.java:25: Error: Uses @TargetApi annotation [BanTargetApiAnnotation]
+src/androidx/TargetApiUsageJava.java:25: Error: Use @RequiresApi instead of @TargetApi [BanTargetApiAnnotation]
@TargetApi(30)
~~~~~~~~~~~~~~
2 errors, 0 warnings
diff --git a/lint-checks/src/test/java/androidx/build/lint/TargetApiAnnotationUsageDetectorTest.kt b/lint-checks/src/test/java/androidx/build/lint/TargetApiAnnotationUsageDetectorTest.kt
new file mode 100644
index 0000000..5bf4605
--- /dev/null
+++ b/lint-checks/src/test/java/androidx/build/lint/TargetApiAnnotationUsageDetectorTest.kt
@@ -0,0 +1,156 @@
+/*
+ * Copyright 2021 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.
+ */
+
+@file:Suppress("UnstableApiUsage")
+
+package androidx.build.lint
+
+import com.android.tools.lint.checks.infrastructure.LintDetectorTest
+import com.android.tools.lint.checks.infrastructure.TestFile
+import com.android.tools.lint.checks.infrastructure.TestLintResult
+import com.android.tools.lint.detector.api.Detector
+import com.android.tools.lint.detector.api.Issue
+
+import org.junit.Test
+
+class TargetApiAnnotationUsageDetectorTest : LintDetectorTest() {
+ override fun getDetector(): Detector = TargetApiAnnotationUsageDetector()
+
+ override fun getIssues(): List<Issue> = listOf(
+ TargetApiAnnotationUsageDetector.ISSUE
+ )
+
+ private fun check(testFile: TestFile): TestLintResult {
+ return lint().files(
+ java(annotationSource),
+ testFile
+ ).run()
+ }
+
+ private val annotationSource = """
+package android.annotation;
+
+import static java.lang.annotation.ElementType.CONSTRUCTOR;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target({TYPE, METHOD, CONSTRUCTOR})
+@Retention(RetentionPolicy.CLASS)
+public @interface TargetApi {
+ int value();
+}
+ """.trimIndent()
+
+ @Test
+ fun testAnnotationUsageJava() {
+ val input = java(
+ """
+package androidx.sample;
+
+import android.annotation.TargetApi;
+
+@TargetApi(24)
+public class SampleClass {
+ @TargetApi(15)
+ public void method() {
+ // Stub
+ }
+}
+ """.trimIndent()
+ )
+
+ /* ktlint-disable max-line-length */
+ val expected = """
+src/androidx/sample/SampleClass.java:5: Error: Use @RequiresApi instead of @TargetApi [BanTargetApiAnnotation]
+@TargetApi(24)
+~~~~~~~~~~~~~~
+src/androidx/sample/SampleClass.java:7: Error: Use @RequiresApi instead of @TargetApi [BanTargetApiAnnotation]
+ @TargetApi(15)
+ ~~~~~~~~~~~~~~
+2 errors, 0 warnings
+ """.trimIndent()
+ /* ktlint-enable max-line-length */
+
+ /* ktlint-disable max-line-length */
+ val expectFixDiffs = """
+Fix for src/androidx/sample/SampleClass.java line 5: Replace with `@RequiresApi`:
+@@ -5 +5
+- @TargetApi(24)
++ @androidx.annotation.RequiresApi(24)
+Fix for src/androidx/sample/SampleClass.java line 7: Replace with `@RequiresApi`:
+@@ -7 +7
+- @TargetApi(15)
++ @androidx.annotation.RequiresApi(15)
+ """.trimIndent()
+ /* ktlint-enable max-line-length */
+
+ check(input)
+ .expect(expected)
+ .expectFixDiffs(expectFixDiffs)
+ }
+
+ @Test
+ fun testAnnotationUsageKt() {
+ val input = kotlin(
+ """
+package androidx.sample
+
+import android.annotation.TargetApi
+
+@TargetApi(24)
+class SampleClass {
+ @TargetApi(15)
+ fun method() {
+ // Stub
+ }
+}
+ """.trimIndent()
+ )
+
+ /* ktlint-disable max-line-length */
+ val expected = """
+src/androidx/sample/SampleClass.kt:5: Error: Use @RequiresApi instead of @TargetApi [BanTargetApiAnnotation]
+@TargetApi(24)
+~~~~~~~~~~~~~~
+src/androidx/sample/SampleClass.kt:7: Error: Use @RequiresApi instead of @TargetApi [BanTargetApiAnnotation]
+ @TargetApi(15)
+ ~~~~~~~~~~~~~~
+2 errors, 0 warnings
+ """.trimIndent()
+ /* ktlint-enable max-line-length */
+
+ /* ktlint-disable max-line-length */
+ val expectFixDiffs = """
+Fix for src/androidx/sample/SampleClass.kt line 5: Replace with `@RequiresApi`:
+@@ -5 +5
+- @TargetApi(24)
++ @androidx.annotation.RequiresApi(24)
+Fix for src/androidx/sample/SampleClass.kt line 7: Replace with `@RequiresApi`:
+@@ -7 +7
+- @TargetApi(15)
++ @androidx.annotation.RequiresApi(15)
+ """.trimIndent()
+ /* ktlint-enable max-line-length */
+
+ check(input)
+ .expect(expected)
+ .expectFixDiffs(expectFixDiffs)
+ }
+}
diff --git a/lint-demos/lint-demo-appcompat/build.gradle b/lint-demos/lint-demo-appcompat/build.gradle
index bc9e2d70..0f821f9 100644
--- a/lint-demos/lint-demo-appcompat/build.gradle
+++ b/lint-demos/lint-demo-appcompat/build.gradle
@@ -1,5 +1,3 @@
-import static androidx.build.dependencies.DependenciesKt.KOTLIN_STDLIB
-
plugins {
id("AndroidXPlugin")
id("com.android.application")
@@ -9,13 +7,12 @@
dependencies {
implementation(project(":appcompat:appcompat"))
implementation(project(":core:core"))
- api(KOTLIN_STDLIB)
+ api(libs.kotlinStdlib)
}
android {
defaultConfig {
vectorDrawables.useSupportLibrary = true
- minSdkVersion=14
}
lintOptions {
disable "WrongThread"
diff --git a/loader/loader-ktx/build.gradle b/loader/loader-ktx/build.gradle
index 12f8e80..eced1e8 100644
--- a/loader/loader-ktx/build.gradle
+++ b/loader/loader-ktx/build.gradle
@@ -14,9 +14,7 @@
* limitations under the License.
*/
-import static androidx.build.dependencies.DependenciesKt.*
import androidx.build.LibraryGroups
-import androidx.build.LibraryVersions
import androidx.build.Publish
plugins {
@@ -30,17 +28,17 @@
api("androidx.lifecycle:lifecycle-viewmodel-ktx:2.0.0") {
because "Mirror loader dependency graph for -ktx artifacts"
}
- api(KOTLIN_STDLIB)
+ api(libs.kotlinStdlib)
- androidTestImplementation(TRUTH)
+ androidTestImplementation(libs.truth)
androidTestImplementation(project(":lifecycle:lifecycle-runtime-testing"))
- androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
- androidTestImplementation(ANDROIDX_TEST_CORE)
- androidTestImplementation(ANDROIDX_TEST_RUNNER)
- androidTestImplementation(ANDROIDX_TEST_RULES)
- androidTestImplementation(ESPRESSO_CORE, excludes.espresso)
- androidTestImplementation(MOCKITO_CORE, excludes.bytebuddy) // DexMaker has it"s own MockMaker
- androidTestImplementation(DEXMAKER_MOCKITO, excludes.bytebuddy) // DexMaker has it"s own MockMaker
+ androidTestImplementation(libs.testExtJunit)
+ androidTestImplementation(libs.testCore)
+ androidTestImplementation(libs.testRunner)
+ androidTestImplementation(libs.testRules)
+ androidTestImplementation(libs.espressoCore, excludes.espresso)
+ androidTestImplementation(libs.mockitoCore, excludes.bytebuddy) // DexMaker has it"s own MockMaker
+ androidTestImplementation(libs.dexmakerMockito, excludes.bytebuddy) // DexMaker has it"s own MockMaker
}
androidx {
diff --git a/loader/loader/build.gradle b/loader/loader/build.gradle
index 48be3ec..a663653 100644
--- a/loader/loader/build.gradle
+++ b/loader/loader/build.gradle
@@ -1,6 +1,4 @@
-import static androidx.build.dependencies.DependenciesKt.*
import androidx.build.LibraryGroups
-import androidx.build.LibraryVersions
import androidx.build.Publish
plugins {
@@ -16,13 +14,13 @@
implementation("androidx.lifecycle:lifecycle-livedata-core:2.0.0")
androidTestImplementation(project(":lifecycle:lifecycle-runtime-testing"))
- androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
- androidTestImplementation(ANDROIDX_TEST_CORE)
- androidTestImplementation(ANDROIDX_TEST_RUNNER)
- androidTestImplementation(ANDROIDX_TEST_RULES)
- androidTestImplementation(ESPRESSO_CORE, excludes.espresso)
- androidTestImplementation(MOCKITO_CORE, excludes.bytebuddy) // DexMaker has it"s own MockMaker
- androidTestImplementation(DEXMAKER_MOCKITO, excludes.bytebuddy) // DexMaker has it"s own MockMaker
+ androidTestImplementation(libs.testExtJunit)
+ androidTestImplementation(libs.testCore)
+ androidTestImplementation(libs.testRunner)
+ androidTestImplementation(libs.testRules)
+ androidTestImplementation(libs.espressoCore, excludes.espresso)
+ androidTestImplementation(libs.mockitoCore, excludes.bytebuddy) // DexMaker has it"s own MockMaker
+ androidTestImplementation(libs.dexmakerMockito, excludes.bytebuddy) // DexMaker has it"s own MockMaker
}
androidx {
diff --git a/localbroadcastmanager/localbroadcastmanager/build.gradle b/localbroadcastmanager/localbroadcastmanager/build.gradle
index 01409e3..c34098b 100644
--- a/localbroadcastmanager/localbroadcastmanager/build.gradle
+++ b/localbroadcastmanager/localbroadcastmanager/build.gradle
@@ -1,5 +1,4 @@
import androidx.build.LibraryGroups
-import androidx.build.LibraryVersions
import androidx.build.Publish
plugins {
diff --git a/palette/palette-ktx/build.gradle b/palette/palette-ktx/build.gradle
index 63348d94..620ce86 100644
--- a/palette/palette-ktx/build.gradle
+++ b/palette/palette-ktx/build.gradle
@@ -14,9 +14,7 @@
* limitations under the License.
*/
-import static androidx.build.dependencies.DependenciesKt.*
import androidx.build.LibraryGroups
-import androidx.build.LibraryVersions
import androidx.build.Publish
plugins {
@@ -27,11 +25,11 @@
dependencies {
api(project(":palette:palette"))
- api(KOTLIN_STDLIB)
- androidTestImplementation(JUNIT)
- androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
- androidTestImplementation(ANDROIDX_TEST_CORE)
- androidTestImplementation(ANDROIDX_TEST_RUNNER)
+ api(libs.kotlinStdlib)
+ androidTestImplementation(libs.junit)
+ androidTestImplementation(libs.testExtJunit)
+ androidTestImplementation(libs.testCore)
+ androidTestImplementation(libs.testRunner)
}
androidx {
diff --git a/palette/palette/build.gradle b/palette/palette/build.gradle
index 4291c4b..8117192 100644
--- a/palette/palette/build.gradle
+++ b/palette/palette/build.gradle
@@ -1,6 +1,4 @@
-import static androidx.build.dependencies.DependenciesKt.*
import androidx.build.LibraryGroups
-import androidx.build.LibraryVersions
import androidx.build.Publish
plugins {
@@ -12,11 +10,11 @@
api("androidx.core:core:1.1.0")
implementation("androidx.collection:collection:1.1.0")
- annotationProcessor(NULLAWAY)
+ annotationProcessor(libs.nullaway)
- androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
- androidTestImplementation(ANDROIDX_TEST_CORE)
- androidTestImplementation(ANDROIDX_TEST_RUNNER)
+ androidTestImplementation(libs.testExtJunit)
+ androidTestImplementation(libs.testCore)
+ androidTestImplementation(libs.testRunner)
}
androidx {
diff --git a/percentlayout/percentlayout/build.gradle b/percentlayout/percentlayout/build.gradle
index bc6a65e..58db58d 100644
--- a/percentlayout/percentlayout/build.gradle
+++ b/percentlayout/percentlayout/build.gradle
@@ -1,6 +1,4 @@
-import static androidx.build.dependencies.DependenciesKt.*
import androidx.build.LibraryGroups
-import androidx.build.LibraryVersions
import androidx.build.Publish
plugins {
@@ -12,11 +10,11 @@
api("androidx.annotation:annotation:1.1.0")
implementation("androidx.core:core:1.1.0")
- androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
- androidTestImplementation(ANDROIDX_TEST_CORE)
- androidTestImplementation(ANDROIDX_TEST_RUNNER)
- androidTestImplementation(ANDROIDX_TEST_RULES)
- androidTestImplementation(ESPRESSO_CORE, excludes.espresso)
+ androidTestImplementation(libs.testExtJunit)
+ androidTestImplementation(libs.testCore)
+ androidTestImplementation(libs.testRunner)
+ androidTestImplementation(libs.testRules)
+ androidTestImplementation(libs.espressoCore, excludes.espresso)
}
android {
diff --git a/placeholder-tests/build.gradle b/placeholder-tests/build.gradle
index 863ce958..f96a629c6 100644
--- a/placeholder-tests/build.gradle
+++ b/placeholder-tests/build.gradle
@@ -14,19 +14,17 @@
* limitations under the License.
*/
-import static androidx.build.dependencies.DependenciesKt.*
-
plugins {
id("AndroidXPlugin")
id("com.android.library")
}
dependencies {
- testImplementation(JUNIT)
- androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
- androidTestImplementation(ANDROIDX_TEST_CORE)
- androidTestImplementation(ANDROIDX_TEST_RUNNER)
- androidTestImplementation(ANDROIDX_TEST_RULES)
+ testImplementation(libs.junit)
+ androidTestImplementation(libs.testExtJunit)
+ androidTestImplementation(libs.testCore)
+ androidTestImplementation(libs.testRunner)
+ androidTestImplementation(libs.testRules)
}
androidx {
diff --git a/preference/preference-ktx/build.gradle b/preference/preference-ktx/build.gradle
index ef77225..aee756e 100644
--- a/preference/preference-ktx/build.gradle
+++ b/preference/preference-ktx/build.gradle
@@ -14,11 +14,7 @@
* limitations under the License.
*/
-
import androidx.build.LibraryGroups
-import androidx.build.LibraryVersions
-
-import static androidx.build.dependencies.DependenciesKt.*
import androidx.build.Publish
plugins {
@@ -35,14 +31,14 @@
api("androidx.fragment:fragment-ktx:1.2.4") {
because "Mirror preference dependency graph for -ktx artifacts"
}
- api(KOTLIN_STDLIB)
+ api(libs.kotlinStdlib)
- androidTestImplementation(JUNIT)
- androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
- androidTestImplementation(ANDROIDX_TEST_CORE)
- androidTestImplementation(ANDROIDX_TEST_RUNNER)
- androidTestImplementation(ANDROIDX_TEST_RULES)
- androidTestImplementation(TRUTH)
+ androidTestImplementation(libs.junit)
+ androidTestImplementation(libs.testExtJunit)
+ androidTestImplementation(libs.testCore)
+ androidTestImplementation(libs.testRunner)
+ androidTestImplementation(libs.testRules)
+ androidTestImplementation(libs.truth)
androidTestImplementation(project(":internal-testutils-truth"))
}
diff --git a/preference/preference/build.gradle b/preference/preference/build.gradle
index 766ba71..49a29bf 100644
--- a/preference/preference/build.gradle
+++ b/preference/preference/build.gradle
@@ -14,9 +14,7 @@
* limitations under the License
*/
-import static androidx.build.dependencies.DependenciesKt.*
import androidx.build.LibraryGroups
-import androidx.build.LibraryVersions
import androidx.build.Publish
plugins {
@@ -34,16 +32,16 @@
api("androidx.fragment:fragment:1.2.4")
api("androidx.recyclerview:recyclerview:1.0.0")
- androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
- androidTestImplementation(ANDROIDX_TEST_CORE)
- androidTestImplementation(ANDROIDX_TEST_RUNNER)
- androidTestImplementation(ANDROIDX_TEST_RULES)
- androidTestImplementation(ESPRESSO_CORE, excludes.espresso)
- androidTestImplementation(MOCKITO_CORE, excludes.bytebuddy) // DexMaker has it"s own MockMaker
- androidTestImplementation(DEXMAKER_MOCKITO, excludes.bytebuddy) // DexMaker has it"s own MockMaker
- androidTestImplementation(KOTLIN_STDLIB)
- androidTestImplementation(TRUTH)
- androidTestImplementation(MULTIDEX)
+ androidTestImplementation(libs.testExtJunit)
+ androidTestImplementation(libs.testCore)
+ androidTestImplementation(libs.testRunner)
+ androidTestImplementation(libs.testRules)
+ androidTestImplementation(libs.espressoCore, excludes.espresso)
+ androidTestImplementation(libs.mockitoCore, excludes.bytebuddy) // DexMaker has it"s own MockMaker
+ androidTestImplementation(libs.dexmakerMockito, excludes.bytebuddy) // DexMaker has it"s own MockMaker
+ androidTestImplementation(libs.kotlinStdlib)
+ androidTestImplementation(libs.truth)
+ androidTestImplementation(libs.multidex)
}
android {
diff --git a/print/print/build.gradle b/print/print/build.gradle
index 5b663ae..2b1b2e0 100644
--- a/print/print/build.gradle
+++ b/print/print/build.gradle
@@ -1,5 +1,4 @@
import androidx.build.LibraryGroups
-import androidx.build.LibraryVersions
import androidx.build.Publish
plugins {
diff --git a/profileinstaller/integration-tests/init-macrobenchmark-target/build.gradle b/profileinstaller/integration-tests/init-macrobenchmark-target/build.gradle
index 411e5df..f97eac2 100644
--- a/profileinstaller/integration-tests/init-macrobenchmark-target/build.gradle
+++ b/profileinstaller/integration-tests/init-macrobenchmark-target/build.gradle
@@ -14,8 +14,6 @@
* limitations under the License.
*/
-import static androidx.build.dependencies.DependenciesKt.*
-
plugins {
id("AndroidXPlugin")
id("com.android.application")
@@ -33,6 +31,6 @@
}
dependencies {
- implementation(KOTLIN_STDLIB)
+ implementation(libs.kotlinStdlib)
implementation(project(":profileinstaller:profileinstaller"))
}
diff --git a/profileinstaller/integration-tests/init-macrobenchmark/build.gradle b/profileinstaller/integration-tests/init-macrobenchmark/build.gradle
index 33e00c2..ce6d30f 100644
--- a/profileinstaller/integration-tests/init-macrobenchmark/build.gradle
+++ b/profileinstaller/integration-tests/init-macrobenchmark/build.gradle
@@ -14,13 +14,6 @@
* limitations under the License.
*/
-
-import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
-
-import static androidx.build.dependencies.DependenciesKt.*
-import androidx.build.LibraryGroups
-import androidx.build.Publish
-
plugins {
id("AndroidXPlugin")
id("com.android.library")
@@ -37,10 +30,10 @@
androidTestImplementation(project(":profileinstaller:profileinstaller"))
androidTestImplementation(project(":benchmark:benchmark-macro-junit4"))
androidTestImplementation(project(":internal-testutils-macrobenchmark"))
- androidTestImplementation(ANDROIDX_TEST_RULES)
- androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
- androidTestImplementation(ANDROIDX_TEST_CORE)
- androidTestImplementation(ANDROIDX_TEST_RUNNER)
+ androidTestImplementation(libs.testRules)
+ androidTestImplementation(libs.testExtJunit)
+ androidTestImplementation(libs.testCore)
+ androidTestImplementation(libs.testRunner)
}
def installReleaseTarget = tasks.getByPath(
diff --git a/profileinstaller/integration-tests/testapp/build.gradle b/profileinstaller/integration-tests/testapp/build.gradle
index ed77236..7133f18 100644
--- a/profileinstaller/integration-tests/testapp/build.gradle
+++ b/profileinstaller/integration-tests/testapp/build.gradle
@@ -14,8 +14,6 @@
* limitations under the License.
*/
-import static androidx.build.dependencies.DependenciesKt.*
-
plugins {
id("AndroidXPlugin")
id("AndroidXUiPlugin")
@@ -26,7 +24,7 @@
dependencies {
kotlinPlugin(project(":compose:compiler:compiler"))
- implementation(KOTLIN_STDLIB)
+ implementation(libs.kotlinStdlib)
implementation(project(":compose:androidview:androidview"))
implementation(project(":compose:foundation:foundation"))
implementation(project(":compose:foundation:foundation-layout"))
@@ -35,11 +33,11 @@
implementation(project(":compose:runtime:runtime"))
implementation(project(":compose:ui:ui"))
- implementation(KOTLIN_STDLIB)
+ implementation(libs.kotlinStdlib)
implementation(project(":activity:activity-compose"))
implementation(project(":profileinstaller:profileinstaller"))
androidTestImplementation(project(":compose:ui:ui-test-junit4"))
- androidTestImplementation(ANDROIDX_TEST_RUNNER)
+ androidTestImplementation(libs.testRunner)
}
android {
@@ -50,9 +48,6 @@
checkReleaseBuilds false
}
buildTypes {
- debug {
-
- }
release {
minifyEnabled true
}
diff --git a/profileinstaller/profileinstaller-benchmark/build.gradle b/profileinstaller/profileinstaller-benchmark/build.gradle
index e4dd92d..d49dd89 100644
--- a/profileinstaller/profileinstaller-benchmark/build.gradle
+++ b/profileinstaller/profileinstaller-benchmark/build.gradle
@@ -17,8 +17,6 @@
import androidx.build.LibraryGroups
import androidx.build.Publish
-import static androidx.build.dependencies.DependenciesKt.*
-
plugins {
id("AndroidXPlugin")
id("com.android.library")
@@ -29,15 +27,15 @@
dependencies {
androidTestImplementation(project(":profileinstaller:profileinstaller"))
androidTestImplementation(projectOrArtifact(":benchmark:benchmark-junit4"))
- androidTestImplementation(JUNIT)
- androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
- androidTestImplementation(ANDROIDX_TEST_CORE)
- androidTestImplementation(ANDROIDX_TEST_RUNNER)
- androidTestImplementation(ANDROIDX_TEST_RULES)
- androidTestImplementation(MOCKITO_CORE, excludes.bytebuddy) // DexMaker has it"s own MockMaker
- androidTestImplementation(DEXMAKER_MOCKITO, excludes.bytebuddy) // DexMaker has it"s own MockMaker
+ androidTestImplementation(libs.junit)
+ androidTestImplementation(libs.testExtJunit)
+ androidTestImplementation(libs.testCore)
+ androidTestImplementation(libs.testRunner)
+ androidTestImplementation(libs.testRules)
+ androidTestImplementation(libs.mockitoCore, excludes.bytebuddy) // DexMaker has it"s own MockMaker
+ androidTestImplementation(libs.dexmakerMockito, excludes.bytebuddy) // DexMaker has it"s own MockMaker
androidTestImplementation project(':internal-testutils-runtime')
- androidTestImplementation(KOTLIN_STDLIB)
+ androidTestImplementation(libs.kotlinStdlib)
}
androidx {
diff --git a/profileinstaller/profileinstaller/build.gradle b/profileinstaller/profileinstaller/build.gradle
index e939335..5fdef63 100644
--- a/profileinstaller/profileinstaller/build.gradle
+++ b/profileinstaller/profileinstaller/build.gradle
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import static androidx.build.dependencies.DependenciesKt.*
+
import androidx.build.LibraryGroups
import androidx.build.LibraryType
import androidx.build.LibraryVersions
@@ -24,11 +24,11 @@
}
dependencies {
- annotationProcessor(NULLAWAY)
+ annotationProcessor(libs.nullaway)
api("androidx.startup:startup-runtime:1.0.0")
implementation("androidx.annotation:annotation:1.2.0")
- testImplementation(JUNIT)
- testImplementation(TRUTH)
+ testImplementation(libs.junit)
+ testImplementation(libs.truth)
}
androidx {
diff --git a/recommendation/recommendation/build.gradle b/recommendation/recommendation/build.gradle
index e6702ce..041450c 100644
--- a/recommendation/recommendation/build.gradle
+++ b/recommendation/recommendation/build.gradle
@@ -1,5 +1,4 @@
import androidx.build.LibraryGroups
-import androidx.build.LibraryVersions
import androidx.build.Publish
plugins {
diff --git a/remotecallback/processor/build.gradle b/remotecallback/processor/build.gradle
index a5d387f..de0f94a 100644
--- a/remotecallback/processor/build.gradle
+++ b/remotecallback/processor/build.gradle
@@ -17,8 +17,6 @@
import androidx.build.LibraryGroups
import androidx.build.LibraryType
-import static androidx.build.dependencies.DependenciesKt.JAVAPOET
-
plugins {
id("AndroidXPlugin")
id("java-library")
@@ -26,7 +24,7 @@
dependencies {
api("androidx.annotation:annotation:1.1.0")
- implementation(JAVAPOET)
+ implementation(libs.javapoet)
}
androidx {
diff --git a/remotecallback/remotecallback/build.gradle b/remotecallback/remotecallback/build.gradle
index a0ad9c0..284e75f 100644
--- a/remotecallback/remotecallback/build.gradle
+++ b/remotecallback/remotecallback/build.gradle
@@ -14,10 +14,7 @@
* limitations under the License.
*/
-import static androidx.build.dependencies.DependenciesKt.*
-
import androidx.build.LibraryGroups
-import androidx.build.LibraryVersions
import androidx.build.Publish
plugins {
@@ -29,11 +26,11 @@
api("androidx.annotation:annotation:1.1.0")
implementation(project(":collection:collection"))
- androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
- androidTestImplementation(ANDROIDX_TEST_CORE)
- androidTestImplementation(ANDROIDX_TEST_RUNNER)
- androidTestImplementation(MOCKITO_CORE, excludes.bytebuddy)
- androidTestImplementation(DEXMAKER_MOCKITO, excludes.bytebuddy)
+ androidTestImplementation(libs.testExtJunit)
+ androidTestImplementation(libs.testCore)
+ androidTestImplementation(libs.testRunner)
+ androidTestImplementation(libs.mockitoCore, excludes.bytebuddy)
+ androidTestImplementation(libs.dexmakerMockito, excludes.bytebuddy)
androidTestAnnotationProcessor (project(":remotecallback:remotecallback-processor"))
}
diff --git a/samples/Support4Demos/build.gradle b/samples/Support4Demos/build.gradle
index ca6caec..ee14a35 100644
--- a/samples/Support4Demos/build.gradle
+++ b/samples/Support4Demos/build.gradle
@@ -1,5 +1,3 @@
-import static androidx.build.dependencies.DependenciesKt.*
-
plugins {
id("AndroidXPlugin")
id("com.android.application")
@@ -16,6 +14,6 @@
implementation(project(":fragment:fragment-ktx"))
implementation(project(":media:media"))
implementation(project(":viewpager:viewpager"))
- implementation(KOTLIN_STDLIB)
- implementation(KOTLIN_COROUTINES_ANDROID)
+ implementation(libs.kotlinStdlib)
+ implementation(libs.kotlinCoroutinesAndroid)
}
diff --git a/samples/Support7Demos/build.gradle b/samples/Support7Demos/build.gradle
index 6076b36..22f0706 100644
--- a/samples/Support7Demos/build.gradle
+++ b/samples/Support7Demos/build.gradle
@@ -1,6 +1,3 @@
-import static androidx.build.dependencies.DependenciesKt.KOTLIN_STDLIB
-import static androidx.build.dependencies.DependenciesKt.MATERIAL
-
plugins {
id("AndroidXPlugin")
id("com.android.application")
@@ -8,7 +5,7 @@
}
dependencies {
- api(KOTLIN_STDLIB)
+ api(libs.kotlinStdlib)
implementation(project(":appcompat:appcompat"))
implementation(project(":cardview:cardview"))
implementation(project(":drawerlayout:drawerlayout"))
@@ -18,7 +15,7 @@
implementation(project(":recyclerview:recyclerview"))
implementation(project(":recyclerview:recyclerview-selection"))
implementation("androidx.concurrent:concurrent-futures:1.1.0")
- api(MATERIAL)
+ api(libs.material)
}
android {
diff --git a/samples/SupportContentDemos/build.gradle b/samples/SupportContentDemos/build.gradle
index 515838b..dd39ef8 100644
--- a/samples/SupportContentDemos/build.gradle
+++ b/samples/SupportContentDemos/build.gradle
@@ -1,4 +1,3 @@
-
/*
* Copyright (C) 2017 The Android Open Source Project
*
@@ -15,15 +14,13 @@
* limitations under the License.
*/
-import static androidx.build.dependencies.DependenciesKt.MATERIAL
-
plugins {
id("AndroidXPlugin")
id("com.android.application")
}
dependencies {
- implementation(MATERIAL)
+ implementation(libs.material)
implementation(project(":transition:transition"))
implementation(project(":recyclerview:recyclerview"))
implementation(project(":appcompat:appcompat"))
@@ -32,10 +29,3 @@
implementation(project(":coordinatorlayout:coordinatorlayout"))
implementation(project(":core:core"))
}
-
-android {
- defaultConfig {
- applicationId "com.example.androidx.contentpager.content.demos"
- minSdkVersion 14
- }
-}
diff --git a/samples/SupportRemoteCallbackDemos/build.gradle b/samples/SupportRemoteCallbackDemos/build.gradle
index e5a97e9..f35b59c 100644
--- a/samples/SupportRemoteCallbackDemos/build.gradle
+++ b/samples/SupportRemoteCallbackDemos/build.gradle
@@ -14,8 +14,6 @@
* limitations under the License.
*/
-import static androidx.build.dependencies.DependenciesKt.*
-
plugins {
id("AndroidXPlugin")
id("com.android.application")
@@ -25,12 +23,11 @@
implementation(project(":remotecallback:remotecallback"))
implementation(project(":recyclerview:recyclerview"))
implementation(project(":appcompat:appcompat"))
- annotationProcessor project(":remotecallback:remotecallback-processor")
+ annotationProcessor(project(":remotecallback:remotecallback-processor"))
}
android {
defaultConfig {
minSdkVersion 19
- applicationId "com.example.androidx.remotecallback.demos"
}
}
diff --git a/samples/SupportSliceDemos/build.gradle b/samples/SupportSliceDemos/build.gradle
index 25d3955..992ff53 100644
--- a/samples/SupportSliceDemos/build.gradle
+++ b/samples/SupportSliceDemos/build.gradle
@@ -14,8 +14,6 @@
* limitations under the License.
*/
-import static androidx.build.dependencies.DependenciesKt.*
-
plugins {
id("AndroidXPlugin")
id("com.android.application")
@@ -36,6 +34,5 @@
android {
defaultConfig {
minSdkVersion 19
- applicationId "com.example.androidx.slice.demos"
}
}
diff --git a/savedstate/savedstate-ktx/build.gradle b/savedstate/savedstate-ktx/build.gradle
index 2529c48..9be2491 100644
--- a/savedstate/savedstate-ktx/build.gradle
+++ b/savedstate/savedstate-ktx/build.gradle
@@ -14,7 +14,6 @@
* limitations under the License.
*/
-import static androidx.build.dependencies.DependenciesKt.*
import androidx.build.LibraryGroups
import androidx.build.Publish
@@ -26,12 +25,12 @@
dependencies {
api(project(":savedstate:savedstate"))
- api(KOTLIN_STDLIB)
+ api(libs.kotlinStdlib)
- androidTestImplementation(TRUTH)
- androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
- androidTestImplementation(ANDROIDX_TEST_CORE)
- androidTestImplementation(ANDROIDX_TEST_RUNNER)
+ androidTestImplementation(libs.truth)
+ androidTestImplementation(libs.testExtJunit)
+ androidTestImplementation(libs.testCore)
+ androidTestImplementation(libs.testRunner)
}
androidx {
diff --git a/savedstate/savedstate/build.gradle b/savedstate/savedstate/build.gradle
index df5ca59..6b1280f 100644
--- a/savedstate/savedstate/build.gradle
+++ b/savedstate/savedstate/build.gradle
@@ -1,6 +1,4 @@
-import static androidx.build.dependencies.DependenciesKt.*
import androidx.build.LibraryGroups
-import androidx.build.LibraryVersions
import androidx.build.Publish
plugins {
@@ -20,13 +18,13 @@
implementation("androidx.arch.core:core-common:2.0.1")
implementation("androidx.lifecycle:lifecycle-common:2.0.0")
- androidTestImplementation(KOTLIN_STDLIB)
+ androidTestImplementation(libs.kotlinStdlib)
androidTestImplementation("androidx.lifecycle:lifecycle-runtime:2.0.0")
- androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
- androidTestImplementation(ANDROIDX_TEST_CORE)
- androidTestImplementation(ANDROIDX_TEST_RUNNER)
- androidTestImplementation(ANDROIDX_TEST_RULES)
- androidTestImplementation(TRUTH)
+ androidTestImplementation(libs.testExtJunit)
+ androidTestImplementation(libs.testCore)
+ androidTestImplementation(libs.testRunner)
+ androidTestImplementation(libs.testRules)
+ androidTestImplementation(libs.truth)
}
androidx {
diff --git a/security/crypto/build.gradle b/security/crypto/build.gradle
index 665ee42..5ac6cfe 100644
--- a/security/crypto/build.gradle
+++ b/security/crypto/build.gradle
@@ -14,7 +14,6 @@
* limitations under the License.
*/
-import static androidx.build.dependencies.DependenciesKt.*
import androidx.build.LibraryGroups
import androidx.build.LibraryVersions
import androidx.build.Publish
diff --git a/security/identity-credential/build.gradle b/security/identity-credential/build.gradle
index 677731a..4c3cd86 100644
--- a/security/identity-credential/build.gradle
+++ b/security/identity-credential/build.gradle
@@ -19,8 +19,6 @@
import androidx.build.Publish
import androidx.build.RunApiTasks
-import static androidx.build.dependencies.DependenciesKt.*
-
plugins {
id("AndroidXPlugin")
id("com.android.library")
@@ -34,11 +32,11 @@
implementation("org.bouncycastle:bcprov-jdk15on:1.65")
implementation("org.bouncycastle:bcpkix-jdk15on:1.56")
- androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
- androidTestImplementation(ANDROIDX_TEST_CORE)
- androidTestImplementation(ANDROIDX_TEST_RUNNER)
- androidTestImplementation(ANDROIDX_TEST_RULES)
- androidTestImplementation(MOCKITO_CORE)
+ androidTestImplementation(libs.testExtJunit)
+ androidTestImplementation(libs.testCore)
+ androidTestImplementation(libs.testRunner)
+ androidTestImplementation(libs.testRules)
+ androidTestImplementation(libs.mockitoCore)
}
android {
diff --git a/security/security-app-authenticator-testing/build.gradle b/security/security-app-authenticator-testing/build.gradle
index 5d92e64..4bee868 100644
--- a/security/security-app-authenticator-testing/build.gradle
+++ b/security/security-app-authenticator-testing/build.gradle
@@ -13,15 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
import androidx.build.LibraryGroups
import androidx.build.LibraryVersions
import androidx.build.LibraryType
-import androidx.build.Publish
-
-import static androidx.build.dependencies.DependenciesKt.ANDROIDX_TEST_CORE
-import static androidx.build.dependencies.DependenciesKt.ANDROIDX_TEST_EXT_JUNIT
-import static androidx.build.dependencies.DependenciesKt.ANDROIDX_TEST_RULES
-import static androidx.build.dependencies.DependenciesKt.ANDROIDX_TEST_RUNNER
plugins {
id("AndroidXPlugin")
@@ -33,10 +28,10 @@
implementation("androidx.collection:collection:1.1.0")
androidTestImplementation("junit:junit:4.13")
- androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
- androidTestImplementation(ANDROIDX_TEST_CORE)
- androidTestImplementation(ANDROIDX_TEST_RUNNER)
- androidTestImplementation(ANDROIDX_TEST_RULES)
+ androidTestImplementation(libs.testExtJunit)
+ androidTestImplementation(libs.testCore)
+ androidTestImplementation(libs.testRunner)
+ androidTestImplementation(libs.testRules)
}
android {
diff --git a/security/security-app-authenticator/build.gradle b/security/security-app-authenticator/build.gradle
index 186da78..e74c0c0 100644
--- a/security/security-app-authenticator/build.gradle
+++ b/security/security-app-authenticator/build.gradle
@@ -14,12 +14,9 @@
* limitations under the License.
*/
-import static androidx.build.dependencies.DependenciesKt.*
-
import androidx.build.LibraryGroups
import androidx.build.LibraryVersions
import androidx.build.LibraryType
-import androidx.build.Publish
plugins {
id("AndroidXPlugin")
@@ -28,23 +25,23 @@
dependencies {
api("androidx.annotation:annotation:1.1.0")
- implementation(AUTO_VALUE_ANNOTATIONS)
- annotationProcessor(AUTO_VALUE)
+ implementation(libs.autoValueAnnotations)
+ annotationProcessor(libs.autoValue)
implementation("androidx.collection:collection:1.1.0")
testImplementation("junit:junit:4.13")
- testImplementation(ANDROIDX_TEST_EXT_JUNIT)
- testImplementation(ANDROIDX_TEST_CORE)
- testImplementation(ANDROIDX_TEST_RUNNER)
- testImplementation(ANDROIDX_TEST_RULES)
- testImplementation(MOCKITO_CORE)
- testImplementation(ROBOLECTRIC)
+ testImplementation(libs.testExtJunit)
+ testImplementation(libs.testCore)
+ testImplementation(libs.testRunner)
+ testImplementation(libs.testRules)
+ testImplementation(libs.mockitoCore)
+ testImplementation(libs.robolectric)
androidTestImplementation("junit:junit:4.13")
- androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
- androidTestImplementation(ANDROIDX_TEST_CORE)
- androidTestImplementation(ANDROIDX_TEST_RUNNER)
- androidTestImplementation(ANDROIDX_TEST_RULES)
+ androidTestImplementation(libs.testExtJunit)
+ androidTestImplementation(libs.testCore)
+ androidTestImplementation(libs.testRunner)
+ androidTestImplementation(libs.testRules)
}
android {
diff --git a/security/security-biometric/build.gradle b/security/security-biometric/build.gradle
index bbaacbf..853e684 100644
--- a/security/security-biometric/build.gradle
+++ b/security/security-biometric/build.gradle
@@ -14,7 +14,6 @@
* limitations under the License.
*/
-import static androidx.build.dependencies.DependenciesKt.*
import androidx.build.LibraryGroups
import androidx.build.LibraryVersions
import androidx.build.Publish
@@ -30,11 +29,11 @@
implementation("com.google.crypto.tink:tink-android:1.3.0")
- androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
- androidTestImplementation(ANDROIDX_TEST_CORE)
- androidTestImplementation(ANDROIDX_TEST_RUNNER)
- androidTestImplementation(ANDROIDX_TEST_RULES)
- androidTestImplementation(MOCKITO_CORE)
+ androidTestImplementation(libs.testExtJunit)
+ androidTestImplementation(libs.testCore)
+ androidTestImplementation(libs.testRunner)
+ androidTestImplementation(libs.testRules)
+ androidTestImplementation(libs.mockitoCore)
}
diff --git a/security/security-crypto-ktx/build.gradle b/security/security-crypto-ktx/build.gradle
index f977990..a2ff661 100644
--- a/security/security-crypto-ktx/build.gradle
+++ b/security/security-crypto-ktx/build.gradle
@@ -14,7 +14,6 @@
* limitations under the License.
*/
-import static androidx.build.dependencies.DependenciesKt.*
import androidx.build.LibraryGroups
import androidx.build.LibraryVersions
import androidx.build.Publish
diff --git a/sharetarget/sharetarget/build.gradle b/sharetarget/sharetarget/build.gradle
index e911dca..8ef5b8a 100644
--- a/sharetarget/sharetarget/build.gradle
+++ b/sharetarget/sharetarget/build.gradle
@@ -14,9 +14,7 @@
* limitations under the License.
*/
-import static androidx.build.dependencies.DependenciesKt.*
import androidx.build.LibraryGroups
-import androidx.build.LibraryVersions
import androidx.build.Publish
plugins {
@@ -27,15 +25,15 @@
dependencies {
api("androidx.core:core:1.3.2")
api("androidx.collection:collection:1.1.0")
- api(GUAVA_LISTENABLE_FUTURE)
+ api(libs.guavaListenableFuture)
implementation("androidx.concurrent:concurrent-futures:1.0.0")
- androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
- androidTestImplementation(ANDROIDX_TEST_CORE)
- androidTestImplementation(ANDROIDX_TEST_RUNNER)
- androidTestImplementation(ANDROIDX_TEST_RULES)
- androidTestImplementation(MOCKITO_CORE, excludes.bytebuddy) // DexMaker has it"s own MockMaker
- androidTestImplementation(DEXMAKER_MOCKITO, excludes.bytebuddy) // DexMaker has it"s own MockMaker
+ androidTestImplementation(libs.testExtJunit)
+ androidTestImplementation(libs.testCore)
+ androidTestImplementation(libs.testRunner)
+ androidTestImplementation(libs.testRules)
+ androidTestImplementation(libs.mockitoCore, excludes.bytebuddy) // DexMaker has it"s own MockMaker
+ androidTestImplementation(libs.dexmakerMockito, excludes.bytebuddy) // DexMaker has it"s own MockMaker
}
androidx {
diff --git a/slices/view/lint-baseline.xml b/slices/view/lint-baseline.xml
index 8ed559b..113cd8b 100644
--- a/slices/view/lint-baseline.xml
+++ b/slices/view/lint-baseline.xml
@@ -13,17 +13,6 @@
</issue>
<issue
- id="BanTargetApiAnnotation"
- message="Uses @TargetApi annotation"
- errorLine1=" @TargetApi(Build.VERSION_CODES.LOLLIPOP)"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/main/java/androidx/slice/widget/LocationBasedViewTracker.java"
- line="47"
- column="5"/>
- </issue>
-
- <issue
id="ClassVerificationFailure"
message="This call references a method added in API level 20; however, the containing class androidx.slice.widget.ActionRow is reachable from earlier API levels and will fail run-time class verification."
errorLine1=" if (input.getRemoteInput().getAllowFreeFormInput()) {"
diff --git a/slices/view/src/main/java/androidx/slice/widget/LocationBasedViewTracker.java b/slices/view/src/main/java/androidx/slice/widget/LocationBasedViewTracker.java
index a35b944..b1b3c18 100644
--- a/slices/view/src/main/java/androidx/slice/widget/LocationBasedViewTracker.java
+++ b/slices/view/src/main/java/androidx/slice/widget/LocationBasedViewTracker.java
@@ -18,7 +18,6 @@
import static android.view.accessibility.AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS;
-import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Rect;
import android.os.Build;
@@ -26,6 +25,7 @@
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityManager;
+import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import java.util.ArrayList;
@@ -44,7 +44,7 @@
}
};
- @TargetApi(Build.VERSION_CODES.LOLLIPOP)
+ @RequiresApi(Build.VERSION_CODES.LOLLIPOP)
private static final SelectionLogic A11Y_FOCUS = new SelectionLogic() {
@Override
public void selectView(View view) {
diff --git a/startup/integration-tests/first-library/build.gradle b/startup/integration-tests/first-library/build.gradle
index 59ce01d..c9f27d1 100644
--- a/startup/integration-tests/first-library/build.gradle
+++ b/startup/integration-tests/first-library/build.gradle
@@ -14,26 +14,22 @@
* limitations under the License.
*/
-import static androidx.build.dependencies.DependenciesKt.*
-
plugins {
id("AndroidXPlugin")
id("com.android.library")
id("kotlin-android")
}
-project.ext.noDocs = true
-
dependencies {
- api(KOTLIN_STDLIB)
+ api(libs.kotlinStdlib)
implementation(project(":startup:startup-runtime"))
implementation(project(":work:work-runtime-ktx"))
- androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
- androidTestImplementation(ANDROIDX_TEST_CORE)
- androidTestImplementation(ANDROIDX_TEST_RUNNER)
- androidTestImplementation(ESPRESSO_CORE)
- androidTestImplementation(MOCKITO_CORE, excludes.bytebuddy) // DexMaker has its own MockMaker
- androidTestImplementation(DEXMAKER_MOCKITO, excludes.bytebuddy) // DexMaker has its own MockMaker
- testImplementation(JUNIT)
+ androidTestImplementation(libs.testExtJunit)
+ androidTestImplementation(libs.testCore)
+ androidTestImplementation(libs.testRunner)
+ androidTestImplementation(libs.espressoCore)
+ androidTestImplementation(libs.mockitoCore, excludes.bytebuddy) // DexMaker has its own MockMaker
+ androidTestImplementation(libs.dexmakerMockito, excludes.bytebuddy) // DexMaker has its own MockMaker
+ testImplementation(libs.junit)
}
diff --git a/startup/integration-tests/second-library/build.gradle b/startup/integration-tests/second-library/build.gradle
index 760958b..2102ffe 100644
--- a/startup/integration-tests/second-library/build.gradle
+++ b/startup/integration-tests/second-library/build.gradle
@@ -14,25 +14,21 @@
* limitations under the License.
*/
-import static androidx.build.dependencies.DependenciesKt.*
-
plugins {
id("AndroidXPlugin")
id("com.android.library")
id("kotlin-android")
}
-project.ext.noDocs = true
-
dependencies {
- api(KOTLIN_STDLIB)
+ api(libs.kotlinStdlib)
implementation(project(":startup:startup-runtime"))
implementation(project(":startup:integration-tests:first-library"))
- androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
- androidTestImplementation(ANDROIDX_TEST_CORE)
- androidTestImplementation(ANDROIDX_TEST_RUNNER)
- androidTestImplementation(ESPRESSO_CORE)
- androidTestImplementation(MOCKITO_CORE, excludes.bytebuddy) // DexMaker has its own MockMaker
- androidTestImplementation(DEXMAKER_MOCKITO, excludes.bytebuddy) // DexMaker has its own MockMaker
- testImplementation(JUNIT)
+ androidTestImplementation(libs.testExtJunit)
+ androidTestImplementation(libs.testCore)
+ androidTestImplementation(libs.testRunner)
+ androidTestImplementation(libs.espressoCore)
+ androidTestImplementation(libs.mockitoCore, excludes.bytebuddy) // DexMaker has its own MockMaker
+ androidTestImplementation(libs.dexmakerMockito, excludes.bytebuddy) // DexMaker has its own MockMaker
+ testImplementation(libs.junit)
}
diff --git a/startup/integration-tests/test-app/build.gradle b/startup/integration-tests/test-app/build.gradle
index c6ca6df..833c186 100644
--- a/startup/integration-tests/test-app/build.gradle
+++ b/startup/integration-tests/test-app/build.gradle
@@ -22,8 +22,6 @@
id("kotlin-android")
}
-project.ext.noDocs = true
-
android {
buildTypes {
getByName("release") {
@@ -33,7 +31,7 @@
}
dependencies {
- implementation(KOTLIN_STDLIB)
+ implementation(libs.kotlinStdlib)
implementation(project(":startup:integration-tests:first-library"))
implementation(project(":startup:integration-tests:second-library"))
implementation(CONSTRAINT_LAYOUT, { transitive = true })
diff --git a/startup/startup-runtime-lint/build.gradle b/startup/startup-runtime-lint/build.gradle
index 22a35542..a5e584b 100644
--- a/startup/startup-runtime-lint/build.gradle
+++ b/startup/startup-runtime-lint/build.gradle
@@ -17,21 +17,19 @@
import androidx.build.LibraryType
import androidx.build.LibraryVersions
-import static androidx.build.dependencies.DependenciesKt.*
-
plugins {
id("AndroidXPlugin")
id("kotlin")
}
dependencies {
- compileOnly(LINT_API_MIN)
- compileOnly(KOTLIN_STDLIB)
+ compileOnly(libs.androidLintMinApi)
+ compileOnly(libs.kotlinStdlib)
- testImplementation(KOTLIN_STDLIB)
- testImplementation(LINT_CORE)
- testImplementation(LINT_TESTS)
- testImplementation(JUNIT)
+ testImplementation(libs.kotlinStdlib)
+ testImplementation(libs.androidLint)
+ testImplementation(libs.androidLintTests)
+ testImplementation(libs.junit)
}
androidx {
diff --git a/startup/startup-runtime/build.gradle b/startup/startup-runtime/build.gradle
index 315f1ee..2e98baa 100644
--- a/startup/startup-runtime/build.gradle
+++ b/startup/startup-runtime/build.gradle
@@ -14,13 +14,9 @@
* limitations under the License.
*/
-
-import androidx.build.AndroidXExtension
import androidx.build.LibraryGroups
import androidx.build.Publish
-import static androidx.build.dependencies.DependenciesKt.*
-
plugins {
id("AndroidXPlugin")
id("com.android.library")
@@ -37,14 +33,14 @@
implementation("androidx.annotation:annotation:1.1.0")
implementation("androidx.tracing:tracing:1.0.0")
lintPublish(project(":startup:startup-runtime-lint"))
- androidTestImplementation(KOTLIN_STDLIB)
- androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
- androidTestImplementation(ANDROIDX_TEST_CORE)
- androidTestImplementation(ANDROIDX_TEST_RUNNER)
- androidTestImplementation(ESPRESSO_CORE)
- androidTestImplementation(MOCKITO_CORE, excludes.bytebuddy) // DexMaker has its own MockMaker
- androidTestImplementation(DEXMAKER_MOCKITO, excludes.bytebuddy) // DexMaker has its own MockMaker
- testImplementation(JUNIT)
+ androidTestImplementation(libs.kotlinStdlib)
+ androidTestImplementation(libs.testExtJunit)
+ androidTestImplementation(libs.testCore)
+ androidTestImplementation(libs.testRunner)
+ androidTestImplementation(libs.espressoCore)
+ androidTestImplementation(libs.mockitoCore, excludes.bytebuddy) // DexMaker has its own MockMaker
+ androidTestImplementation(libs.dexmakerMockito, excludes.bytebuddy) // DexMaker has its own MockMaker
+ testImplementation(libs.junit)
}
androidx {
diff --git a/test/screenshot/build.gradle b/test/screenshot/build.gradle
index d3769c3..08a239a 100644
--- a/test/screenshot/build.gradle
+++ b/test/screenshot/build.gradle
@@ -14,9 +14,7 @@
* limitations under the License.
*/
-import static androidx.build.dependencies.DependenciesKt.*
import androidx.build.LibraryGroups
-import androidx.build.LibraryVersions
plugins {
id("AndroidXPlugin")
@@ -29,15 +27,15 @@
implementation("androidx.core:core:1.5.0-rc02")
implementation("androidx.test.screenshot:screenshot-proto:1.0.0-alpha01")
- implementation(KOTLIN_STDLIB)
- implementation(JUNIT)
- implementation(ANDROIDX_TEST_RULES)
- implementation(ANDROIDX_TEST_RUNNER)
+ implementation(libs.kotlinStdlib)
+ implementation(libs.junit)
+ implementation(libs.testRules)
+ implementation(libs.testRunner)
- androidTestImplementation(TRUTH)
- androidTestImplementation(JUNIT)
- androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
- androidTestImplementation(ANDROIDX_TEST_RUNNER)
+ androidTestImplementation(libs.truth)
+ androidTestImplementation(libs.junit)
+ androidTestImplementation(libs.testExtJunit)
+ androidTestImplementation(libs.testRunner)
}
androidx {
diff --git a/test/screenshot/proto/build.gradle b/test/screenshot/proto/build.gradle
index 48aa430..1d323a9 100644
--- a/test/screenshot/proto/build.gradle
+++ b/test/screenshot/proto/build.gradle
@@ -14,7 +14,6 @@
* limitations under the License.
*/
-import static androidx.build.dependencies.DependenciesKt.*
import androidx.build.BuildServerConfigurationKt
plugins {
@@ -24,7 +23,7 @@
apply(plugin: "com.google.protobuf")
dependencies {
- implementation(PROTOBUF)
+ implementation(libs.protobuf)
}
tasks.withType(Jar) {
diff --git a/testutils/testutils-appcompat/build.gradle b/testutils/testutils-appcompat/build.gradle
index afd9243..ee9a25e 100644
--- a/testutils/testutils-appcompat/build.gradle
+++ b/testutils/testutils-appcompat/build.gradle
@@ -14,8 +14,6 @@
* limitations under the License.
*/
-import static androidx.build.dependencies.DependenciesKt.*
-
plugins {
id("AndroidXPlugin")
id("com.android.library")
@@ -27,10 +25,10 @@
api(project(":appcompat:appcompat"))
api(project(":annotation:annotation-experimental"))
- implementation(ANDROIDX_TEST_EXT_JUNIT)
- implementation(ANDROIDX_TEST_CORE)
- implementation(ANDROIDX_TEST_RULES)
- implementation(KOTLIN_STDLIB)
+ implementation(libs.testExtJunit)
+ implementation(libs.testCore)
+ implementation(libs.testRules)
+ implementation(libs.kotlinStdlib)
}
android {
diff --git a/testutils/testutils-common/build.gradle b/testutils/testutils-common/build.gradle
index bd13e75..bea9428 100644
--- a/testutils/testutils-common/build.gradle
+++ b/testutils/testutils-common/build.gradle
@@ -14,13 +14,11 @@
* limitations under the License.
*/
-import static androidx.build.dependencies.DependenciesKt.*
-
plugins {
id("AndroidXPlugin")
id("kotlin")
}
dependencies {
- implementation(KOTLIN_STDLIB)
+ implementation(libs.kotlinStdlib)
}
diff --git a/testutils/testutils-espresso/build.gradle b/testutils/testutils-espresso/build.gradle
index 314bef2..57507bf 100644
--- a/testutils/testutils-espresso/build.gradle
+++ b/testutils/testutils-espresso/build.gradle
@@ -14,8 +14,6 @@
* limitations under the License.
*/
-import static androidx.build.dependencies.DependenciesKt.*
-
plugins {
id("AndroidXPlugin")
id("com.android.library")
@@ -25,8 +23,8 @@
dependencies {
api("androidx.annotation:annotation:1.1.0")
- implementation(ESPRESSO_CORE, excludes.espresso)
- implementation(KOTLIN_STDLIB)
+ implementation(libs.espressoCore, excludes.espresso)
+ implementation(libs.kotlinStdlib)
}
android {
diff --git a/testutils/testutils-gradle-plugin/build.gradle b/testutils/testutils-gradle-plugin/build.gradle
index ad82bed..127a4bf 100644
--- a/testutils/testutils-gradle-plugin/build.gradle
+++ b/testutils/testutils-gradle-plugin/build.gradle
@@ -14,16 +14,14 @@
* limitations under the License.
*/
-import static androidx.build.dependencies.DependenciesKt.*
-
plugins {
id("AndroidXPlugin")
id("kotlin")
}
dependencies {
- implementation(KOTLIN_STDLIB)
- implementation(ANDROIDX_TEST_EXT_JUNIT)
- implementation(ANDROIDX_TEST_CORE)
- implementation(ANDROIDX_TEST_RULES)
+ implementation(libs.kotlinStdlib)
+ implementation(libs.testExtJunit)
+ implementation(libs.testCore)
+ implementation(libs.testRules)
}
diff --git a/testutils/testutils-ktx/build.gradle b/testutils/testutils-ktx/build.gradle
index 016b815..eda09a6 100644
--- a/testutils/testutils-ktx/build.gradle
+++ b/testutils/testutils-ktx/build.gradle
@@ -14,21 +14,18 @@
* limitations under the License.
*/
-
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
-import static androidx.build.dependencies.DependenciesKt.*
-
plugins {
id("AndroidXPlugin")
id("kotlin")
}
dependencies {
- api(KOTLIN_STDLIB)
- api(KOTLIN_COROUTINES_CORE)
- api(KOTLIN_COROUTINES_TEST)
- api(JUNIT)
+ api(libs.kotlinStdlib)
+ api(libs.kotlinCoroutinesCore)
+ api(libs.kotlinCoroutinesTest)
+ api(libs.junit)
}
// Allow usage of Kotlin's @OptIn.
diff --git a/testutils/testutils-macrobenchmark/build.gradle b/testutils/testutils-macrobenchmark/build.gradle
index d331ce5..c4a95da 100644
--- a/testutils/testutils-macrobenchmark/build.gradle
+++ b/testutils/testutils-macrobenchmark/build.gradle
@@ -14,11 +14,6 @@
* limitations under the License.
*/
-
-import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
-
-import static androidx.build.dependencies.DependenciesKt.*
-
plugins {
id("AndroidXPlugin")
id("com.android.library")
@@ -29,7 +24,7 @@
implementation(project(":benchmark:benchmark-macro"))
implementation(project(":benchmark:benchmark-macro-junit4"))
- implementation(KOTLIN_STDLIB)
+ implementation(libs.kotlinStdlib)
}
android {
diff --git a/testutils/testutils-mockito/build.gradle b/testutils/testutils-mockito/build.gradle
index 7582ccd..40d784c 100644
--- a/testutils/testutils-mockito/build.gradle
+++ b/testutils/testutils-mockito/build.gradle
@@ -14,8 +14,6 @@
* limitations under the License.
*/
-import static androidx.build.dependencies.DependenciesKt.*
-
plugins {
id("AndroidXPlugin")
id("com.android.library")
@@ -23,9 +21,9 @@
}
dependencies {
- api(MOCKITO_CORE, excludes.bytebuddy)
+ api(libs.mockitoCore, excludes.bytebuddy)
- implementation(KOTLIN_STDLIB)
+ implementation(libs.kotlinStdlib)
}
android {
diff --git a/testutils/testutils-navigation/build.gradle b/testutils/testutils-navigation/build.gradle
index 61664a7..6e705df 100644
--- a/testutils/testutils-navigation/build.gradle
+++ b/testutils/testutils-navigation/build.gradle
@@ -14,12 +14,6 @@
* limitations under the License.
*/
-import static androidx.build.dependencies.DependenciesKt.*
-import androidx.build.LibraryGroups
-import androidx.build.LibraryVersions
-import androidx.build.AndroidXExtension
-import androidx.build.Publish
-
plugins {
id("AndroidXPlugin")
id("com.android.library")
@@ -31,11 +25,11 @@
testImplementation(projectOrArtifact(":navigation:navigation-testing"))
testImplementation("androidx.arch.core:core-testing:2.1.0")
- testImplementation(JUNIT)
- testImplementation(MOCKITO_CORE)
+ testImplementation(libs.junit)
+ testImplementation(libs.mockitoCore)
- androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
- androidTestImplementation(ANDROIDX_TEST_CORE)
- androidTestImplementation(ANDROIDX_TEST_RUNNER)
- androidTestImplementation(ESPRESSO_CORE)
+ androidTestImplementation(libs.testExtJunit)
+ androidTestImplementation(libs.testCore)
+ androidTestImplementation(libs.testRunner)
+ androidTestImplementation(libs.espressoCore)
}
diff --git a/testutils/testutils-paging/build.gradle b/testutils/testutils-paging/build.gradle
index 7d242fa..cef3497 100644
--- a/testutils/testutils-paging/build.gradle
+++ b/testutils/testutils-paging/build.gradle
@@ -14,21 +14,17 @@
* limitations under the License.
*/
-
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
-import static androidx.build.dependencies.DependenciesKt.getKOTLIN_STDLIB
-import static androidx.build.dependencies.DependenciesKt.getKOTLIN_TEST
-
plugins {
id("AndroidXPlugin")
id("kotlin")
}
dependencies {
- api(KOTLIN_STDLIB)
+ api(libs.kotlinStdlib)
implementation(project(":paging:paging-common"))
- implementation(KOTLIN_TEST)
+ implementation(libs.kotlinTest)
}
// Allow usage of Kotlin's @OptIn.
diff --git a/testutils/testutils-runtime/build.gradle b/testutils/testutils-runtime/build.gradle
index d315b6a..795f410 100644
--- a/testutils/testutils-runtime/build.gradle
+++ b/testutils/testutils-runtime/build.gradle
@@ -14,8 +14,6 @@
* limitations under the License.
*/
-import static androidx.build.dependencies.DependenciesKt.*
-
plugins {
id("AndroidXPlugin")
id("com.android.library")
@@ -25,10 +23,10 @@
dependencies {
api("androidx.fragment:fragment:1.1.0")
- implementation(ANDROIDX_TEST_EXT_JUNIT)
- implementation(ANDROIDX_TEST_CORE)
- implementation(ANDROIDX_TEST_RULES)
- implementation(KOTLIN_STDLIB)
+ implementation(libs.testExtJunit)
+ implementation(libs.testCore)
+ implementation(libs.testRules)
+ implementation(libs.kotlinStdlib)
}
android {
diff --git a/testutils/testutils-truth/build.gradle b/testutils/testutils-truth/build.gradle
index 617d787..2c984ec 100644
--- a/testutils/testutils-truth/build.gradle
+++ b/testutils/testutils-truth/build.gradle
@@ -14,14 +14,12 @@
* limitations under the License.
*/
-import static androidx.build.dependencies.DependenciesKt.*
-
plugins {
id("AndroidXPlugin")
id("kotlin")
}
dependencies {
- api(TRUTH)
- api(KOTLIN_STDLIB)
+ api(libs.truth)
+ api(libs.kotlinStdlib)
}
diff --git a/textclassifier/integration-tests/testapp/build.gradle b/textclassifier/integration-tests/testapp/build.gradle
index fcbe262..172072c 100644
--- a/textclassifier/integration-tests/testapp/build.gradle
+++ b/textclassifier/integration-tests/testapp/build.gradle
@@ -14,15 +14,11 @@
* limitations under the License.
*/
-import static androidx.build.dependencies.DependenciesKt.*
-
plugins {
id("AndroidXPlugin")
id("com.android.application")
}
-project.ext.noDocs = true
-
android {
buildTypes {
getByName("release") {
@@ -36,10 +32,10 @@
dependencies {
implementation(project(":textclassifier:textclassifier"))
implementation(project(":core:core"))
- androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
- androidTestImplementation(ANDROIDX_TEST_CORE)
- androidTestImplementation(ANDROIDX_TEST_RUNNER)
- androidTestImplementation(ANDROIDX_TEST_RULES)
- androidTestImplementation(ESPRESSO_CORE)
+ androidTestImplementation(libs.testExtJunit)
+ androidTestImplementation(libs.testCore)
+ androidTestImplementation(libs.testRunner)
+ androidTestImplementation(libs.testRules)
+ androidTestImplementation(libs.espressoCore)
}
diff --git a/textclassifier/textclassifier/build.gradle b/textclassifier/textclassifier/build.gradle
index bc5aabc..312925a 100644
--- a/textclassifier/textclassifier/build.gradle
+++ b/textclassifier/textclassifier/build.gradle
@@ -1,6 +1,4 @@
-import static androidx.build.dependencies.DependenciesKt.*
import androidx.build.LibraryGroups
-import androidx.build.LibraryVersions
import androidx.build.Publish
plugins {
@@ -14,20 +12,14 @@
implementation("androidx.collection:collection:1.0.0")
api("androidx.core:core:1.1.0")
- androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
- androidTestImplementation(ANDROIDX_TEST_CORE)
- androidTestImplementation(ANDROIDX_TEST_RUNNER)
- androidTestImplementation(ANDROIDX_TEST_RULES)
- androidTestImplementation(TRUTH)
- androidTestImplementation(ESPRESSO_CORE, excludes.espresso)
- androidTestImplementation(MOCKITO_CORE, excludes.bytebuddy)
- androidTestImplementation(DEXMAKER_MOCKITO, excludes.bytebuddy)
-}
-
-android {
- defaultConfig {
- minSdkVersion 14
- }
+ androidTestImplementation(libs.testExtJunit)
+ androidTestImplementation(libs.testCore)
+ androidTestImplementation(libs.testRunner)
+ androidTestImplementation(libs.testRules)
+ androidTestImplementation(libs.truth)
+ androidTestImplementation(libs.espressoCore, excludes.espresso)
+ androidTestImplementation(libs.mockitoCore, excludes.bytebuddy)
+ androidTestImplementation(libs.dexmakerMockito, excludes.bytebuddy)
}
androidx {
diff --git a/tracing/tracing-ktx/build.gradle b/tracing/tracing-ktx/build.gradle
index cb19a01..49ef937 100644
--- a/tracing/tracing-ktx/build.gradle
+++ b/tracing/tracing-ktx/build.gradle
@@ -14,12 +14,7 @@
* limitations under the License.
*/
-
import androidx.build.LibraryGroups
-import androidx.build.LibraryVersions
-import androidx.build.AndroidXExtension
-
-import static androidx.build.dependencies.DependenciesKt.*
import androidx.build.Publish
plugins {
@@ -30,13 +25,13 @@
dependencies {
api project(":tracing:tracing")
- api(KOTLIN_STDLIB)
+ api(libs.kotlinStdlib)
- androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
- androidTestImplementation(ANDROIDX_TEST_CORE)
- androidTestImplementation(ANDROIDX_TEST_RUNNER)
- androidTestImplementation(KOTLIN_COROUTINES_ANDROID)
- testImplementation(JUNIT)
+ androidTestImplementation(libs.testExtJunit)
+ androidTestImplementation(libs.testCore)
+ androidTestImplementation(libs.testRunner)
+ androidTestImplementation(libs.kotlinCoroutinesAndroid)
+ testImplementation(libs.junit)
}
androidx {
diff --git a/tracing/tracing/build.gradle b/tracing/tracing/build.gradle
index 7582a61..2f85b8b 100644
--- a/tracing/tracing/build.gradle
+++ b/tracing/tracing/build.gradle
@@ -14,12 +14,7 @@
* limitations under the License.
*/
-
import androidx.build.LibraryGroups
-import androidx.build.LibraryVersions
-import androidx.build.AndroidXExtension
-
-import static androidx.build.dependencies.DependenciesKt.*
import androidx.build.Publish
plugins {
@@ -30,11 +25,11 @@
dependencies {
implementation("androidx.annotation:annotation:1.2.0")
- androidTestImplementation(KOTLIN_STDLIB)
- androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
- androidTestImplementation(ANDROIDX_TEST_CORE)
- androidTestImplementation(ANDROIDX_TEST_RUNNER)
- testImplementation(JUNIT)
+ androidTestImplementation(libs.kotlinStdlib)
+ androidTestImplementation(libs.testExtJunit)
+ androidTestImplementation(libs.testCore)
+ androidTestImplementation(libs.testRunner)
+ testImplementation(libs.junit)
}
androidx {
diff --git a/tv-provider/tv-provider/build.gradle b/tv-provider/tv-provider/build.gradle
index c3a6147..5efa09e 100644
--- a/tv-provider/tv-provider/build.gradle
+++ b/tv-provider/tv-provider/build.gradle
@@ -1,6 +1,4 @@
-import static androidx.build.dependencies.DependenciesKt.*
import androidx.build.LibraryGroups
-import androidx.build.LibraryVersions
import androidx.build.Publish
plugins {
@@ -12,11 +10,11 @@
api("androidx.annotation:annotation:1.1.0")
api("androidx.core:core:1.1.0")
- androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
- androidTestImplementation(ANDROIDX_TEST_CORE)
- androidTestImplementation(ANDROIDX_TEST_RUNNER)
- androidTestImplementation(ANDROIDX_TEST_RULES)
- androidTestImplementation(MOCKITO_CORE)
+ androidTestImplementation(libs.testExtJunit)
+ androidTestImplementation(libs.testCore)
+ androidTestImplementation(libs.testRunner)
+ androidTestImplementation(libs.testRules)
+ androidTestImplementation(libs.mockitoCore)
}
android {
diff --git a/vectordrawable/vectordrawable-animated/build.gradle b/vectordrawable/vectordrawable-animated/build.gradle
index e0a2582..7d7723a2 100644
--- a/vectordrawable/vectordrawable-animated/build.gradle
+++ b/vectordrawable/vectordrawable-animated/build.gradle
@@ -1,4 +1,3 @@
-import static androidx.build.dependencies.DependenciesKt.*
import androidx.build.LibraryGroups
import androidx.build.LibraryVersions
import androidx.build.Publish
@@ -13,11 +12,11 @@
implementation("androidx.interpolator:interpolator:1.0.0")
implementation("androidx.collection:collection:1.1.0")
- androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
- androidTestImplementation(ANDROIDX_TEST_CORE)
- androidTestImplementation(ANDROIDX_TEST_RUNNER)
- androidTestImplementation(ANDROIDX_TEST_RULES)
- androidTestImplementation(ESPRESSO_CORE, excludes.espresso)
+ androidTestImplementation(libs.testExtJunit)
+ androidTestImplementation(libs.testCore)
+ androidTestImplementation(libs.testRunner)
+ androidTestImplementation(libs.testRules)
+ androidTestImplementation(libs.espressoCore, excludes.espresso)
}
android {
diff --git a/vectordrawable/vectordrawable-seekable/build.gradle b/vectordrawable/vectordrawable-seekable/build.gradle
index b40844f..6367a75 100644
--- a/vectordrawable/vectordrawable-seekable/build.gradle
+++ b/vectordrawable/vectordrawable-seekable/build.gradle
@@ -1,4 +1,3 @@
-import static androidx.build.dependencies.DependenciesKt.*
import androidx.build.LibraryGroups
import androidx.build.LibraryVersions
import androidx.build.Publish
@@ -13,12 +12,12 @@
api(project(":core:core-animation"))
implementation("androidx.collection:collection:1.1.0")
- androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
- androidTestImplementation(ANDROIDX_TEST_CORE)
- androidTestImplementation(ANDROIDX_TEST_RUNNER)
- androidTestImplementation(ANDROIDX_TEST_RULES)
- androidTestImplementation(TRUTH)
- androidTestImplementation(ESPRESSO_CORE, excludes.espresso)
+ androidTestImplementation(libs.testExtJunit)
+ androidTestImplementation(libs.testCore)
+ androidTestImplementation(libs.testRunner)
+ androidTestImplementation(libs.testRules)
+ androidTestImplementation(libs.truth)
+ androidTestImplementation(libs.espressoCore, excludes.espresso)
androidTestImplementation(project(":core:core-animation-testing"))
}
diff --git a/vectordrawable/vectordrawable/build.gradle b/vectordrawable/vectordrawable/build.gradle
index 9805e43..03d5136 100644
--- a/vectordrawable/vectordrawable/build.gradle
+++ b/vectordrawable/vectordrawable/build.gradle
@@ -1,4 +1,3 @@
-import static androidx.build.dependencies.DependenciesKt.*
import androidx.build.LibraryGroups
import androidx.build.LibraryVersions
import androidx.build.Publish
@@ -13,10 +12,10 @@
api("androidx.core:core:1.1.0")
implementation("androidx.collection:collection:1.1.0")
- androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
- androidTestImplementation(ANDROIDX_TEST_CORE)
- androidTestImplementation(ANDROIDX_TEST_RUNNER)
- androidTestImplementation(ANDROIDX_TEST_RULES)
+ androidTestImplementation(libs.testExtJunit)
+ androidTestImplementation(libs.testCore)
+ androidTestImplementation(libs.testRunner)
+ androidTestImplementation(libs.testRules)
}
android {