156 lines
4.6 KiB
Plaintext
Raw Normal View History

// Copyright (C) 2019 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.
java_defaults {
name: "wifi-module-sdk-version-defaults",
min_sdk_version: "30",
target_sdk_version: "30",
}
filegroup {
name: "framework-wifi-updatable-exported-aidl-sources",
srcs: ["aidl-export/**/*.aidl"],
path: "aidl-export",
visibility: ["//visibility:private"],
}
filegroup {
name: "framework-wifi-updatable-java-sources",
srcs: [
"java/**/*.java",
"java/**/*.aidl",
],
path: "java",
visibility: ["//visibility:private"],
}
filegroup {
name: "framework-wifi-updatable-sources",
srcs: [
":framework-wifi-updatable-java-sources",
":framework-wifi-updatable-exported-aidl-sources",
":module-utils-os-aidls",
],
}
filegroup {
name: "framework-wifi-annotations",
srcs: ["java/android/net/wifi/WifiAnnotations.java"],
}
// list of tests that are allowed to access @hide APIs from framework-wifi
test_access_hidden_api_whitelist = [
"//frameworks/base/wifi/tests",
"//frameworks/base/wifi/non-updatable/tests",
"//frameworks/opt/net/wifi/tests/wifitests:__subpackages__",
"//packages/modules/Wifi/framework/tests",
"//packages/modules/Wifi/service/tests/wifitests:__subpackages__",
"//external/robolectric-shadows:__subpackages__",
"//frameworks/base/packages/SettingsLib/tests/integ",
"//external/sl4a:__subpackages__",
]
// defaults shared between `framework-wifi` & `framework-wifi-pre-jarjar`
// java_sdk_library `framework-wifi` needs sources to generate stubs, so it cannot reuse
// `framework-wifi-pre-jarjar`
java_defaults {
name: "framework-wifi-defaults",
defaults: ["wifi-module-sdk-version-defaults"],
static_libs: [
"framework-wifi-util-lib",
"android.hardware.wifi-V1.0-java-constants",
"modules-utils-build",
"modules-utils-os",
],
libs: [
"unsupportedappusage", // for android.compat.annotation.UnsupportedAppUsage
],
srcs: [
":framework-wifi-updatable-sources",
":module-utils-os-aidls",
],
}
// wifi-service needs pre-jarjared version of framework-wifi so it can reference copied utility
// classes before they are renamed.
java_library {
name: "framework-wifi-pre-jarjar",
defaults: ["framework-wifi-defaults"],
sdk_version: "module_current",
libs: ["framework-annotations-lib"],
// java_api_finder must accompany `srcs` (`srcs` defined in `framework-wifi-defaults`)
plugins: ["java_api_finder"],
installable: false,
visibility: [
"//frameworks/opt/net/wifi/service",
"//frameworks/opt/net/wifi/tests/wifitests",
],
}
// post-jarjar version of framework-wifi
Switch framework-wifi to use java_sdk_library Had to build from srcs rather than statically linking to framework-wifi-pre-jarjar as java_sdk_library requires srcs because otherwise it cannot generate the stubs source or the API. The names of the individual modules do not quite follow the pattern that java_sdk_library uses so this temporarily sets the following: naming_scheme: "frameworks-modules" That causes java_sdk_library to use a naming scheme that matches the one used by the individual modules of this. It will be cleaned up later. Part of the purpose of the java_sdk_library is to hide the implementation code and force users of the library to depend on stubs for a well defined API. Ideally, it would allow access to the implementation in those cases where it is safe, e.g. from within the same APEX, or from tests for the implementation. Unfortunately, due to limitations in the build it does not yet have enough information to make that decision correctly which means that any code that needs to compile against the implementation is broken which would prevent us from converting the module to java_sdk_library. However, the only way to provide the additional information to allow the implementation to be correctly exposed is to convert the modules to java_sdk_library; a cycle. In order to break that cycle the java_sdk_library creates a special <module>.impl target which is used directly by tests and any other code that needs it. Once all the modules have been converted to a java_sdk_library then we can resolve the limitations in the build and remove the direct references to <module>.impl. Test: m droid checkapi Bug: 155164730 Change-Id: I5e1172761f260cf6a0b4f17e5247af92c520407f
2020-05-13 20:33:29 +01:00
java_sdk_library {
name: "framework-wifi",
defaults: [
"framework-module-defaults",
"framework-wifi-defaults",
],
Switch framework-wifi to use java_sdk_library Had to build from srcs rather than statically linking to framework-wifi-pre-jarjar as java_sdk_library requires srcs because otherwise it cannot generate the stubs source or the API. The names of the individual modules do not quite follow the pattern that java_sdk_library uses so this temporarily sets the following: naming_scheme: "frameworks-modules" That causes java_sdk_library to use a naming scheme that matches the one used by the individual modules of this. It will be cleaned up later. Part of the purpose of the java_sdk_library is to hide the implementation code and force users of the library to depend on stubs for a well defined API. Ideally, it would allow access to the implementation in those cases where it is safe, e.g. from within the same APEX, or from tests for the implementation. Unfortunately, due to limitations in the build it does not yet have enough information to make that decision correctly which means that any code that needs to compile against the implementation is broken which would prevent us from converting the module to java_sdk_library. However, the only way to provide the additional information to allow the implementation to be correctly exposed is to convert the modules to java_sdk_library; a cycle. In order to break that cycle the java_sdk_library creates a special <module>.impl target which is used directly by tests and any other code that needs it. Once all the modules have been converted to a java_sdk_library then we can resolve the limitations in the build and remove the direct references to <module>.impl. Test: m droid checkapi Bug: 155164730 Change-Id: I5e1172761f260cf6a0b4f17e5247af92c520407f
2020-05-13 20:33:29 +01:00
jarjar_rules: ":wifi-jarjar-rules",
installable: true,
optimize: {
enabled: false
},
hostdex: true, // for hiddenapi check
// Restrict access to implementation library.
impl_library_visibility: [
"//frameworks/opt/net/wifi/service:__subpackages__",
] + test_access_hidden_api_whitelist,
apex_available: [
"com.android.wifi",
"test_com.android.wifi",
],
permitted_packages: [
"android.hardware.wifi",
"android.net.wifi",
// Created by jarjar rules.
"com.android.wifi.x",
],
}
// defaults for tests that need to build against framework-wifi's @hide APIs
java_defaults {
name: "framework-wifi-test-defaults",
sdk_version: "core_current",
libs: [
// order matters: classes in framework-wifi are resolved before framework, meaning
// @hide APIs in framework-wifi are resolved before @SystemApi stubs in framework
Switch framework-wifi to use java_sdk_library Had to build from srcs rather than statically linking to framework-wifi-pre-jarjar as java_sdk_library requires srcs because otherwise it cannot generate the stubs source or the API. The names of the individual modules do not quite follow the pattern that java_sdk_library uses so this temporarily sets the following: naming_scheme: "frameworks-modules" That causes java_sdk_library to use a naming scheme that matches the one used by the individual modules of this. It will be cleaned up later. Part of the purpose of the java_sdk_library is to hide the implementation code and force users of the library to depend on stubs for a well defined API. Ideally, it would allow access to the implementation in those cases where it is safe, e.g. from within the same APEX, or from tests for the implementation. Unfortunately, due to limitations in the build it does not yet have enough information to make that decision correctly which means that any code that needs to compile against the implementation is broken which would prevent us from converting the module to java_sdk_library. However, the only way to provide the additional information to allow the implementation to be correctly exposed is to convert the modules to java_sdk_library; a cycle. In order to break that cycle the java_sdk_library creates a special <module>.impl target which is used directly by tests and any other code that needs it. Once all the modules have been converted to a java_sdk_library then we can resolve the limitations in the build and remove the direct references to <module>.impl. Test: m droid checkapi Bug: 155164730 Change-Id: I5e1172761f260cf6a0b4f17e5247af92c520407f
2020-05-13 20:33:29 +01:00
"framework-wifi.impl",
"framework",
// if sdk_version="" this gets automatically included, but here we need to add manually.
"framework-res",
],
visibility: test_access_hidden_api_whitelist,
}
filegroup {
name: "wifi-jarjar-rules",
srcs: ["jarjar-rules.txt"],
}