1/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17buildscript {
18    // TODO: Remove this when this test app no longer depends on 1.0.0 of vectordrawable-animated.
19    // vectordrawable and vectordrawable-animated were accidentally using the same package name
20    // which is no longer valid in namespaced resource world.
21    project.ext["android.uniquePackageNames"] = false
22}
23
24plugins {
25    id("AndroidXPlugin")
26    id("com.android.application")
27    id("androidx.room")
28}
29
30android {
31    buildFeatures {
32        aidl = true
33    }
34    sourceSets {
35        androidTest.assets.srcDirs += files("$projectDir/databases".toString())
36    }
37    flavorDimensions "processorConfiguration"
38    productFlavors {
39        withoutExpandProjection {
40            dimension "processorConfiguration"
41            javaCompileOptions {
42                annotationProcessorOptions {
43                    arguments = ["room.expandProjection"  : "false"]
44                }
45            }
46        }
47        withNullAwareTypeConverter {
48            dimension "processorConfiguration"
49            javaCompileOptions {
50                annotationProcessorOptions {
51                    arguments = [
52                            "room.expandProjection"  : "false",
53                            "room.useNullAwareTypeAnalysis": "true"
54                    ]
55                }
56            }
57        }
58        withPreKmpCompiler {
59            dimension "processorConfiguration"
60        }
61    }
62    compileOptions {
63        // For testing Java records
64        sourceCompatibility JavaVersion.VERSION_17
65        targetCompatibility JavaVersion.VERSION_17
66        coreLibraryDesugaringEnabled = true
67    }
68    namespace = "androidx.room.integration.testapp"
69}
70
71dependencies {
72    implementation(libs.jspecify)
73    coreLibraryDesugaring(libs.desugarJdkLibs)
74    implementation(project(":room:room-common"))
75    implementation(project(":room:room-runtime"))
76    implementation(project(":room:room-migration"))
77    implementation("androidx.arch.core:core-runtime:2.2.0")
78    implementation("androidx.lifecycle:lifecycle-livedata:2.6.1")
79    implementation("androidx.lifecycle:lifecycle-runtime:2.6.1")
80
81    implementation("androidx.annotation:annotation-experimental:1.4.1")
82
83    // libs.findbugs dependency resolves an app/testapp version conflict.
84    implementation(libs.findbugs)
85    implementation("androidx.recyclerview:recyclerview:1.0.0")
86    implementation("androidx.appcompat:appcompat:1.3.1")
87
88    // Annotation processor / compiler dependencies:
89    withoutExpandProjectionAnnotationProcessor(project(":room:room-compiler"))
90    withNullAwareTypeConverterAnnotationProcessor(project(":room:room-compiler"))
91    withPreKmpCompilerAnnotationProcessor("androidx.room:room-compiler:2.6.1")
92    androidTestWithoutExpandProjectionAnnotationProcessor(project(":room:room-compiler"))
93    androidTestWithNullAwareTypeConverterAnnotationProcessor(project(":room:room-compiler"))
94    androidTestWithPreKmpCompilerAnnotationProcessor("androidx.room:room-compiler:2.6.1")
95
96    androidTestImplementation("androidx.arch.core:core-runtime:2.2.0")
97    androidTestImplementation("androidx.arch.core:core-common:2.2.0")
98    androidTestImplementation(project(":room:room-testing"))
99    androidTestImplementation(project(":room:room-rxjava2"))
100    androidTestImplementation(project(":room:room-rxjava3"))
101    androidTestImplementation(project(":room:room-guava"))
102    androidTestImplementation(project(":room:room-paging"))
103    androidTestImplementation("androidx.arch.core:core-testing:2.2.0")
104    androidTestImplementation(project(":paging:paging-runtime"))
105    androidTestImplementation("androidx.lifecycle:lifecycle-runtime:2.6.1")
106    androidTestImplementation("androidx.lifecycle:lifecycle-runtime-testing:2.6.1")
107    androidTestImplementation("androidx.lifecycle:lifecycle-livedata:2.6.1")
108    androidTestImplementation(libs.guavaAndroid)
109
110    // libs.findbugs dependency resolves an app/testapp version conflict.
111    androidTestImplementation(libs.findbugs)
112    androidTestImplementation(libs.rxjava2)
113    androidTestImplementation(libs.rxjava3)
114    androidTestImplementation(libs.testExtJunit)
115    androidTestImplementation(libs.testCore)
116    androidTestImplementation(libs.testRunner)
117    androidTestImplementation(libs.testRules)
118    androidTestImplementation(libs.espressoCore)
119    androidTestImplementation(libs.truth)
120    androidTestImplementation(libs.mockitoAndroid5)
121    androidTestImplementation(project(":internal-testutils-truth"))
122
123    testImplementation(libs.junit)
124}
125
126room {
127    schemaDirectory(
128        layout.projectDirectory.dir("schemas")
129    )
130}
131
132// Enable parameter names to support Room incremental when its a project() dep.
133// See b/198431380
134tasks.withType(JavaCompile) {
135    options.compilerArgs << "-parameters"
136}
137