Add a build rule for files used by mdns

mdns may be imported in other non-AOSP projects as a library, along with
its dependencies from net-utils-device-common. While all of
net-utils-device-common may not build against system API, this requires
the files used by mdns to build against system API.

Add a library to allow checking that the dependencies can still build
against system API.

Test: m
Bug: 272392042
Change-Id: I468f53b47ef55c23137594a79599b148084f4535
This commit is contained in:
Yuyang Huang 2023-03-29 16:51:09 +09:00
commit f67388b0ff

View file

@ -328,6 +328,38 @@ java_library {
lint: { strict_updatability_linting: true },
}
// Limited set of utilities for use by service-connectivity-mdns-standalone-build-test, to make sure
// the mDNS code can build with only system APIs.
// The mDNS code is platform code so it should use framework-annotations-lib, contrary to apps that
// should use sdk_version: "system_current" and only androidx.annotation_annotation. But this build
// rule verifies that the mDNS code can be built into apps, if code transformations are applied to
// the annotations.
// When using "system_current", framework annotations are not available; they would appear as
// package-private as they are marked as such in the system_current stubs. So build against
// core_platform and add the stubs manually in "libs". See http://b/147773144#comment7.
java_library {
name: "net-utils-device-common-mdns-standalone-build-test",
// Build against core_platform and add the stub libraries manually in "libs", as annotations
// are already included in android_system_stubs_current but package-private, so
// "framework-annotations-lib" needs to be manually included before
// "android_system_stubs_current" (b/272392042)
sdk_version: "core_platform",
srcs: [
"device/com/android/net/module/util/FdEventsReader.java",
"device/com/android/net/module/util/HexDump.java",
"device/com/android/net/module/util/SharedLog.java",
"framework/com/android/net/module/util/ByteUtils.java",
"framework/com/android/net/module/util/CollectionUtils.java",
"framework/com/android/net/module/util/LinkPropertiesUtils.java",
],
libs: [
"framework-annotations-lib",
"android_system_stubs_current",
"androidx.annotation_annotation",
],
visibility: ["//packages/modules/Connectivity/service-t"],
}
// Use a filegroup and not a library for telephony sources, as framework-annotations cannot be
// included either (some annotations would be duplicated on the bootclasspath).
filegroup {