blob: 42d1a844635e6bff42866cfb18628c4ff8c07abe [file] [log] [blame]
/*
* Copyright (C) 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import androidx.build.LibraryGroups
import androidx.build.LibraryType
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("AndroidXPlugin")
id("AndroidXComposePlugin")
id("com.android.library")
id("kotlin-android")
id("androidx.inspection")
}
dependencies {
kotlinPlugin project(":compose:compiler:compiler")
implementation("androidx.annotation:annotation:1.1.0")
// Following dependencies will be provided by inspected app itself
// because compose:ui-inspector can be run only in app with compose:ui:ui
// thus all its transitive dependencies will be present too.
compileOnly(libs.kotlinStdlib)
compileOnly("androidx.inspection:inspection:1.0.0")
compileOnly(project(":compose:runtime:runtime"))
compileOnly(project(":compose:ui:ui"))
// we ignore its transitive dependencies, because ui-inspection should
// depend on them as "compile-only" deps.
implementation(project(":compose:ui:ui-tooling-data"), {
transitive(false)
})
implementation(libs.kotlinReflect, {
exclude group: "org.jetbrains.kotlin", module: "kotlin-stdlib"
})
androidTestImplementation(libs.kotlinStdlib)
androidTestImplementation(libs.kotlinCoroutinesAndroid)
androidTestImplementation(libs.testCore)
androidTestImplementation(project(":compose:ui:ui-tooling-data"))
androidTestImplementation(project(":compose:ui:ui"))
androidTestImplementation(project(":compose:ui:ui-util"))
androidTestImplementation(project(":compose:ui:ui-test-junit4"))
androidTestImplementation(project(":compose:material:material"))
androidTestImplementation(project(":inspection:inspection-testing"))
androidTestImplementation("androidx.activity:activity-compose:1.3.1")
androidTestImplementation(libs.testRunner)
androidTestImplementation(libs.testExtJunit)
androidTestImplementation(libs.truth)
}
androidx {
name = "Android Compose Layout Inspector"
type = LibraryType.IDE_PLUGIN
mavenGroup = LibraryGroups.Compose.UI
inceptionYear = "2021"
description = "Compose layout inspector. Exposes information to our tools for better IDE support."
}
android {
defaultConfig {
// layout inspection supported starting on Android Q
minSdkVersion 29
}
sourceSets {
main.resources.srcDirs += "src/main/proto"
}
externalNativeBuild {
cmake {
path "src/main/cpp/CMakeLists.txt"
version libs.versions.cmake.get()
}
}
lintOptions {
// Restriction not important for inspectors, which only runs at dev-time
disable("SyntheticAccessor")
}
}
tasks.withType(KotlinCompile).configureEach {
kotlinOptions {
freeCompilerArgs += [
"-Xopt-in=kotlin.RequiresOptIn",
"-P", "plugin:androidx.compose.compiler.plugins.kotlin:sourceInformation=true"
]
}
}
inspection {
name = "compose-ui-inspection.jar"
}