blob: a774af7a6ff2ae6b93547b0f25a24b3fdcfbf912 [file] [log] [blame]
load("//tools/base/bazel:bazel.bzl", "iml_module")
load("//tools/base/bazel:kotlin.bzl", "kotlin_library", "kotlin_test")
load("//tools/base/bazel:proto.bzl", "java_proto_library")
# managed by go/iml_to_build
iml_module(
name = "studio.android.sdktools.adblib",
srcs = ["src"],
iml_files = ["android.sdktools.adblib.iml"],
lint_baseline = "lint_baseline.xml",
test_srcs = ["test/src"],
visibility = ["//visibility:public"],
# do not sort: must match IML order
deps = [
"@intellij//:intellij-sdk",
"@intellij//:com.intellij.java",
"//tools/adt/idea/.idea/libraries:kotlin-test[test]",
"//tools/base/fakeadbserver:studio.android.sdktools.fakeadbserver[module, test]",
"//tools/adt/idea/.idea/libraries:libadb-server-proto",
],
)
# Build adblib as a standalone library, with side effect of ensuring that adblib does not
# use unwanted dependencies from "studio-sdk" in the iml_module rule above
# Build with: bazel build //tools/base/adblib:adblib
kotlin_library(
name = "adblib",
srcs = glob([
"src/**/*.kt",
]),
lint_baseline = "lint_baseline_adblib.xml",
resource_strip_prefix = "tools/base/adblib",
visibility = [
"//tools/base/adb-proxy:__subpackages__",
"//tools/base/adblib-ddmlibcompatibility:__subpackages__",
"//tools/base/adblib-tools:__subpackages__",
"//tools/base/deploy/deployer:__subpackages__",
"//tools/vendor/google/directaccess-client:__subpackages__",
],
deps = [
"@maven//:org.jetbrains.kotlin.kotlin-stdlib-jdk8",
"@maven//:org.jetbrains.kotlinx.kotlinx-coroutines-core",
# Required to build the java file generated by ":app-processes-proto" rule
"@maven//:com.google.protobuf.protobuf-java",
# See rule at end of this file
":adb-server-proto",
],
)
# Test adblib as a standalone library, with side effect of ensuring that adblib does not
# use unwanted dependencies from "studio-sdk" in the iml_module rule above
# Run tests with: bazel test //tools/base/adblib:adblib.tests.test
kotlin_test(
name = "adblib.tests",
# buildifier: disable=bad-recursive-glob
srcs = glob([
"test/src/**/*.kt",
"test/src/**/*.java",
]),
# So that we can use adblib "internal" classes/functions from Unit Tests
friends = [":adblib"],
jvm_flags = ["-Dtest.suite.jar=adblib.tests.jar"],
lint_baseline = "lint_baseline_tests.xml",
test_class = "com.android.testutils.JarTestSuite",
visibility = [
"//tools/base/adblib-ddmlibcompatibility:__subpackages__",
"//tools/base/adblib-tools:__subpackages__",
],
deps = [
":adblib",
# For "JarTestSuite"
"//tools/base/testutils:tools.testutils",
# For JUnit4 support
"@maven//:junit.junit",
# FakeAdbServer
"//tools/base/fakeadbserver:tools.fakeadbserver",
],
)
#
# Rule to compile 'proto/app_processes.proto' for the stand-alone "kotlin_library" version
# of adblib. This compiles the proto into the "com.android.server.adb.protos" package.
#
java_proto_library(
# buildifier: disable=java_proto_library-naming
name = "adb-server-proto",
srcs = [
"proto/app_processes.proto",
"proto/devices.proto",
],
visibility = ["//visibility:public"],
)