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

Commit efd249e6 authored by Vic Yang's avatar Vic Yang
Browse files

Add support for no-vendor-variant VNDK

When no-vendor-variant VNDK is enabled, the vendor variant of VNDK
libraries are not installed.  Since not all VNDK libraries will be
ready for this, we keep a list of library names in cc/vndk.go to
indicate which libraries must have their vendor variants always
installed regardless of whether no-vendor-variant VNDK is enabled.

Also add --remove-build-id option to the strip script to facilitate
the check of functional identity of the two variants.

Bug: 119423884
Test: Add a dummy VNDK library and build with
      TARGET_VNDK_USE_CORE_VARIANT := true, with the corresponding
      build/make change.

Change-Id: Ieb1589488690e1cef1e310669a8b47a8b8759dac
parent f8d3be9c
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -103,6 +103,7 @@ bootstrap_go_package {
        "cc/config/global.go",
        "cc/config/tidy.go",
        "cc/config/toolchain.go",
        "cc/config/vndk.go",

        "cc/config/arm_device.go",
        "cc/config/arm64_device.go",
+4 −0
Original line number Diff line number Diff line
@@ -818,6 +818,10 @@ func (c *deviceConfig) ExtraVndkVersions() []string {
	return c.config.productVariables.ExtraVndkVersions
}

func (c *deviceConfig) VndkUseCoreVariant() bool {
	return Bool(c.config.productVariables.VndkUseCoreVariant)
}

func (c *deviceConfig) SystemSdkVersions() []string {
	return c.config.productVariables.DeviceSystemSdkVersions
}
+2 −0
Original line number Diff line number Diff line
@@ -253,6 +253,8 @@ type productVariables struct {

	PgoAdditionalProfileDirs []string `json:",omitempty"`

	VndkUseCoreVariant *bool `json:",omitempty"`

	BoardVendorSepolicyDirs      []string `json:",omitempty"`
	BoardOdmSepolicyDirs         []string `json:",omitempty"`
	BoardPlatPublicSepolicyDirs  []string `json:",omitempty"`
+6 −0
Original line number Diff line number Diff line
@@ -185,6 +185,12 @@ func (library *libraryDecorator) AndroidMk(ctx AndroidMkContext, ret *android.An
		if library.coverageOutputFile.Valid() {
			fmt.Fprintln(w, "LOCAL_PREBUILT_COVERAGE_ARCHIVE :=", library.coverageOutputFile.String())
		}

		if library.useCoreVariant {
			fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE := true")
			fmt.Fprintln(w, "LOCAL_NO_NOTICE_FILE := true")
			fmt.Fprintln(w, "LOCAL_VNDK_DEPEND_ON_CORE_VARIANT := true")
		}
	})

	if library.shared() && !library.buildStubs() {
+17 −1
Original line number Diff line number Diff line
@@ -266,6 +266,7 @@ type ModuleContextIntf interface {
	hasStubsVariants() bool
	isStubs() bool
	bootstrap() bool
	mustUseVendorVariant() bool
}

type ModuleContext interface {
@@ -558,6 +559,10 @@ func (c *Module) isVndkExt() bool {
	return false
}

func (c *Module) mustUseVendorVariant() bool {
	return c.isVndkSp() || inList(c.Name(), config.VndkMustUseVendorVariantList)
}

func (c *Module) getVndkExtendsModuleName() string {
	if vndkdep := c.vndkdep; vndkdep != nil {
		return vndkdep.getVndkExtendsModuleName()
@@ -709,6 +714,10 @@ func (ctx *moduleContextImpl) isVndkExt() bool {
	return ctx.mod.isVndkExt()
}

func (ctx *moduleContextImpl) mustUseVendorVariant() bool {
	return ctx.mod.mustUseVendorVariant()
}

func (ctx *moduleContextImpl) inRecovery() bool {
	return ctx.mod.inRecovery()
}
@@ -1769,7 +1778,12 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
			isLLndk := inList(libName, llndkLibraries)
			isVendorPublicLib := inList(libName, vendorPublicLibraries)
			bothVendorAndCoreVariantsExist := ccDep.hasVendorVariant() || isLLndk
			if c.useVndk() && bothVendorAndCoreVariantsExist {

			if ctx.DeviceConfig().VndkUseCoreVariant() && ccDep.isVndk() && !ccDep.mustUseVendorVariant() {
				// The vendor module is a no-vendor-variant VNDK library.  Depend on the
				// core module instead.
				return libName
			} else if c.useVndk() && bothVendorAndCoreVariantsExist {
				// The vendor module in Make will have been renamed to not conflict with the core
				// module, so update the dependency name here accordingly.
				return libName + vendorSuffix
@@ -1908,6 +1922,8 @@ func (c *Module) getMakeLinkType() string {
		// TODO(b/114741097): use the correct ndk stl once build errors have been fixed
		//family, link := getNdkStlFamilyAndLinkType(c)
		//return fmt.Sprintf("native:ndk:%s:%s", family, link)
	} else if inList(c.Name(), vndkUsingCoreVariantLibraries) {
		return "native:platform_vndk"
	} else {
		return "native:platform"
	}
Loading