Placeholder for enforcement of the legacy core/platform API restriction.
This does is as similar as possible to the equivalent changes in AOSP
and internal masters, without actually doing any enforcement. This
means we don't have to maintain a third hard-coded list for rvc, while
minimizing the diffs. The list here is identical to the one in AOSP
master, so changes from there should merge down cleanly (and have no
effect).
Test: m java checkapi
Bug: 157640067
Change-Id: Iaa97ddaa015e8079fcb3426585c5101c7ec9e22a
Merged-In: I15e5a6c2f07e73718803501d705de0d7ab9bec90
(cherry picked from commit c0f4373106
)
This commit is contained in:
@@ -38,6 +38,7 @@ bootstrap_go_package {
|
|||||||
"java_resources.go",
|
"java_resources.go",
|
||||||
"kotlin.go",
|
"kotlin.go",
|
||||||
"lint.go",
|
"lint.go",
|
||||||
|
"legacy_core_platform_api_usage.go",
|
||||||
"platform_compat_config.go",
|
"platform_compat_config.go",
|
||||||
"plugin.go",
|
"plugin.go",
|
||||||
"prebuilt_apis.go",
|
"prebuilt_apis.go",
|
||||||
|
@@ -30,6 +30,8 @@ var (
|
|||||||
|
|
||||||
LegacyCorePlatformBootclasspathLibraries = []string{"legacy.core.platform.api.stubs", "core-lambda-stubs"}
|
LegacyCorePlatformBootclasspathLibraries = []string{"legacy.core.platform.api.stubs", "core-lambda-stubs"}
|
||||||
LegacyCorePlatformSystemModules = "legacy-core-platform-api-stubs-system-modules"
|
LegacyCorePlatformSystemModules = "legacy-core-platform-api-stubs-system-modules"
|
||||||
|
StableCorePlatformBootclasspathLibraries = []string{"stable.core.platform.api.stubs", "core-lambda-stubs"}
|
||||||
|
StableCorePlatformSystemModules = "stable-core-platform-api-stubs-system-modules"
|
||||||
FrameworkLibraries = []string{"ext", "framework"}
|
FrameworkLibraries = []string{"ext", "framework"}
|
||||||
DefaultLambdaStubsLibrary = "core-lambda-stubs"
|
DefaultLambdaStubsLibrary = "core-lambda-stubs"
|
||||||
SdkLambdaStubsPath = "prebuilts/sdk/tools/core-lambda-stubs.jar"
|
SdkLambdaStubsPath = "prebuilts/sdk/tools/core-lambda-stubs.jar"
|
||||||
|
173
java/legacy_core_platform_api_usage.go
Normal file
173
java/legacy_core_platform_api_usage.go
Normal file
@@ -0,0 +1,173 @@
|
|||||||
|
// Copyright 2020 Google Inc. All rights reserved.
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
|
||||||
|
package java
|
||||||
|
|
||||||
|
import (
|
||||||
|
"android/soong/android"
|
||||||
|
"android/soong/java/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
// This variable is effectively unused in pre-master branches, and is
|
||||||
|
// included (with the same value as it has in AOSP) only to ease
|
||||||
|
// merges between branches (see the comment in the
|
||||||
|
// useLegacyCorePlatformApi() function):
|
||||||
|
var legacyCorePlatformApiModules = []string{
|
||||||
|
"ahat-test-dump",
|
||||||
|
"android.car",
|
||||||
|
"android.test.mock",
|
||||||
|
"android.test.mock.impl",
|
||||||
|
"AoapTestDeviceApp",
|
||||||
|
"AoapTestHostApp",
|
||||||
|
"api-stubs-docs",
|
||||||
|
"art_cts_jvmti_test_library",
|
||||||
|
"art-gtest-jars-MyClassNatives",
|
||||||
|
"BackupFrameworksServicesRoboTests",
|
||||||
|
"BandwidthEnforcementTest",
|
||||||
|
"BlockedNumberProvider",
|
||||||
|
"BluetoothInstrumentationTests",
|
||||||
|
"BluetoothMidiService",
|
||||||
|
"car-apps-common",
|
||||||
|
"CertInstaller",
|
||||||
|
"ConnectivityManagerTest",
|
||||||
|
"ContactsProvider",
|
||||||
|
"core-tests-support",
|
||||||
|
"CtsContentTestCases",
|
||||||
|
"CtsIkeTestCases",
|
||||||
|
"CtsLibcoreWycheproofBCTestCases",
|
||||||
|
"CtsMediaTestCases",
|
||||||
|
"CtsNetTestCases",
|
||||||
|
"CtsNetTestCasesLatestSdk",
|
||||||
|
"CtsSecurityTestCases",
|
||||||
|
"CtsUsageStatsTestCases",
|
||||||
|
"DisplayCutoutEmulationEmu01Overlay",
|
||||||
|
"DocumentsUIPerfTests",
|
||||||
|
"DocumentsUITests",
|
||||||
|
"DownloadProvider",
|
||||||
|
"DownloadProviderTests",
|
||||||
|
"DownloadProviderUi",
|
||||||
|
"DynamicSystemInstallationService",
|
||||||
|
"EmergencyInfo-lib",
|
||||||
|
"ethernet-service",
|
||||||
|
"EthernetServiceTests",
|
||||||
|
"ExternalStorageProvider",
|
||||||
|
"ExtServices",
|
||||||
|
"ExtServices-core",
|
||||||
|
"framework-all",
|
||||||
|
"framework-minus-apex",
|
||||||
|
"FrameworksCoreTests",
|
||||||
|
"FrameworksIkeTests",
|
||||||
|
"FrameworksNetCommonTests",
|
||||||
|
"FrameworksNetTests",
|
||||||
|
"FrameworksServicesRoboTests",
|
||||||
|
"FrameworksServicesTests",
|
||||||
|
"FrameworksUtilTests",
|
||||||
|
"hid",
|
||||||
|
"hidl_test_java_java",
|
||||||
|
"hwbinder",
|
||||||
|
"ims",
|
||||||
|
"KeyChain",
|
||||||
|
"ksoap2",
|
||||||
|
"LocalTransport",
|
||||||
|
"lockagent",
|
||||||
|
"mediaframeworktest",
|
||||||
|
"MediaProvider",
|
||||||
|
"MmsService",
|
||||||
|
"MtpDocumentsProvider",
|
||||||
|
"MultiDisplayProvider",
|
||||||
|
"NetworkStackIntegrationTestsLib",
|
||||||
|
"NetworkStackNextIntegrationTests",
|
||||||
|
"NetworkStackNextTests",
|
||||||
|
"NetworkStackTests",
|
||||||
|
"NetworkStackTestsLib",
|
||||||
|
"NfcNci",
|
||||||
|
"platform_library-docs",
|
||||||
|
"PrintSpooler",
|
||||||
|
"RollbackTest",
|
||||||
|
"services",
|
||||||
|
"services.accessibility",
|
||||||
|
"services.backup",
|
||||||
|
"services.core.unboosted",
|
||||||
|
"services.devicepolicy",
|
||||||
|
"services.print",
|
||||||
|
"services.usage",
|
||||||
|
"services.usb",
|
||||||
|
"Settings-core",
|
||||||
|
"SettingsLib",
|
||||||
|
"SettingsProvider",
|
||||||
|
"SettingsProviderTest",
|
||||||
|
"Shell",
|
||||||
|
"ShellTests",
|
||||||
|
"sl4a.Common",
|
||||||
|
"StatementService",
|
||||||
|
"SystemUI-core",
|
||||||
|
"SystemUISharedLib",
|
||||||
|
"SystemUI-tests",
|
||||||
|
"Telecom",
|
||||||
|
"TelecomUnitTests",
|
||||||
|
"telephony-common",
|
||||||
|
"TelephonyProvider",
|
||||||
|
"TelephonyProviderTests",
|
||||||
|
"TeleService",
|
||||||
|
"testables",
|
||||||
|
"TetheringTests",
|
||||||
|
"TetheringTestsLib",
|
||||||
|
"time_zone_distro_installer",
|
||||||
|
"time_zone_distro_installer-tests",
|
||||||
|
"time_zone_distro-tests",
|
||||||
|
"time_zone_updater",
|
||||||
|
"TvProvider",
|
||||||
|
"uiautomator-stubs-docs",
|
||||||
|
"UsbHostExternalManagementTestApp",
|
||||||
|
"UserDictionaryProvider",
|
||||||
|
"WallpaperBackup",
|
||||||
|
"wifi-service",
|
||||||
|
}
|
||||||
|
|
||||||
|
// This variable is effectively unused in pre-master branches, and is
|
||||||
|
// included (with the same value as it has in AOSP) only to ease
|
||||||
|
// merges between branches (see the comment in the
|
||||||
|
// useLegacyCorePlatformApi() function):
|
||||||
|
var legacyCorePlatformApiLookup = make(map[string]struct{})
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
for _, module := range legacyCorePlatformApiModules {
|
||||||
|
legacyCorePlatformApiLookup[module] = struct{}{}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func useLegacyCorePlatformApi(ctx android.EarlyModuleContext) bool {
|
||||||
|
// In pre-master branches, we don't attempt to force usage of the stable
|
||||||
|
// version of the core/platform API. Instead, we always use the legacy
|
||||||
|
// version --- except in tests, where we always use stable, so that we
|
||||||
|
// can make the test assertions the same as other branches.
|
||||||
|
// This should be false in tests and true otherwise:
|
||||||
|
return ctx.Config().TestProductVariables == nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func corePlatformSystemModules(ctx android.EarlyModuleContext) string {
|
||||||
|
if useLegacyCorePlatformApi(ctx) {
|
||||||
|
return config.LegacyCorePlatformSystemModules
|
||||||
|
} else {
|
||||||
|
return config.StableCorePlatformSystemModules
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func corePlatformBootclasspathLibraries(ctx android.EarlyModuleContext) []string {
|
||||||
|
if useLegacyCorePlatformApi(ctx) {
|
||||||
|
return config.LegacyCorePlatformBootclasspathLibraries
|
||||||
|
} else {
|
||||||
|
return config.StableCorePlatformBootclasspathLibraries
|
||||||
|
}
|
||||||
|
}
|
@@ -413,8 +413,8 @@ func decodeSdkDep(ctx android.EarlyModuleContext, sdkContext sdkContext) sdkDep
|
|||||||
case sdkPrivate:
|
case sdkPrivate:
|
||||||
return sdkDep{
|
return sdkDep{
|
||||||
useModule: true,
|
useModule: true,
|
||||||
systemModules: config.LegacyCorePlatformSystemModules,
|
systemModules: corePlatformSystemModules(ctx),
|
||||||
bootclasspath: config.LegacyCorePlatformBootclasspathLibraries,
|
bootclasspath: corePlatformBootclasspathLibraries(ctx),
|
||||||
classpath: config.FrameworkLibraries,
|
classpath: config.FrameworkLibraries,
|
||||||
frameworkResModule: "framework-res",
|
frameworkResModule: "framework-res",
|
||||||
}
|
}
|
||||||
@@ -438,8 +438,8 @@ func decodeSdkDep(ctx android.EarlyModuleContext, sdkContext sdkContext) sdkDep
|
|||||||
case sdkCorePlatform:
|
case sdkCorePlatform:
|
||||||
return sdkDep{
|
return sdkDep{
|
||||||
useModule: true,
|
useModule: true,
|
||||||
systemModules: config.LegacyCorePlatformSystemModules,
|
systemModules: corePlatformSystemModules(ctx),
|
||||||
bootclasspath: config.LegacyCorePlatformBootclasspathLibraries,
|
bootclasspath: corePlatformBootclasspathLibraries(ctx),
|
||||||
noFrameworksLibs: true,
|
noFrameworksLibs: true,
|
||||||
}
|
}
|
||||||
case sdkPublic:
|
case sdkPublic:
|
||||||
|
@@ -49,8 +49,8 @@ func TestClasspath(t *testing.T) {
|
|||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "default",
|
name: "default",
|
||||||
bootclasspath: config.LegacyCorePlatformBootclasspathLibraries,
|
bootclasspath: config.StableCorePlatformBootclasspathLibraries,
|
||||||
system: config.LegacyCorePlatformSystemModules,
|
system: config.StableCorePlatformSystemModules,
|
||||||
java8classpath: config.FrameworkLibraries,
|
java8classpath: config.FrameworkLibraries,
|
||||||
java9classpath: config.FrameworkLibraries,
|
java9classpath: config.FrameworkLibraries,
|
||||||
aidl: "-Iframework/aidl",
|
aidl: "-Iframework/aidl",
|
||||||
@@ -58,16 +58,16 @@ func TestClasspath(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: `sdk_version:"core_platform"`,
|
name: `sdk_version:"core_platform"`,
|
||||||
properties: `sdk_version:"core_platform"`,
|
properties: `sdk_version:"core_platform"`,
|
||||||
bootclasspath: config.LegacyCorePlatformBootclasspathLibraries,
|
bootclasspath: config.StableCorePlatformBootclasspathLibraries,
|
||||||
system: config.LegacyCorePlatformSystemModules,
|
system: config.StableCorePlatformSystemModules,
|
||||||
java8classpath: []string{},
|
java8classpath: []string{},
|
||||||
aidl: "",
|
aidl: "",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "blank sdk version",
|
name: "blank sdk version",
|
||||||
properties: `sdk_version: "",`,
|
properties: `sdk_version: "",`,
|
||||||
bootclasspath: config.LegacyCorePlatformBootclasspathLibraries,
|
bootclasspath: config.StableCorePlatformBootclasspathLibraries,
|
||||||
system: config.LegacyCorePlatformSystemModules,
|
system: config.StableCorePlatformSystemModules,
|
||||||
java8classpath: config.FrameworkLibraries,
|
java8classpath: config.FrameworkLibraries,
|
||||||
java9classpath: config.FrameworkLibraries,
|
java9classpath: config.FrameworkLibraries,
|
||||||
aidl: "-Iframework/aidl",
|
aidl: "-Iframework/aidl",
|
||||||
@@ -155,9 +155,9 @@ func TestClasspath(t *testing.T) {
|
|||||||
{
|
{
|
||||||
|
|
||||||
name: "nostdlib system_modules",
|
name: "nostdlib system_modules",
|
||||||
properties: `sdk_version: "none", system_modules: "legacy-core-platform-api-stubs-system-modules"`,
|
properties: `sdk_version: "none", system_modules: "stable-core-platform-api-stubs-system-modules"`,
|
||||||
system: "legacy-core-platform-api-stubs-system-modules",
|
system: "stable-core-platform-api-stubs-system-modules",
|
||||||
bootclasspath: []string{"legacy-core-platform-api-stubs-system-modules-lib"},
|
bootclasspath: []string{"stable-core-platform-api-stubs-system-modules-lib"},
|
||||||
java8classpath: []string{},
|
java8classpath: []string{},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@@ -135,7 +135,7 @@ func GatherRequiredDepsForTest() string {
|
|||||||
name: "%s",
|
name: "%s",
|
||||||
srcs: ["a.java"],
|
srcs: ["a.java"],
|
||||||
sdk_version: "none",
|
sdk_version: "none",
|
||||||
system_modules: "legacy-core-platform-api-stubs-system-modules",
|
system_modules: "stable-core-platform-api-stubs-system-modules",
|
||||||
}
|
}
|
||||||
`, extra)
|
`, extra)
|
||||||
}
|
}
|
||||||
@@ -145,7 +145,7 @@ func GatherRequiredDepsForTest() string {
|
|||||||
name: "framework",
|
name: "framework",
|
||||||
srcs: ["a.java"],
|
srcs: ["a.java"],
|
||||||
sdk_version: "none",
|
sdk_version: "none",
|
||||||
system_modules: "legacy-core-platform-api-stubs-system-modules",
|
system_modules: "stable-core-platform-api-stubs-system-modules",
|
||||||
aidl: {
|
aidl: {
|
||||||
export_include_dirs: ["framework/aidl"],
|
export_include_dirs: ["framework/aidl"],
|
||||||
},
|
},
|
||||||
@@ -160,7 +160,7 @@ func GatherRequiredDepsForTest() string {
|
|||||||
name: "android.hidl.base-V1.0-java",
|
name: "android.hidl.base-V1.0-java",
|
||||||
srcs: ["a.java"],
|
srcs: ["a.java"],
|
||||||
sdk_version: "none",
|
sdk_version: "none",
|
||||||
system_modules: "legacy-core-platform-api-stubs-system-modules",
|
system_modules: "stable-core-platform-api-stubs-system-modules",
|
||||||
installable: true,
|
installable: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,7 +168,7 @@ func GatherRequiredDepsForTest() string {
|
|||||||
name: "android.hidl.manager-V1.0-java",
|
name: "android.hidl.manager-V1.0-java",
|
||||||
srcs: ["a.java"],
|
srcs: ["a.java"],
|
||||||
sdk_version: "none",
|
sdk_version: "none",
|
||||||
system_modules: "legacy-core-platform-api-stubs-system-modules",
|
system_modules: "stable-core-platform-api-stubs-system-modules",
|
||||||
installable: true,
|
installable: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,7 +176,7 @@ func GatherRequiredDepsForTest() string {
|
|||||||
name: "org.apache.http.legacy",
|
name: "org.apache.http.legacy",
|
||||||
srcs: ["a.java"],
|
srcs: ["a.java"],
|
||||||
sdk_version: "none",
|
sdk_version: "none",
|
||||||
system_modules: "legacy-core-platform-api-stubs-system-modules",
|
system_modules: "stable-core-platform-api-stubs-system-modules",
|
||||||
installable: true,
|
installable: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,7 +184,7 @@ func GatherRequiredDepsForTest() string {
|
|||||||
name: "android.test.base",
|
name: "android.test.base",
|
||||||
srcs: ["a.java"],
|
srcs: ["a.java"],
|
||||||
sdk_version: "none",
|
sdk_version: "none",
|
||||||
system_modules: "legacy-core-platform-api-stubs-system-modules",
|
system_modules: "stable-core-platform-api-stubs-system-modules",
|
||||||
installable: true,
|
installable: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -192,7 +192,7 @@ func GatherRequiredDepsForTest() string {
|
|||||||
name: "android.test.mock",
|
name: "android.test.mock",
|
||||||
srcs: ["a.java"],
|
srcs: ["a.java"],
|
||||||
sdk_version: "none",
|
sdk_version: "none",
|
||||||
system_modules: "legacy-core-platform-api-stubs-system-modules",
|
system_modules: "stable-core-platform-api-stubs-system-modules",
|
||||||
installable: true,
|
installable: true,
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
@@ -51,10 +51,10 @@ java_system_modules_import {
|
|||||||
name: "core-current-stubs-system-modules",
|
name: "core-current-stubs-system-modules",
|
||||||
}
|
}
|
||||||
java_system_modules_import {
|
java_system_modules_import {
|
||||||
name: "legacy-core-platform-api-stubs-system-modules",
|
name: "stable-core-platform-api-stubs-system-modules",
|
||||||
}
|
}
|
||||||
java_import {
|
java_import {
|
||||||
name: "legacy.core.platform.api.stubs",
|
name: "stable.core.platform.api.stubs",
|
||||||
}
|
}
|
||||||
java_import {
|
java_import {
|
||||||
name: "android_stubs_current",
|
name: "android_stubs_current",
|
||||||
|
Reference in New Issue
Block a user