Soong works with empty VNDK version
This change is to fix more misc issues to enable Soong without VNDK
version. This change contains
* Update properties in generated Android.mk
* Update VNDK APEX build to work without VNDK version
Bug: 316829758
Test: AOSP Cuttlefish build succeeded
Change-Id: I10f3c798299afe2d539ec3426b8e2b6068a158f6
diff --git a/cc/androidmk.go b/cc/androidmk.go
index 7723dc3..fe542b0 100644
--- a/cc/androidmk.go
+++ b/cc/androidmk.go
@@ -105,7 +105,7 @@
entries.AddStrings("LOCAL_RUNTIME_LIBRARIES", c.Properties.AndroidMkRuntimeLibs...)
}
entries.SetString("LOCAL_SOONG_LINK_TYPE", c.makeLinkType)
- if c.UseVndk() {
+ if c.InVendorOrProduct() {
entries.SetBool("LOCAL_USE_VNDK", true)
if c.IsVndk() && !c.static() {
entries.SetString("LOCAL_SOONG_VNDK_VERSION", c.VndkVersion())
diff --git a/cc/cc.go b/cc/cc.go
index fd7a38a..c07e358 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -3785,7 +3785,7 @@
}
func GetMakeLinkType(actx android.ModuleContext, c LinkableInterface) string {
- if c.UseVndk() {
+ if c.InVendorOrProduct() {
if c.IsLlndk() {
if !c.IsLlndkPublic() {
return "native:vndk_private"
diff --git a/cc/library.go b/cc/library.go
index 28eb80b..ff30d40 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -17,6 +17,7 @@
import (
"fmt"
"io"
+ "log"
"path/filepath"
"regexp"
"strconv"
@@ -871,12 +872,18 @@
func (library *libraryDecorator) getLibName(ctx BaseModuleContext) string {
name := library.getLibNameHelper(ctx.baseModuleName(), ctx.inVendor(), ctx.inProduct())
+ // Replace name with VNDK ext as original lib only when VNDK is enabled
if ctx.IsVndkExt() {
- // vndk-ext lib should have the same name with original lib
- ctx.VisitDirectDepsWithTag(vndkExtDepTag, func(module android.Module) {
- originalName := module.(*Module).outputFile.Path()
- name = strings.TrimSuffix(originalName.Base(), originalName.Ext())
- })
+ if ctx.DeviceConfig().VndkVersion() != "" {
+ // vndk-ext lib should have the same name with original lib
+ ctx.VisitDirectDepsWithTag(vndkExtDepTag, func(module android.Module) {
+ originalName := module.(*Module).outputFile.Path()
+ name = strings.TrimSuffix(originalName.Base(), originalName.Ext())
+ })
+ } else {
+ // TODO(b/320208784) : Suggest a solution for former VNDK-ext libraries before VNDK deprecation.
+ log.Printf("VNDK Extension on module %s will not be available once VNDK is deprecated", ctx.baseModuleName())
+ }
}
if ctx.Host() && Bool(library.Properties.Unique_host_soname) {