1/*
2 * Copyright (C) 2019 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.BundleInsideHelper
25import androidx.build.SoftwareType
26
27plugins {
28    id("AndroidXPlugin")
29    id("com.android.library")
30}
31
32android {
33    compileSdk = 36
34    compileOptions {
35        sourceCompatibility = JavaVersion.VERSION_1_8
36        targetCompatibility = JavaVersion.VERSION_1_8
37    }
38    buildTypes.configureEach {
39        // TODO(b/161836669): Minifiation is currently disabled because if it is on, the aar gets
40        //   desugared twice in some workflows, which fails. Decide how to handle this (e.g.
41        //   splitting targets, continuing with the consumerProguardFiles solution here, fixing the
42        //   flows that perform duplicate desugaring, or something else).
43        minifyEnabled = false
44        consumerProguardFiles "proguard-rules.pro"
45    }
46    // TODO(b/161205849): We've had to move libicing.so compilation into appsearch:appsearch to get
47    //  it included into the exported aar. Find a proper solution for bundling libicing.so into
48    //  appsearch-release.aar and move compilation of libicing.so back into the external/icing tree.
49    sourceSets {
50        androidTest.java.srcDir "../../../../external/icing/java/tests/instrumentation/"
51    }
52    defaultConfig {
53        externalNativeBuild {
54            cmake {
55                arguments "-DCMAKE_VERBOSE_MAKEFILE=ON"
56                targets "icing"
57            }
58        }
59    }
60    externalNativeBuild {
61        cmake {
62            version = libs.versions.cmake.get()
63            path "../../../../external/icing/CMakeLists.txt"
64        }
65    }
66    namespace = "androidx.appsearch.localstorage"
67}
68
69// Bundles dependency in bundleInside() inside of the libs/ directory of the aar.
70BundleInsideHelper.forInsideAar(
71    project,
72    /* relocations = */ null,
73    /* dropResourcesWithSuffix = */ null
74)
75
76dependencies {
77    api(libs.jspecify)
78    api("androidx.annotation:annotation:1.8.1")
79
80    // icing project brings in repackaged protos only (not the runtime lib)
81    bundleInside(project(":icing"))
82
83    // Repackaged protobufLite brought in by
84    // project(":appsearch:appsearch-external-protobuf") and used at runtime
85    implementation(project(":appsearch:appsearch-external-protobuf"))
86    implementation(project(":appsearch:appsearch"))
87    implementation("androidx.collection:collection:1.4.2")
88    implementation("androidx.concurrent:concurrent-futures:1.0.0")
89    implementation("androidx.core:core:1.6.0")
90
91    androidTestImplementation(project(":appsearch:appsearch-test-util"))
92    androidTestImplementation(libs.testCore)
93    androidTestImplementation(libs.testRules)
94    androidTestImplementation(libs.truth)
95    androidTestImplementation(libs.mockitoAndroid)
96    androidTestImplementation(libs.junit)
97}
98
99androidx {
100    name = "AppSearch Local Storage"
101    type = SoftwareType.PUBLISHED_LIBRARY
102    inceptionYear = "2020"
103    description =
104        "An implementation of AppSearchSession which uses local app storage and a local copy of " +
105                "the search library"
106}
107