Enable hiddenapi check for exportable stubs
This change modifies the dependencies of the hiddenapi to always depend on the exportable stubs, instead of the currently utilized everything stubs. To support this, the full api surface exportable stubs are defined in a separate change at the `frameworks/base` project. Note that the full api surface exportable stubs are only used for the hiddenapi purpose, and `sdk_version` continues to utilize the currently existing everything stubs. Currently, this feature is hidden behind the build flag "RELEASE_HIDDEN_API_EXPORTABLE_STUBS". This feature will be fully enabled once metalava fully supports handling of the flagged apis. Test: ENABLE_HIDDENAPI_FLAGS=true m Bug: 317426356 Change-Id: I109b7cd27b20ceffcdf1766ab8106b0c276be2b3
This commit is contained in:
@@ -1162,7 +1162,14 @@ java_sdk_library_import {
|
||||
}
|
||||
|
||||
func TestSnapshotWithJavaSdkLibrary_CompileDex(t *testing.T) {
|
||||
result := android.GroupFixturePreparers(prepareForSdkTestWithJavaSdkLibrary).RunTestWithBp(t, `
|
||||
result := android.GroupFixturePreparers(
|
||||
prepareForSdkTestWithJavaSdkLibrary,
|
||||
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
|
||||
variables.BuildFlags = map[string]string{
|
||||
"RELEASE_HIDDEN_API_EXPORTABLE_STUBS": "true",
|
||||
}
|
||||
}),
|
||||
).RunTestWithBp(t, `
|
||||
sdk {
|
||||
name: "mysdk",
|
||||
java_sdk_libs: ["myjavalib"],
|
||||
@@ -1214,21 +1221,22 @@ java_sdk_library_import {
|
||||
ctx := android.ModuleInstallPathContextForTesting(result.Config)
|
||||
dexJarBuildPath := func(name string, kind android.SdkKind) string {
|
||||
dep := result.Module(name, "android_common").(java.SdkLibraryDependency)
|
||||
path := dep.SdkApiStubDexJar(ctx, kind).Path()
|
||||
path := dep.SdkApiExportableStubDexJar(ctx, kind).Path()
|
||||
return path.RelativeToTop().String()
|
||||
}
|
||||
|
||||
dexJarPath := dexJarBuildPath("myjavalib", android.SdkPublic)
|
||||
android.AssertStringEquals(t, "source dex public stubs jar build path", "out/soong/.intermediates/myjavalib.stubs/android_common/dex/myjavalib.stubs.jar", dexJarPath)
|
||||
android.AssertStringEquals(t, "source dex public stubs jar build path", "out/soong/.intermediates/myjavalib.stubs.exportable/android_common/dex/myjavalib.stubs.exportable.jar", dexJarPath)
|
||||
|
||||
dexJarPath = dexJarBuildPath("myjavalib", android.SdkSystem)
|
||||
systemDexJar := "out/soong/.intermediates/myjavalib.stubs.system/android_common/dex/myjavalib.stubs.system.jar"
|
||||
systemDexJar := "out/soong/.intermediates/myjavalib.stubs.exportable.system/android_common/dex/myjavalib.stubs.exportable.system.jar"
|
||||
android.AssertStringEquals(t, "source dex system stubs jar build path", systemDexJar, dexJarPath)
|
||||
|
||||
// This should fall back to system as module is not available.
|
||||
dexJarPath = dexJarBuildPath("myjavalib", android.SdkModule)
|
||||
android.AssertStringEquals(t, "source dex module stubs jar build path", systemDexJar, dexJarPath)
|
||||
|
||||
// Prebuilt dex jar does not come from the exportable stubs.
|
||||
dexJarPath = dexJarBuildPath(android.PrebuiltNameFromSource("myjavalib"), android.SdkPublic)
|
||||
android.AssertStringEquals(t, "prebuilt dex public stubs jar build path", "out/soong/.intermediates/snapshot/prebuilt_myjavalib.stubs/android_common/dex/myjavalib.stubs.jar", dexJarPath)
|
||||
}),
|
||||
|
Reference in New Issue
Block a user