Rework vndk detection
Instead of having a module define `use_vndk: true`, assume that we're building with the VNDK if we're installed on the vendor partition, and BOARD_VNDK_VERSION==current. This now matches our behavior in Make. Once BOARD_VNDK_VERSION!=current, we'll need to disable modules that need to otherwise compile against the VNDK, since we can only compile against the current VNDK. Test: build.ninja for aosp_arm is the same before/after Test: Ensure there are no boards that set BOARD_VNDK_VERSION Change-Id: If937fa7bdb119648137af52daebadf486163484b
This commit is contained in:
@@ -462,11 +462,11 @@ func (c *deviceConfig) VendorPath() string {
|
|||||||
return "vendor"
|
return "vendor"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *deviceConfig) VndkVersion() string {
|
func (c *deviceConfig) CompileVndk() bool {
|
||||||
if c.config.ProductVariables.DeviceVndkVersion == nil {
|
if c.config.ProductVariables.DeviceVndkVersion == nil {
|
||||||
return ""
|
return false
|
||||||
}
|
}
|
||||||
return *c.config.ProductVariables.DeviceVndkVersion
|
return *c.config.ProductVariables.DeviceVndkVersion == "current"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *deviceConfig) BtConfigIncludeDir() string {
|
func (c *deviceConfig) BtConfigIncludeDir() string {
|
||||||
|
@@ -59,6 +59,7 @@ type androidBaseContext interface {
|
|||||||
Darwin() bool
|
Darwin() bool
|
||||||
Debug() bool
|
Debug() bool
|
||||||
PrimaryArch() bool
|
PrimaryArch() bool
|
||||||
|
Proprietary() bool
|
||||||
AConfig() Config
|
AConfig() Config
|
||||||
DeviceConfig() DeviceConfig
|
DeviceConfig() DeviceConfig
|
||||||
}
|
}
|
||||||
@@ -87,7 +88,6 @@ type ModuleContext interface {
|
|||||||
|
|
||||||
AddMissingDependencies(deps []string)
|
AddMissingDependencies(deps []string)
|
||||||
|
|
||||||
Proprietary() bool
|
|
||||||
InstallInData() bool
|
InstallInData() bool
|
||||||
|
|
||||||
RequiredModuleNames() []string
|
RequiredModuleNames() []string
|
||||||
@@ -455,6 +455,7 @@ func (a *ModuleBase) androidBaseContextFactory(ctx blueprint.BaseModuleContext)
|
|||||||
return androidBaseContextImpl{
|
return androidBaseContextImpl{
|
||||||
target: a.commonProperties.CompileTarget,
|
target: a.commonProperties.CompileTarget,
|
||||||
targetPrimary: a.commonProperties.CompilePrimary,
|
targetPrimary: a.commonProperties.CompilePrimary,
|
||||||
|
proprietary: a.commonProperties.Proprietary,
|
||||||
config: ctx.Config().(Config),
|
config: ctx.Config().(Config),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -491,6 +492,7 @@ type androidBaseContextImpl struct {
|
|||||||
target Target
|
target Target
|
||||||
targetPrimary bool
|
targetPrimary bool
|
||||||
debug bool
|
debug bool
|
||||||
|
proprietary bool
|
||||||
config Config
|
config Config
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -619,8 +621,8 @@ func (a *androidBaseContextImpl) DeviceConfig() DeviceConfig {
|
|||||||
return DeviceConfig{a.config.deviceConfig}
|
return DeviceConfig{a.config.deviceConfig}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *androidModuleContext) Proprietary() bool {
|
func (a *androidBaseContextImpl) Proprietary() bool {
|
||||||
return a.module.base().commonProperties.Proprietary
|
return a.proprietary
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *androidModuleContext) InstallInData() bool {
|
func (a *androidModuleContext) InstallInData() bool {
|
||||||
|
@@ -118,7 +118,6 @@ func init() {
|
|||||||
"LOCAL_NO_STANDARD_LIBRARIES": "no_standard_libraries",
|
"LOCAL_NO_STANDARD_LIBRARIES": "no_standard_libraries",
|
||||||
"LOCAL_PACK_MODULE_RELOCATIONS": "pack_relocations",
|
"LOCAL_PACK_MODULE_RELOCATIONS": "pack_relocations",
|
||||||
"LOCAL_TIDY": "tidy",
|
"LOCAL_TIDY": "tidy",
|
||||||
"LOCAL_USE_VNDK": "use_vndk",
|
|
||||||
"LOCAL_PROPRIETARY_MODULE": "proprietary",
|
"LOCAL_PROPRIETARY_MODULE": "proprietary",
|
||||||
|
|
||||||
"LOCAL_EXPORT_PACKAGE_RESOURCES": "export_package_resources",
|
"LOCAL_EXPORT_PACKAGE_RESOURCES": "export_package_resources",
|
||||||
|
@@ -59,9 +59,6 @@ func (c *Module) AndroidMk() (ret android.AndroidMkData, err error) {
|
|||||||
if c.Target().Os == android.Android && c.Properties.Sdk_version != "" {
|
if c.Target().Os == android.Android && c.Properties.Sdk_version != "" {
|
||||||
fmt.Fprintln(w, "LOCAL_SDK_VERSION := "+c.Properties.Sdk_version)
|
fmt.Fprintln(w, "LOCAL_SDK_VERSION := "+c.Properties.Sdk_version)
|
||||||
fmt.Fprintln(w, "LOCAL_NDK_STL_VARIANT := none")
|
fmt.Fprintln(w, "LOCAL_NDK_STL_VARIANT := none")
|
||||||
} else if c.Target().Os == android.Android && c.Properties.Use_vndk {
|
|
||||||
fmt.Fprintln(w, "LOCAL_USE_VNDK := true")
|
|
||||||
fmt.Fprintln(w, "LOCAL_NDK_STL_VARIANT := none")
|
|
||||||
} else {
|
} else {
|
||||||
// These are already included in LOCAL_SHARED_LIBRARIES
|
// These are already included in LOCAL_SHARED_LIBRARIES
|
||||||
fmt.Fprintln(w, "LOCAL_CXX_STL := none")
|
fmt.Fprintln(w, "LOCAL_CXX_STL := none")
|
||||||
|
24
cc/cc.go
24
cc/cc.go
@@ -135,9 +135,6 @@ type BaseProperties struct {
|
|||||||
// Minimum sdk version supported when compiling against the ndk
|
// Minimum sdk version supported when compiling against the ndk
|
||||||
Sdk_version string
|
Sdk_version string
|
||||||
|
|
||||||
// Whether to compile against the VNDK
|
|
||||||
Use_vndk bool
|
|
||||||
|
|
||||||
// don't insert default compiler flags into asflags, cflags,
|
// don't insert default compiler flags into asflags, cflags,
|
||||||
// cppflags, conlyflags, ldflags, or include_dirs
|
// cppflags, conlyflags, ldflags, or include_dirs
|
||||||
No_default_compiler_flags *bool
|
No_default_compiler_flags *bool
|
||||||
@@ -145,7 +142,6 @@ type BaseProperties struct {
|
|||||||
AndroidMkSharedLibs []string `blueprint:"mutated"`
|
AndroidMkSharedLibs []string `blueprint:"mutated"`
|
||||||
HideFromMake bool `blueprint:"mutated"`
|
HideFromMake bool `blueprint:"mutated"`
|
||||||
PreventInstall bool `blueprint:"mutated"`
|
PreventInstall bool `blueprint:"mutated"`
|
||||||
Vndk_version string `blueprint:"mutated"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type UnusedProperties struct {
|
type UnusedProperties struct {
|
||||||
@@ -378,8 +374,8 @@ func (ctx *moduleContextImpl) sdk() bool {
|
|||||||
|
|
||||||
func (ctx *moduleContextImpl) sdkVersion() string {
|
func (ctx *moduleContextImpl) sdkVersion() string {
|
||||||
if ctx.ctx.Device() {
|
if ctx.ctx.Device() {
|
||||||
if ctx.mod.Properties.Use_vndk {
|
if ctx.vndk() {
|
||||||
return ctx.mod.Properties.Vndk_version
|
return "current"
|
||||||
} else {
|
} else {
|
||||||
return ctx.mod.Properties.Sdk_version
|
return ctx.mod.Properties.Sdk_version
|
||||||
}
|
}
|
||||||
@@ -388,10 +384,7 @@ func (ctx *moduleContextImpl) sdkVersion() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (ctx *moduleContextImpl) vndk() bool {
|
func (ctx *moduleContextImpl) vndk() bool {
|
||||||
if ctx.ctx.Device() {
|
return ctx.ctx.Os() == android.Android && ctx.ctx.Proprietary() && ctx.ctx.DeviceConfig().CompileVndk()
|
||||||
return ctx.mod.Properties.Use_vndk
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ctx *moduleContextImpl) selectedStl() string {
|
func (ctx *moduleContextImpl) selectedStl() string {
|
||||||
@@ -544,22 +537,11 @@ func (c *Module) begin(ctx BaseModuleContext) {
|
|||||||
feature.begin(ctx)
|
feature.begin(ctx)
|
||||||
}
|
}
|
||||||
if ctx.sdk() {
|
if ctx.sdk() {
|
||||||
if ctx.vndk() {
|
|
||||||
ctx.PropertyErrorf("use_vndk",
|
|
||||||
"sdk_version and use_vndk cannot be used at the same time")
|
|
||||||
}
|
|
||||||
|
|
||||||
version, err := normalizeNdkApiLevel(ctx.sdkVersion(), ctx.Arch())
|
version, err := normalizeNdkApiLevel(ctx.sdkVersion(), ctx.Arch())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.PropertyErrorf("sdk_version", err.Error())
|
ctx.PropertyErrorf("sdk_version", err.Error())
|
||||||
}
|
}
|
||||||
c.Properties.Sdk_version = version
|
c.Properties.Sdk_version = version
|
||||||
} else if ctx.vndk() {
|
|
||||||
version, err := normalizeNdkApiLevel(ctx.DeviceConfig().VndkVersion(), ctx.Arch())
|
|
||||||
if err != nil {
|
|
||||||
ctx.ModuleErrorf("Bad BOARD_VNDK_VERSION: %s", err.Error())
|
|
||||||
}
|
|
||||||
c.Properties.Vndk_version = version
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user