Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d737d3f2 authored by Yo Chiang's avatar Yo Chiang
Browse files

Refine ABI check and enable ABI check on APEX exported libs

* Don't check ramdisk and recovery variants.
* Don't check bionic libraries of bootstrap variant.
* Don't check uninstallable libraries.
* Check APEX exported libraries.

Bug: 145608479
Test: Presubmit
Test: diff lsdump_paths.txt, verify the changes are as expected.
Change-Id: Ie540dba563277307c51b533cd982d7317796b48b
parent 2bbadfae
Loading
Loading
Loading
Loading
+19 −9
Original line number Diff line number Diff line
@@ -130,6 +130,16 @@ func shouldCreateSourceAbiDumpForLibrary(ctx android.BaseModuleContext) bool {

	// Module is shared library type.

	// Don't check uninstallable modules.
	if m.IsSkipInstall() {
		return false
	}

	// Don't check ramdisk or recovery variants. Only check core, vendor or product variants.
	if m.InRamdisk() || m.InVendorRamdisk() || m.InRecovery() {
		return false
	}

	// Don't create ABI dump for prebuilts.
	if m.Prebuilt() != nil || m.isSnapshotPrebuilt() {
		return false
@@ -150,17 +160,17 @@ func shouldCreateSourceAbiDumpForLibrary(ctx android.BaseModuleContext) bool {
		return false
	}

	// Special case for APEX variants.
	if !ctx.Provider(android.ApexInfoProvider).(android.ApexInfo).IsForPlatform() {
		// Don't create ABI dump if this library is for APEX but isn't exported.
		if !m.HasStubsVariants() {
	isPlatformVariant := ctx.Provider(android.ApexInfoProvider).(android.ApexInfo).IsForPlatform()
	if isPlatformVariant {
		// Bionic libraries that are installed to the bootstrap directory are not ABI checked.
		// Only the runtime APEX variants, which are the implementation libraries of bionic NDK stubs,
		// are checked.
		if InstallToBootstrap(m.BaseModuleName(), ctx.Config()) {
			return false
		}
		if !m.library.headerAbiCheckerEnabled() {
			// Skip ABI checks if this library is for APEX and did not explicitly enable
			// ABI checks.
			// TODO(b/145608479): ABI checks should be enabled by default. Remove this
			// after evaluating the extra build time.
	} else {
		// Don't create ABI dump if this library is for APEX but isn't exported.
		if !m.HasStubsVariants() {
			return false
		}
	}