From 3aa62e67737dadf09e9ede71033a4107a8bb741d Mon Sep 17 00:00:00 2001 From: Yang Sun Date: Tue, 12 Mar 2024 21:23:19 +0800 Subject: [PATCH] Separate Struct.java into its own lib. * Struct.java is removed from net-utils-device-common-bpf and net-utils-device-common-struct's source list * Created a lib net-utils-device-common-struct-base for Struct.java * Updated libs that require Struct.java to include net-utils-device-common-struct-base. * Replaced net-utils-multicast-forwarding-structs with net-utils-device-common-struct in service-connectivity Bug: 323503345 Test: build tethering module. Change-Id: I3f60715c3d8043b7569db7612dee9d4fa1ccba59 --- Tethering/Android.bp | 4 +-- Tethering/tests/integration/Android.bp | 1 + Tethering/tests/mts/Android.bp | 1 + common/Android.bp | 4 +-- framework/Android.bp | 2 ++ service/Android.bp | 4 ++- staticlibs/Android.bp | 36 ++++++++++++++------------ staticlibs/tests/unit/Android.bp | 1 + staticlibs/testutils/Android.bp | 1 + thread/service/Android.bp | 3 +++ thread/tests/integration/Android.bp | 1 + thread/tests/utils/Android.bp | 1 + 12 files changed, 38 insertions(+), 21 deletions(-) diff --git a/Tethering/Android.bp b/Tethering/Android.bp index e4e6c707e8..19bcff9a49 100644 --- a/Tethering/Android.bp +++ b/Tethering/Android.bp @@ -74,6 +74,8 @@ java_defaults { "net-utils-device-common-bpf", "net-utils-device-common-ip", "net-utils-device-common-netlink", + "net-utils-device-common-struct", + "net-utils-device-common-struct-base", "netd-client", "tetheringstatsprotos", ], @@ -98,7 +100,6 @@ android_library { ], static_libs: [ "NetworkStackApiCurrentShims", - "net-utils-device-common-struct", ], apex_available: ["com.android.tethering"], lint: { @@ -115,7 +116,6 @@ android_library { ], static_libs: [ "NetworkStackApiStableShims", - "net-utils-device-common-struct", ], apex_available: ["com.android.tethering"], lint: { diff --git a/Tethering/tests/integration/Android.bp b/Tethering/tests/integration/Android.bp index 07fa7339fe..337d408930 100644 --- a/Tethering/tests/integration/Android.bp +++ b/Tethering/tests/integration/Android.bp @@ -33,6 +33,7 @@ java_defaults { "net-tests-utils", "net-utils-device-common", "net-utils-device-common-bpf", + "net-utils-device-common-struct-base", "testables", "connectivity-net-module-utils-bpf", ], diff --git a/Tethering/tests/mts/Android.bp b/Tethering/tests/mts/Android.bp index a80e49e43d..c4d5636f0f 100644 --- a/Tethering/tests/mts/Android.bp +++ b/Tethering/tests/mts/Android.bp @@ -45,6 +45,7 @@ android_test { "junit-params", "connectivity-net-module-utils-bpf", "net-utils-device-common-bpf", + "net-utils-device-common-struct-base", ], jni_libs: [ diff --git a/common/Android.bp b/common/Android.bp index 0048a0a59a..5fabf414e5 100644 --- a/common/Android.bp +++ b/common/Android.bp @@ -26,7 +26,7 @@ build = ["FlaggedApi.bp"] // as the above target may not exist // depending on the branch -// The library requires the final artifact to contain net-utils-device-common-struct. +// The library requires the final artifact to contain net-utils-device-common-struct-base. java_library { name: "connectivity-net-module-utils-bpf", srcs: [ @@ -45,7 +45,7 @@ java_library { // For libraries which are statically linked in framework-connectivity, do not // statically link here because callers of this library might already have a static // version linked. - "net-utils-device-common-struct", + "net-utils-device-common-struct-base", ], apex_available: [ "com.android.tethering", diff --git a/framework/Android.bp b/framework/Android.bp index 52f2c7c268..8787167a94 100644 --- a/framework/Android.bp +++ b/framework/Android.bp @@ -96,6 +96,7 @@ java_defaults { ], impl_only_static_libs: [ "net-utils-device-common-bpf", + "net-utils-device-common-struct-base", ], libs: [ "androidx.annotation_annotation", @@ -124,6 +125,7 @@ java_library { // Even if the library is included in "impl_only_static_libs" of defaults. This is still // needed because java_library which doesn't understand "impl_only_static_libs". "net-utils-device-common-bpf", + "net-utils-device-common-struct-base", ], libs: [ // This cannot be in the defaults clause above because if it were, it would be used diff --git a/service/Android.bp b/service/Android.bp index c35c4f853f..1d74efcf31 100644 --- a/service/Android.bp +++ b/service/Android.bp @@ -199,7 +199,9 @@ java_library { "PlatformProperties", "service-connectivity-protos", "service-connectivity-stats-protos", - "net-utils-multicast-forwarding-structs", + // The required dependency net-utils-device-common-struct-base is in the classpath via + // framework-connectivity + "net-utils-device-common-struct", ], apex_available: [ "com.android.tethering", diff --git a/staticlibs/Android.bp b/staticlibs/Android.bp index f7b42a6214..ede6d3f5af 100644 --- a/staticlibs/Android.bp +++ b/staticlibs/Android.bp @@ -124,6 +124,8 @@ filegroup { ], } +// The net-utils-device-common-bpf library requires the callers to contain +// net-utils-device-common-struct-base. java_library { name: "net-utils-device-common-bpf", srcs: [ @@ -133,9 +135,7 @@ java_library { "device/com/android/net/module/util/BpfUtils.java", "device/com/android/net/module/util/IBpfMap.java", "device/com/android/net/module/util/JniUtil.java", - "device/com/android/net/module/util/Struct.java", "device/com/android/net/module/util/TcUtils.java", - "framework/com/android/net/module/util/HexDump.java", ], sdk_version: "module_current", min_sdk_version: "30", @@ -146,6 +146,7 @@ java_library { libs: [ "androidx.annotation_annotation", "framework-connectivity.stubs.module_lib", + "net-utils-device-common-struct-base", ], apex_available: [ "com.android.tethering", @@ -158,12 +159,9 @@ java_library { } java_library { - name: "net-utils-device-common-struct", + name: "net-utils-device-common-struct-base", srcs: [ - "device/com/android/net/module/util/Ipv6Utils.java", - "device/com/android/net/module/util/PacketBuilder.java", "device/com/android/net/module/util/Struct.java", - "device/com/android/net/module/util/structs/*.java", ], sdk_version: "module_current", min_sdk_version: "30", @@ -176,6 +174,7 @@ java_library { ], libs: [ "androidx.annotation_annotation", + "framework-annotations-lib", // Required by InetAddressUtils.java "framework-connectivity.stubs.module_lib", ], apex_available: [ @@ -188,26 +187,30 @@ java_library { }, } -// The net-utils-multicast-forwarding-structs library requires the callers to -// contain net-utils-device-common-bpf. +// The net-utils-device-common-struct library requires the callers to contain +// net-utils-device-common-struct-base. java_library { - name: "net-utils-multicast-forwarding-structs", + name: "net-utils-device-common-struct", srcs: [ - "device/com/android/net/module/util/structs/StructMf6cctl.java", - "device/com/android/net/module/util/structs/StructMif6ctl.java", - "device/com/android/net/module/util/structs/StructMrt6Msg.java", + "device/com/android/net/module/util/Ipv6Utils.java", + "device/com/android/net/module/util/PacketBuilder.java", + "device/com/android/net/module/util/structs/*.java", ], sdk_version: "module_current", min_sdk_version: "30", visibility: [ "//packages/modules/Connectivity:__subpackages__", + "//packages/modules/NetworkStack:__subpackages__", ], libs: [ - // Only Struct.java is needed from "net-utils-device-common-bpf" - "net-utils-device-common-bpf", + "androidx.annotation_annotation", + "framework-annotations-lib", // Required by IpUtils.java + "framework-connectivity.stubs.module_lib", + "net-utils-device-common-struct-base", ], apex_available: [ "com.android.tethering", + "//apex_available:platform", ], lint: { strict_updatability_linting: true, @@ -216,7 +219,7 @@ java_library { } // The net-utils-device-common-netlink library requires the callers to contain -// net-utils-device-common-struct. +// net-utils-device-common-struct and net-utils-device-common-struct-base. java_library { name: "net-utils-device-common-netlink", srcs: [ @@ -235,6 +238,7 @@ java_library { // statically link here because callers of this library might already have a static // version linked. "net-utils-device-common-struct", + "net-utils-device-common-struct-base", ], apex_available: [ "com.android.tethering", @@ -247,7 +251,7 @@ java_library { } // The net-utils-device-common-ip library requires the callers to contain -// net-utils-device-common-struct. +// net-utils-device-common-struct and net-utils-device-common-struct-base. java_library { // TODO : this target should probably be folded into net-utils-device-common name: "net-utils-device-common-ip", diff --git a/staticlibs/tests/unit/Android.bp b/staticlibs/tests/unit/Android.bp index 4c226cccdc..fa466f8b74 100644 --- a/staticlibs/tests/unit/Android.bp +++ b/staticlibs/tests/unit/Android.bp @@ -25,6 +25,7 @@ android_library { "net-utils-device-common-async", "net-utils-device-common-bpf", "net-utils-device-common-ip", + "net-utils-device-common-struct-base", "net-utils-device-common-wear", ], libs: [ diff --git a/staticlibs/testutils/Android.bp b/staticlibs/testutils/Android.bp index a8e5a69e02..9124ac089f 100644 --- a/staticlibs/testutils/Android.bp +++ b/staticlibs/testutils/Android.bp @@ -40,6 +40,7 @@ java_library { "net-utils-device-common-async", "net-utils-device-common-netlink", "net-utils-device-common-struct", + "net-utils-device-common-struct-base", "net-utils-device-common-wear", "modules-utils-build_system", ], diff --git a/thread/service/Android.bp b/thread/service/Android.bp index 6e2fac1dc7..a82a49945a 100644 --- a/thread/service/Android.bp +++ b/thread/service/Android.bp @@ -45,6 +45,9 @@ java_library { "modules-utils-shell-command-handler", "net-utils-device-common", "net-utils-device-common-netlink", + // The required dependency net-utils-device-common-struct-base is in the classpath via + // framework-connectivity + "net-utils-device-common-struct", "ot-daemon-aidl-java", ], apex_available: ["com.android.tethering"], diff --git a/thread/tests/integration/Android.bp b/thread/tests/integration/Android.bp index 9677ec58bd..94985b1abb 100644 --- a/thread/tests/integration/Android.bp +++ b/thread/tests/integration/Android.bp @@ -30,6 +30,7 @@ java_defaults { "net-tests-utils", "net-utils-device-common", "net-utils-device-common-bpf", + "net-utils-device-common-struct-base", "testables", "ThreadNetworkTestUtils", "truth", diff --git a/thread/tests/utils/Android.bp b/thread/tests/utils/Android.bp index 24e9bb9c8f..726ec9d84c 100644 --- a/thread/tests/utils/Android.bp +++ b/thread/tests/utils/Android.bp @@ -27,6 +27,7 @@ java_library { "net-tests-utils", "net-utils-device-common", "net-utils-device-common-bpf", + "net-utils-device-common-struct-base", ], srcs: [ "src/**/*.java",