1// Copyright (C) 2019 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15// 1. The "net-utils-framework-common" library is also compiled into the framework and placed on the
16//    boot classpath. It uses jarjar rules so that anything outside the framework can use this
17//    library directly.
18// 2. The "net-utils-services-common" library is for use by modules and frameworks/base/services.
19//    It does not need to be jarjared because it is not placed on the bootclasspath.
20// 3. The "net-utils-telephony-common-srcs" filegroup is for use specifically by telephony, which
21//    places many of its classes, even non-API service classes, on the boot classpath. Any file that
22//    is added to this filegroup *must* have a corresponding jarjar rule in the telephony jarjar
23//    rules file. Otherwise, it will end up on the boot classpath and other modules will not be able
24//    to provide their own copy.
25
26// Note: all filegroups here must have the right path attribute because otherwise, if they are
27// included in the bootclasspath, they could incorrectly be included in the SDK documentation even
28// though they are not in the current.txt files.
29
30filegroup {
31    name: "net-utils-framework-common-srcs",
32    srcs: ["src_frameworkcommon/**/*.java"],
33    path: "src_frameworkcommon",
34    visibility: ["//frameworks/base"],
35}
36
37java_library {
38    name: "net-utils-framework-common",
39    srcs: [
40        ":net-utils-framework-common-srcs",
41        // TODO: avoid including all framework annotations as they end up in library users jars
42        // and need jarjaring
43        ":framework-annotations",
44    ],
45    sdk_version: "system_current",
46    jarjar_rules: "jarjar-rules-shared.txt",
47    visibility: [
48        "//cts/tests/tests/net",
49        "//frameworks/base/packages/Tethering",
50        "//frameworks/opt/net/ike",
51        "//frameworks/opt/telephony",
52        "//packages/modules/NetworkStack",
53        "//packages/modules/CaptivePortalLogin",
54        "//frameworks/libs/net/common/tests:__subpackages__",
55    ]
56}
57
58java_library {
59    name: "net-utils-services-common",
60    srcs: [
61        "src_servicescommon/**/*.java",
62        ":framework-annotations",
63    ],
64    sdk_version: "system_current",
65    visibility: [
66        "//frameworks/base/services/net",
67        "//frameworks/base/packages/Tethering",
68        "//frameworks/opt/net/ike",
69        "//packages/modules/NetworkStack",
70        "//packages/modules/CaptivePortalLogin",
71        "//frameworks/libs/net/common/tests:__subpackages__",
72    ],
73}
74
75// Use a filegroup and not a library for telephony sources, as framework-annotations cannot be
76// included either (some annotations would be duplicated on the bootclasspath).
77filegroup {
78    name: "net-utils-telephony-common-srcs",
79    srcs: [
80        // Any class here *must* have a corresponding jarjar rule in the telephony build rules.
81        "src_servicescommon/android/net/NetworkFactory.java",
82    ],
83    path: "src_servicescommon",
84    visibility: [
85        "//frameworks/opt/telephony",
86    ],
87}
88
89// Use a filegroup and not a library for wifi sources, as this needs corresponding jar-jar
90// rules on the wifi side.
91// Any class here *must* have a corresponding jarjar rule in the wifi build rules.
92filegroup {
93    name: "net-utils-framework-wifi-common-srcs",
94    srcs: [
95        "src_frameworkcommon/android/net/util/nsd/DnsSdTxtRecord.java",
96        "src_frameworkcommon/android/net/util/MacAddressUtils.java",
97        "src_frameworkcommon/com/android/net/module/util/**/*.java",
98    ],
99    path: "src_frameworkcommon",
100    visibility: [
101        "//frameworks/base",
102    ],
103}
104
105// Use a filegroup and not a library for wifi sources, as this needs corresponding jar-jar
106// rules on the wifi side.
107// Any class here *must* have a corresponding jarjar rule in the wifi build rules.
108filegroup {
109    name: "net-utils-wifi-service-common-srcs",
110    srcs: [
111        "src_frameworkcommon/android/net/util/NetUtils.java",
112        "src_servicescommon/android/net/NetworkFactory.java",
113    ],
114    visibility: [
115        "//frameworks/opt/net/wifi/service",
116    ],
117}
118