Implement LimitOffsetListenableFuturePagingSource
An abstract implementation of ListenableFuturePagingSource to be
implemented by Room. Supports Guava operations through ListenableFuture.
Test: ./gradlew room:room-paging-guava:cC
Bug: 203666906
Change-Id: I3ec746a072d28e856018d03aeb08931a8d42fa93
diff --git a/room/room-paging-guava/build.gradle b/room/room-paging-guava/build.gradle
index 5db83cb..8f23959 100644
--- a/room/room-paging-guava/build.gradle
+++ b/room/room-paging-guava/build.gradle
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import androidx.build.LibraryType
import androidx.build.Publish
@@ -23,9 +24,49 @@
id("org.jetbrains.kotlin.android")
}
+// If set to `true`, we'll use KSP instead of KAPT.
+// Note that the CI does not run tests with KSP yet so this is only for local usage.
+// Once variants are properly supported by both ksp and AndroidX, we'll add support for this.
+// (b/153917176)
+def useKsp = project.properties.getOrDefault("useKsp", "false").toBoolean()
+if (useKsp) {
+ apply plugin: "com.google.devtools.ksp"
+} else {
+ apply plugin: "kotlin-kapt"
+}
+
dependencies {
api(libs.kotlinStdlib)
- // Add dependencies here
+ implementation(project(":room:room-paging"))
+ implementation(project(":room:room-guava"))
+ implementation(projectOrArtifact(":paging:paging-guava"))
+
+ androidTestImplementation(libs.truth)
+ androidTestImplementation(libs.testExtJunitKtx)
+ androidTestImplementation(libs.testRunner)
+ androidTestImplementation(libs.kotlinTestJunit)
+ androidTestImplementation(libs.kotlinCoroutinesTest)
+ androidTestImplementation(libs.kotlinCoroutinesGuava)
+ androidTestImplementation("androidx.arch.core:core-testing:2.0.1")
+ androidTestImplementation(project(":internal-testutils-common"))
+ // depend on the shadowed version so that it tests with the shipped artifact
+ // this is a temporary attribute until KSP and AndroidX plugin supports variants.
+ if(useKsp) {
+ kspAndroidTest(
+ project(path: ":room:room-compiler", configuration: "shadowAndImplementation")
+ )
+ } else {
+ kaptAndroidTest(
+ project(path: ":room:room-compiler", configuration: "shadowAndImplementation")
+ )
+ }
+}
+
+// Allow usage of Kotlin's @OptIn.
+tasks.withType(KotlinCompile).configureEach {
+ kotlinOptions {
+ freeCompilerArgs += ["-opt-in=kotlin.RequiresOptIn"]
+ }
}
androidx {