aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2020-06-24 01:11:39 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2020-06-24 01:11:39 +0000
commit0962ea934e3b9057154091fae27350a590feef4a (patch)
treede4ca93834594c36af8d06636dc5e9b0c7761153
parenteff51933be374f746e4cb725e4817fe06b674799 (diff)
parent433ea2321a175260969d757bc8e90547466c30d0 (diff)
downloadbuild_soong-0962ea934e3b9057154091fae27350a590feef4a.tar.gz
build_soong-0962ea934e3b9057154091fae27350a590feef4a.tar.bz2
build_soong-0962ea934e3b9057154091fae27350a590feef4a.zip
Snap for 6621766 from 433ea2321a175260969d757bc8e90547466c30d0 to rvc-release
Change-Id: I2abf1ff917de9918e971ba0cf231b0a40f4a6b57
-rw-r--r--android/module.go4
-rw-r--r--android/override_module.go29
-rw-r--r--cc/cc_test.go34
-rw-r--r--cc/vndk.go27
-rwxr-xr-xjava/app.go2
5 files changed, 78 insertions, 18 deletions
diff --git a/android/module.go b/android/module.go
index 0bf48d59..5bccb79a 100644
--- a/android/module.go
+++ b/android/module.go
@@ -819,6 +819,10 @@ func (m *ModuleBase) Host() bool {
return m.Os().Class == Host || m.Os().Class == HostCross
}
+func (m *ModuleBase) Device() bool {
+ return m.Os().Class == Device
+}
+
func (m *ModuleBase) Arch() Arch {
return m.Target().Arch
}
diff --git a/android/override_module.go b/android/override_module.go
index 7e58890d..90ddf504 100644
--- a/android/override_module.go
+++ b/android/override_module.go
@@ -42,6 +42,11 @@ type OverrideModule interface {
setOverridingProperties(properties []interface{})
getOverrideModuleProperties() *OverrideModuleProperties
+
+ // Internal funcs to handle interoperability between override modules and prebuilts.
+ // i.e. cases where an overriding module, too, is overridden by a prebuilt module.
+ setOverriddenByPrebuilt(overridden bool)
+ getOverriddenByPrebuilt() bool
}
// Base module struct for override module types
@@ -49,6 +54,8 @@ type OverrideModuleBase struct {
moduleProperties OverrideModuleProperties
overridingProperties []interface{}
+
+ overriddenByPrebuilt bool
}
type OverrideModuleProperties struct {
@@ -74,6 +81,14 @@ func (o *OverrideModuleBase) GetOverriddenModuleName() string {
return proptools.String(o.moduleProperties.Base)
}
+func (o *OverrideModuleBase) setOverriddenByPrebuilt(overridden bool) {
+ o.overriddenByPrebuilt = overridden
+}
+
+func (o *OverrideModuleBase) getOverriddenByPrebuilt() bool {
+ return o.overriddenByPrebuilt
+}
+
func InitOverrideModule(m OverrideModule) {
m.setOverridingProperties(m.GetProperties())
@@ -208,21 +223,19 @@ var overrideBaseDepTag overrideBaseDependencyTag
// next phase.
func overrideModuleDepsMutator(ctx BottomUpMutatorContext) {
if module, ok := ctx.Module().(OverrideModule); ok {
- // Skip this overriding module if there's a prebuilt module that overrides it with prefer flag.
- overriddenByPrebuilt := false
+ // See if there's a prebuilt module that overrides this override module with prefer flag,
+ // in which case we call SkipInstall on the corresponding variant later.
ctx.VisitDirectDepsWithTag(PrebuiltDepTag, func(dep Module) {
prebuilt, ok := dep.(PrebuiltInterface)
if !ok {
panic("PrebuiltDepTag leads to a non-prebuilt module " + dep.Name())
}
if prebuilt.Prebuilt().UsePrebuilt() {
- overriddenByPrebuilt = true
+ module.setOverriddenByPrebuilt(true)
return
}
})
- if !overriddenByPrebuilt {
- ctx.AddDependency(ctx.Module(), overrideBaseDepTag, *module.getOverrideModuleProperties().Base)
- }
+ ctx.AddDependency(ctx.Module(), overrideBaseDepTag, *module.getOverrideModuleProperties().Base)
}
}
@@ -258,6 +271,10 @@ func performOverrideMutator(ctx BottomUpMutatorContext) {
ctx.AliasVariation(variants[0])
for i, o := range overrides {
mods[i+1].(OverridableModule).override(ctx, o)
+ if o.getOverriddenByPrebuilt() {
+ // The overriding module itself, too, is overridden by a prebuilt. Skip its installation.
+ mods[i+1].SkipInstall()
+ }
}
} else if o, ok := ctx.Module().(OverrideModule); ok {
// Create a variant of the overriding module with its own name. This matches the above local
diff --git a/cc/cc_test.go b/cc/cc_test.go
index 76b4e38e..f73e0217 100644
--- a/cc/cc_test.go
+++ b/cc/cc_test.go
@@ -430,6 +430,40 @@ func TestVndk(t *testing.T) {
checkVndkLibrariesOutput(t, ctx, "vndkcorevariant.libraries.txt", nil)
}
+func TestVndkWithHostSupported(t *testing.T) {
+ ctx := testCc(t, `
+ cc_library {
+ name: "libvndk_host_supported",
+ vendor_available: true,
+ vndk: {
+ enabled: true,
+ },
+ host_supported: true,
+ }
+
+ cc_library {
+ name: "libvndk_host_supported_but_disabled_on_device",
+ vendor_available: true,
+ vndk: {
+ enabled: true,
+ },
+ host_supported: true,
+ enabled: false,
+ target: {
+ host: {
+ enabled: true,
+ }
+ }
+ }
+
+ vndk_libraries_txt {
+ name: "vndkcore.libraries.txt",
+ }
+ `)
+
+ checkVndkLibrariesOutput(t, ctx, "vndkcore.libraries.txt", []string{"libvndk_host_supported.so"})
+}
+
func TestVndkLibrariesTxtAndroidMk(t *testing.T) {
bp := `
vndk_libraries_txt {
diff --git a/cc/vndk.go b/cc/vndk.go
index ef33c1a5..a0608696 100644
--- a/cc/vndk.go
+++ b/cc/vndk.go
@@ -334,16 +334,24 @@ func processVndkLibrary(mctx android.BottomUpMutatorContext, m *Module) {
}
}
-func IsForVndkApex(mctx android.BottomUpMutatorContext, m *Module) bool {
+// Sanity check for modules that mustn't be VNDK
+func shouldSkipVndkMutator(m *Module) bool {
if !m.Enabled() {
- return false
+ return true
}
-
- if !mctx.Device() {
- return false
+ if !m.Device() {
+ // Skip non-device modules
+ return true
}
-
if m.Target().NativeBridge == android.NativeBridgeEnabled {
+ // Skip native_bridge modules
+ return true
+ }
+ return false
+}
+
+func IsForVndkApex(mctx android.BottomUpMutatorContext, m *Module) bool {
+ if shouldSkipVndkMutator(m) {
return false
}
@@ -377,11 +385,8 @@ func VndkMutator(mctx android.BottomUpMutatorContext) {
if !ok {
return
}
- if !m.Enabled() {
- return
- }
- if m.Target().NativeBridge == android.NativeBridgeEnabled {
- // Skip native_bridge modules
+
+ if shouldSkipVndkMutator(m) {
return
}
diff --git a/java/app.go b/java/app.go
index 245c586e..e2e3a53d 100755
--- a/java/app.go
+++ b/java/app.go
@@ -150,7 +150,7 @@ func (as *AndroidAppSet) GenerateAndroidBuildActions(ctx android.ModuleContext)
"allow-prereleased": strconv.FormatBool(proptools.Bool(as.properties.Prerelease)),
"screen-densities": screenDensities,
"sdk-version": ctx.Config().PlatformSdkVersion(),
- "stem": ctx.ModuleName(),
+ "stem": as.BaseModuleName(),
},
})
}