diff options
author | Dan Willemsen <dwillemsen@google.com> | 2017-03-19 18:30:37 -0700 |
---|---|---|
committer | Dan Willemsen <dwillemsen@google.com> | 2017-03-29 04:33:25 +0000 |
commit | 11b261472a97399a5fda9d565375637aae7639f4 (patch) | |
tree | 2de6f556bddff8f9b0047adc1b09179e8dda6bc6 | |
parent | 9e3f627ea73b3982d8be5ad8b402b4264aab0b18 (diff) | |
download | build_soong-11b261472a97399a5fda9d565375637aae7639f4.tar.gz build_soong-11b261472a97399a5fda9d565375637aae7639f4.tar.bz2 build_soong-11b261472a97399a5fda9d565375637aae7639f4.zip |
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
-rw-r--r-- | android/config.go | 6 | ||||
-rw-r--r-- | android/module.go | 8 | ||||
-rw-r--r-- | androidmk/cmd/androidmk/android.go | 1 | ||||
-rw-r--r-- | cc/androidmk.go | 3 | ||||
-rw-r--r-- | cc/cc.go | 24 |
5 files changed, 11 insertions, 31 deletions
diff --git a/android/config.go b/android/config.go index 23619205..686eeb8e 100644 --- a/android/config.go +++ b/android/config.go @@ -462,11 +462,11 @@ func (c *deviceConfig) VendorPath() string { return "vendor" } -func (c *deviceConfig) VndkVersion() string { +func (c *deviceConfig) CompileVndk() bool { 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 { diff --git a/android/module.go b/android/module.go index cc420fbb..8228a9c5 100644 --- a/android/module.go +++ b/android/module.go @@ -59,6 +59,7 @@ type androidBaseContext interface { Darwin() bool Debug() bool PrimaryArch() bool + Proprietary() bool AConfig() Config DeviceConfig() DeviceConfig } @@ -87,7 +88,6 @@ type ModuleContext interface { AddMissingDependencies(deps []string) - Proprietary() bool InstallInData() bool RequiredModuleNames() []string @@ -455,6 +455,7 @@ func (a *ModuleBase) androidBaseContextFactory(ctx blueprint.BaseModuleContext) return androidBaseContextImpl{ target: a.commonProperties.CompileTarget, targetPrimary: a.commonProperties.CompilePrimary, + proprietary: a.commonProperties.Proprietary, config: ctx.Config().(Config), } } @@ -491,6 +492,7 @@ type androidBaseContextImpl struct { target Target targetPrimary bool debug bool + proprietary bool config Config } @@ -619,8 +621,8 @@ func (a *androidBaseContextImpl) DeviceConfig() DeviceConfig { return DeviceConfig{a.config.deviceConfig} } -func (a *androidModuleContext) Proprietary() bool { - return a.module.base().commonProperties.Proprietary +func (a *androidBaseContextImpl) Proprietary() bool { + return a.proprietary } func (a *androidModuleContext) InstallInData() bool { diff --git a/androidmk/cmd/androidmk/android.go b/androidmk/cmd/androidmk/android.go index 331bb4f4..6d08ca8b 100644 --- a/androidmk/cmd/androidmk/android.go +++ b/androidmk/cmd/androidmk/android.go @@ -118,7 +118,6 @@ func init() { "LOCAL_NO_STANDARD_LIBRARIES": "no_standard_libraries", "LOCAL_PACK_MODULE_RELOCATIONS": "pack_relocations", "LOCAL_TIDY": "tidy", - "LOCAL_USE_VNDK": "use_vndk", "LOCAL_PROPRIETARY_MODULE": "proprietary", "LOCAL_EXPORT_PACKAGE_RESOURCES": "export_package_resources", diff --git a/cc/androidmk.go b/cc/androidmk.go index 7acc244b..bf0ca6f9 100644 --- a/cc/androidmk.go +++ b/cc/androidmk.go @@ -59,9 +59,6 @@ func (c *Module) AndroidMk() (ret android.AndroidMkData, err error) { if c.Target().Os == android.Android && c.Properties.Sdk_version != "" { fmt.Fprintln(w, "LOCAL_SDK_VERSION := "+c.Properties.Sdk_version) 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 { // These are already included in LOCAL_SHARED_LIBRARIES fmt.Fprintln(w, "LOCAL_CXX_STL := none") @@ -135,9 +135,6 @@ type BaseProperties struct { // Minimum sdk version supported when compiling against the ndk Sdk_version string - // Whether to compile against the VNDK - Use_vndk bool - // don't insert default compiler flags into asflags, cflags, // cppflags, conlyflags, ldflags, or include_dirs No_default_compiler_flags *bool @@ -145,7 +142,6 @@ type BaseProperties struct { AndroidMkSharedLibs []string `blueprint:"mutated"` HideFromMake bool `blueprint:"mutated"` PreventInstall bool `blueprint:"mutated"` - Vndk_version string `blueprint:"mutated"` } type UnusedProperties struct { @@ -378,8 +374,8 @@ func (ctx *moduleContextImpl) sdk() bool { func (ctx *moduleContextImpl) sdkVersion() string { if ctx.ctx.Device() { - if ctx.mod.Properties.Use_vndk { - return ctx.mod.Properties.Vndk_version + if ctx.vndk() { + return "current" } else { return ctx.mod.Properties.Sdk_version } @@ -388,10 +384,7 @@ func (ctx *moduleContextImpl) sdkVersion() string { } func (ctx *moduleContextImpl) vndk() bool { - if ctx.ctx.Device() { - return ctx.mod.Properties.Use_vndk - } - return false + return ctx.ctx.Os() == android.Android && ctx.ctx.Proprietary() && ctx.ctx.DeviceConfig().CompileVndk() } func (ctx *moduleContextImpl) selectedStl() string { @@ -544,22 +537,11 @@ func (c *Module) begin(ctx BaseModuleContext) { feature.begin(ctx) } 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()) if err != nil { ctx.PropertyErrorf("sdk_version", err.Error()) } 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 } } |