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
17/**
18 * This file was created using the `create_project.py` script located in the
19 * `<AndroidX root>/development/project-creator` directory.
20 *
21 * Please use that script when creating a new project, rather than copying an existing project and
22 * modifying its settings.
23 */
24import androidx.build.SoftwareType
25import androidx.build.KotlinTarget
26
27import static androidx.inspection.gradle.InspectionPluginKt.packageInspector
28
29plugins {
30    id("AndroidXPlugin")
31    id("com.android.library")
32    id("org.jetbrains.kotlin.android")
33    id("com.google.devtools.ksp")
34    id("androidx.stableaidl")
35}
36
37android {
38    buildFeatures {
39        aidl = true
40    }
41    buildTypes.configureEach {
42        consumerProguardFiles("proguard-rules.pro")
43
44        stableAidl {
45            version = 1
46        }
47    }
48    defaultConfig {
49        javaCompileOptions {
50            annotationProcessorOptions {
51                arguments = [
52                        "room.incremental"     : "true",
53                        "room.expandProjection": "true",
54                        "room.schemaLocation"  : "$projectDir/src/schemas".toString()
55                ]
56            }
57        }
58    }
59    compileSdk = 35
60    sourceSets {
61        androidTest.assets.srcDirs += files("$projectDir/src/schemas".toString())
62    }
63    namespace = "androidx.work"
64}
65
66dependencies {
67    api(libs.jspecify)
68    ksp("androidx.room:room-compiler:2.6.1")
69    api("androidx.core:core:1.12.0")
70    implementation("androidx.room:room-ktx:2.6.1")
71    implementation("androidx.concurrent:concurrent-futures-ktx:1.1.0")
72    api("androidx.annotation:annotation-experimental:1.4.1")
73    api(libs.guavaListenableFuture)
74    api("androidx.lifecycle:lifecycle-livedata:2.6.2")
75    api("androidx.startup:startup-runtime:1.1.1")
76    implementation("androidx.lifecycle:lifecycle-service:2.6.2")
77    implementation("androidx.tracing:tracing-ktx:1.2.0")
78    api(libs.kotlinStdlib)
79    api(libs.kotlinCoroutinesAndroid)
80    androidTestImplementation(libs.kotlinCoroutinesTest)
81    androidTestImplementation(libs.truth)
82    androidTestImplementation(libs.testExtJunit)
83    androidTestImplementation(libs.testCore)
84    androidTestImplementation("androidx.arch.core:core-testing:2.2.0")
85    androidTestImplementation(project(":lifecycle:lifecycle-runtime-testing"))
86    androidTestImplementation("androidx.room:room-testing:2.6.1")
87    androidTestImplementation(libs.testRunner)
88    androidTestImplementation(libs.espressoCore)
89    androidTestImplementation(libs.mockitoCore)
90    androidTestImplementation(libs.dexmakerMockito)
91    androidTestImplementation(project(":internal-testutils-runtime"))
92    testImplementation(libs.junit)
93    testImplementation(libs.truth)
94    testImplementation(libs.robolectric)
95    testImplementation(libs.testCoreKtx)
96    lintPublish(project(":work:work-runtime-lint"))
97}
98
99packageInspector(project, ":work:work-inspection")
100
101// KSP does not support argument per flavor so we set it to global instead.
102ksp {
103    arg("room.schemaLocation","$projectDir/src/schemas".toString())
104}
105
106androidx {
107    name = "WorkManager Runtime"
108    type = SoftwareType.PUBLISHED_LIBRARY
109    //TODO(b/407640603): Migrate to Kotlin 2. Task :work:work-runtime:kspReleaseKotlin fails
110    kotlinTarget = KotlinTarget.KOTLIN_1_9
111    inceptionYear = "2018"
112    description = "Android WorkManager runtime library"
113    failOnDeprecationWarnings = false
114    legacyDisableKotlinStrictApiMode = true
115}
116