1/*
2 * Copyright (C) 2024 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 */
24
25import androidx.build.KotlinTarget
26import androidx.build.SoftwareType
27
28plugins {
29    id("AndroidXPlugin")
30    id("com.android.library")
31    id("org.jetbrains.kotlin.android")
32    id("org.jetbrains.kotlin.kapt")
33}
34
35dependencies {
36    api(libs.kotlinStdlib)
37    // Public dependencies
38    implementation("androidx.appsearch:appsearch:1.1.0-beta01")
39    // Manually specify the dependency on kotlinMetadataJvm due to missing prebuilt for appsearch
40    // compiler.
41    kapt(libs.kotlinMetadataJvm)
42    kapt("androidx.appsearch:appsearch-compiler:1.1.0-beta01")
43
44    // Internal dependencies
45    implementation("androidx.annotation:annotation:1.8.1")
46
47    // Compile only dependencies
48    compileOnly(project(":appfunctions:appfunctions-stubs"))
49
50    // Test dependencies
51    testImplementation(libs.junit)
52    testImplementation(libs.truth)
53
54    // Test dependencies
55    androidTestImplementation(libs.truth)
56    androidTestImplementation(libs.junit)
57    androidTestImplementation(libs.testRunner)
58    androidTestImplementation(libs.testParameterInjector)
59    androidTestCompileOnly(project(":appfunctions:appfunctions-stubs"))
60}
61
62// Restricts AppSearch generated code to library to avoid it surfacing in public API.
63kapt {
64    arguments {
65        arg("AppSearchCompiler.RestrictGeneratedCodeToLib", "true")
66    }
67}
68
69android {
70    compileSdk = 36
71    buildTypes.configureEach {
72        consumerProguardFiles "proguard-rules.pro"
73    }
74    namespace = "androidx.appfunctions.common"
75}
76
77androidx {
78    name = "androidx.appfunctions:appfunctions-common"
79    type = SoftwareType.PUBLISHED_LIBRARY
80    //TODO(b/407507716): Target Kotlin 2 when support for it is stable in kapt
81    kotlinTarget = KotlinTarget.KOTLIN_1_9
82    inceptionYear = "2024"
83    description = "Contains the code shared by appfunctions-app-runtime , appfunctions-agent-runtime and appfunctions-schema libraries."
84}
85