Implement sysprop_library API stability check
sysprop_library now checks the API stability itself, cutting dependency
on java_sdk_library. Under the directory {module_dir}/api,
{module_name}-current.txt and {module_name}-latest.txt hold API
signatures.
When sysprop_library is built, or a user run "m {module_name}-check-api"
command, API check is performed. First, current.txt must have exactly
same signature with built sysprop_library module. Second, current.txt
must be compatible with latest.txt.
Build system emits a handy error message to generate/update those API
files, in case of missing or mismatching. Also, a script file for
freezing API files is introduced.
Bug: 131637873
Test: 1) m && boot blueline
Test: 2) m {sysprop_library} performs API check
Test: 3) manual test for check-api, freezing api
Change-Id: I9d25f5dc64299e666527ca8e23d7233966901c4e
Merged-In: I9d25f5dc64299e666527ca8e23d7233966901c4e
Merged-In: Ib7ad4f17e82c90da5ef3f80e2ab88c0b53112c60
(cherry picked from commit 093f0eb133
)
This commit is contained in:
@@ -57,16 +57,11 @@ func testContext(config android.Config, bp string,
|
||||
|
||||
ctx := android.NewTestArchContext()
|
||||
ctx.RegisterModuleType("android_app", android.ModuleFactoryAdaptor(java.AndroidAppFactory))
|
||||
ctx.RegisterModuleType("droiddoc_template", android.ModuleFactoryAdaptor(java.ExportedDroiddocDirFactory))
|
||||
ctx.RegisterModuleType("java_library", android.ModuleFactoryAdaptor(java.LibraryFactory))
|
||||
ctx.RegisterModuleType("java_system_modules", android.ModuleFactoryAdaptor(java.SystemModulesFactory))
|
||||
ctx.RegisterModuleType("prebuilt_apis", android.ModuleFactoryAdaptor(java.PrebuiltApisFactory))
|
||||
ctx.PreArchMutators(android.RegisterPrebuiltsPreArchMutators)
|
||||
ctx.PreArchMutators(android.RegisterPrebuiltsPostDepsMutators)
|
||||
ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators)
|
||||
ctx.PreArchMutators(func(ctx android.RegisterMutatorsContext) {
|
||||
ctx.TopDown("prebuilt_apis", java.PrebuiltApisMutator).Parallel()
|
||||
})
|
||||
|
||||
ctx.RegisterModuleType("cc_library", android.ModuleFactoryAdaptor(cc.LibraryFactory))
|
||||
ctx.RegisterModuleType("cc_library_headers", android.ModuleFactoryAdaptor(cc.LibraryHeaderFactory))
|
||||
@@ -91,45 +86,20 @@ func testContext(config android.Config, bp string,
|
||||
bp += cc.GatherRequiredDepsForTest(android.Android)
|
||||
|
||||
mockFS := map[string][]byte{
|
||||
"Android.bp": []byte(bp),
|
||||
"a.java": nil,
|
||||
"b.java": nil,
|
||||
"c.java": nil,
|
||||
"d.cpp": nil,
|
||||
"api/current.txt": nil,
|
||||
"api/removed.txt": nil,
|
||||
"api/system-current.txt": nil,
|
||||
"api/system-removed.txt": nil,
|
||||
"api/test-current.txt": nil,
|
||||
"api/test-removed.txt": nil,
|
||||
"framework/aidl/a.aidl": nil,
|
||||
|
||||
"prebuilts/sdk/current/core/android.jar": nil,
|
||||
"prebuilts/sdk/current/public/android.jar": nil,
|
||||
"prebuilts/sdk/current/public/framework.aidl": nil,
|
||||
"prebuilts/sdk/current/public/core.jar": nil,
|
||||
"prebuilts/sdk/current/system/android.jar": nil,
|
||||
"prebuilts/sdk/current/test/android.jar": nil,
|
||||
"prebuilts/sdk/28/public/api/sysprop-platform.txt": nil,
|
||||
"prebuilts/sdk/28/system/api/sysprop-platform.txt": nil,
|
||||
"prebuilts/sdk/28/test/api/sysprop-platform.txt": nil,
|
||||
"prebuilts/sdk/28/public/api/sysprop-platform-removed.txt": nil,
|
||||
"prebuilts/sdk/28/system/api/sysprop-platform-removed.txt": nil,
|
||||
"prebuilts/sdk/28/test/api/sysprop-platform-removed.txt": nil,
|
||||
"prebuilts/sdk/28/public/api/sysprop-platform-on-product.txt": nil,
|
||||
"prebuilts/sdk/28/system/api/sysprop-platform-on-product.txt": nil,
|
||||
"prebuilts/sdk/28/test/api/sysprop-platform-on-product.txt": nil,
|
||||
"prebuilts/sdk/28/public/api/sysprop-platform-on-product-removed.txt": nil,
|
||||
"prebuilts/sdk/28/system/api/sysprop-platform-on-product-removed.txt": nil,
|
||||
"prebuilts/sdk/28/test/api/sysprop-platform-on-product-removed.txt": nil,
|
||||
"prebuilts/sdk/28/public/api/sysprop-vendor.txt": nil,
|
||||
"prebuilts/sdk/28/system/api/sysprop-vendor.txt": nil,
|
||||
"prebuilts/sdk/28/test/api/sysprop-vendor.txt": nil,
|
||||
"prebuilts/sdk/28/public/api/sysprop-vendor-removed.txt": nil,
|
||||
"prebuilts/sdk/28/system/api/sysprop-vendor-removed.txt": nil,
|
||||
"prebuilts/sdk/28/test/api/sysprop-vendor-removed.txt": nil,
|
||||
"prebuilts/sdk/tools/core-lambda-stubs.jar": nil,
|
||||
"prebuilts/sdk/Android.bp": []byte(`prebuilt_apis { name: "sdk", api_dirs: ["28", "current"],}`),
|
||||
"Android.bp": []byte(bp),
|
||||
"a.java": nil,
|
||||
"b.java": nil,
|
||||
"c.java": nil,
|
||||
"d.cpp": nil,
|
||||
"api/sysprop-platform-current.txt": nil,
|
||||
"api/sysprop-platform-latest.txt": nil,
|
||||
"api/sysprop-platform-on-product-current.txt": nil,
|
||||
"api/sysprop-platform-on-product-latest.txt": nil,
|
||||
"api/sysprop-vendor-current.txt": nil,
|
||||
"api/sysprop-vendor-latest.txt": nil,
|
||||
"api/sysprop-odm-current.txt": nil,
|
||||
"api/sysprop-odm-latest.txt": nil,
|
||||
"framework/aidl/a.aidl": nil,
|
||||
|
||||
// For framework-res, which is an implicit dependency for framework
|
||||
"AndroidManifest.xml": nil,
|
||||
@@ -155,6 +125,7 @@ func testContext(config android.Config, bp string,
|
||||
|
||||
"android/sysprop/PlatformProperties.sysprop": nil,
|
||||
"com/android/VendorProperties.sysprop": nil,
|
||||
"com/android2/OdmProperties.sysprop": nil,
|
||||
}
|
||||
|
||||
for k, v := range fs {
|
||||
@@ -168,7 +139,7 @@ func testContext(config android.Config, bp string,
|
||||
|
||||
func run(t *testing.T, ctx *android.TestContext, config android.Config) {
|
||||
t.Helper()
|
||||
_, errs := ctx.ParseFileList(".", []string{"Android.bp", "prebuilts/sdk/Android.bp"})
|
||||
_, errs := ctx.ParseFileList(".", []string{"Android.bp"})
|
||||
android.FailIfErrored(t, errs)
|
||||
_, errs = ctx.PrepareBuildActions(config)
|
||||
android.FailIfErrored(t, errs)
|
||||
@@ -221,6 +192,14 @@ func TestSyspropLibrary(t *testing.T) {
|
||||
vendor_available: true,
|
||||
}
|
||||
|
||||
sysprop_library {
|
||||
name: "sysprop-odm",
|
||||
srcs: ["com/android2/OdmProperties.sysprop"],
|
||||
api_packages: ["com.android2"],
|
||||
property_owner: "Odm",
|
||||
device_specific: true,
|
||||
}
|
||||
|
||||
java_library {
|
||||
name: "java-platform",
|
||||
srcs: ["c.java"],
|
||||
@@ -288,20 +267,40 @@ func TestSyspropLibrary(t *testing.T) {
|
||||
name: "liblog",
|
||||
symbol_file: "",
|
||||
}
|
||||
|
||||
java_library {
|
||||
name: "sysprop-library-stub-platform",
|
||||
sdk_version: "core_current",
|
||||
}
|
||||
|
||||
java_library {
|
||||
name: "sysprop-library-stub-vendor",
|
||||
soc_specific: true,
|
||||
sdk_version: "core_current",
|
||||
}
|
||||
`)
|
||||
|
||||
// Check for generated cc_library
|
||||
for _, variant := range []string{
|
||||
"android_arm_armv7-a-neon_vendor_shared",
|
||||
"android_arm_armv7-a-neon_vendor_static",
|
||||
"android_arm64_armv8-a_vendor_shared",
|
||||
"android_arm64_armv8-a_vendor_static",
|
||||
} {
|
||||
ctx.ModuleForTests("libsysprop-platform", variant)
|
||||
ctx.ModuleForTests("libsysprop-vendor", variant)
|
||||
ctx.ModuleForTests("libsysprop-odm", variant)
|
||||
}
|
||||
|
||||
for _, variant := range []string{
|
||||
"android_arm_armv7-a-neon_core_shared",
|
||||
"android_arm_armv7-a-neon_core_static",
|
||||
"android_arm_armv7-a-neon_vendor_shared",
|
||||
"android_arm_armv7-a-neon_vendor_static",
|
||||
"android_arm64_armv8-a_core_shared",
|
||||
"android_arm64_armv8-a_core_static",
|
||||
"android_arm64_armv8-a_vendor_shared",
|
||||
"android_arm64_armv8-a_vendor_static",
|
||||
} {
|
||||
// Check for generated cc_library
|
||||
ctx.ModuleForTests("libsysprop-platform", variant)
|
||||
|
||||
// core variant of vendor-owned sysprop_library is for product
|
||||
ctx.ModuleForTests("libsysprop-vendor", variant)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user