1/*
2 * Copyright (C) 2021 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.SoftwareType
26import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
27
28plugins {
29    id("AndroidXPlugin")
30    id("AndroidXComposePlugin")
31    id("com.android.library")
32    id("org.jetbrains.kotlin.android")
33    id("androidx.inspection")
34}
35
36dependencies {
37    implementation("androidx.annotation:annotation:1.8.1", {
38        exclude group: "org.jetbrains.kotlin", module: "kotlin-stdlib"
39    })
40    // Following dependencies will be provided by inspected app itself
41    // because compose:ui-inspector can be run only in app with compose:ui:ui
42    // thus all its transitive dependencies will be present too.
43    compileOnly(libs.kotlinStdlib)
44    compileOnly("androidx.collection:collection:1.4.2")
45    compileOnly("androidx.inspection:inspection:1.0.0")
46    compileOnly("androidx.compose.runtime:runtime:1.2.1")
47    compileOnly(project(":compose:ui:ui-graphics"))
48    compileOnly(project(":compose:ui:ui"))
49    // we ignore its transitive dependencies, because ui-inspection should
50    // depend on them as "compile-only" deps.
51    implementation(project(":compose:ui:ui-tooling-data"), {
52        transitive = false
53    })
54    implementation(libs.kotlinReflect, {
55        exclude group: "org.jetbrains.kotlin", module: "kotlin-stdlib"
56    })
57    androidTestImplementation(libs.kotlinStdlib)
58    androidTestImplementation(libs.kotlinCoroutinesAndroid)
59    androidTestImplementation(libs.testCore)
60    androidTestImplementation(project(":compose:foundation:foundation-layout"))
61    androidTestImplementation(project(":compose:ui:ui-tooling"))
62    androidTestImplementation(project(":compose:ui:ui-tooling-data"))
63    androidTestImplementation(project(":compose:ui:ui"))
64    androidTestImplementation(project(":compose:foundation:foundation"))
65    androidTestImplementation(project(":compose:ui:ui-util"))
66    androidTestImplementation(project(":compose:ui:ui-test-junit4"))
67    androidTestImplementation(project(":internal-testutils-fonts"))
68    androidTestImplementation(project(":compose:material:material"))
69    androidTestImplementation("androidx.compose.material:material-icons-core:1.6.7")
70    androidTestImplementation(project(":inspection:inspection-testing"))
71    androidTestImplementation("androidx.activity:activity-compose:1.3.1")
72    androidTestImplementation(libs.testRunner)
73    androidTestImplementation(libs.testRules)
74    androidTestImplementation(libs.testExtJunit)
75    androidTestImplementation(libs.truth)
76}
77
78androidx {
79    name = "Compose Layout Inspector"
80    type = SoftwareType.IDE_PLUGIN
81    inceptionYear = "2021"
82    description = "Compose layout inspector. Exposes information to our tools for better IDE support."
83}
84
85android {
86    compileSdk = 35
87    defaultConfig {
88        // layout inspection supported starting on Android Q
89        minSdk = 29
90    }
91
92    sourceSets {
93        main.resources.srcDirs += "src/main/proto"
94    }
95
96    externalNativeBuild {
97        cmake {
98            path "src/main/cpp/CMakeLists.txt"
99            version = libs.versions.cmake.get()
100        }
101    }
102    namespace = "androidx.compose.ui.inspection"
103}
104
105inspection {
106    name = "compose-ui-inspection.jar"
107}
108
109// TODO(b/407640608): Fix :compose:ui:ui-inspection:connectedCheck to work without this block
110tasks.withType(KotlinCompile).configureEach {
111    kotlinOptions {
112        freeCompilerArgs += [
113                "-Xlambdas=class"
114        ]
115    }
116}
117
118