aboutsummaryrefslogtreecommitdiffstats
path: root/android
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2016-11-23 15:44:07 -0800
committerColin Cross <ccross@android.com>2016-11-29 15:29:34 -0800
commit0f3c72fa179a1a894f6985142d98a08639daf1df (patch)
treeaac399354a12d71e3c53fd78a7a6c3c32a231487 /android
parentcc4f3e3f94b9f7cc2a6cf66e6a7e0e697bfd0d28 (diff)
downloadbuild_soong-0f3c72fa179a1a894f6985142d98a08639daf1df.tar.gz
build_soong-0f3c72fa179a1a894f6985142d98a08639daf1df.tar.bz2
build_soong-0f3c72fa179a1a894f6985142d98a08639daf1df.zip
Disable installing unused prebuilts
If the source module is being used instead of the prebuilt module, disable installing the prebuilt module. Test: m -j checkbuild Change-Id: I55e77021b0f9572b0737d960cba89274f696775d
Diffstat (limited to 'android')
-rw-r--r--android/prebuilt.go14
1 files changed, 10 insertions, 4 deletions
diff --git a/android/prebuilt.go b/android/prebuilt.go
index fb9e5155..76524291 100644
--- a/android/prebuilt.go
+++ b/android/prebuilt.go
@@ -68,6 +68,7 @@ func (p *Prebuilt) Path(ctx ModuleContext) Path {
type PrebuiltInterface interface {
Module
Prebuilt() *Prebuilt
+ SkipInstall()
}
type PrebuiltSourceInterface interface {
@@ -89,14 +90,19 @@ func prebuiltMutator(ctx BottomUpMutatorContext) {
}
}
-// PrebuiltReplaceMutator replaces dependencies on the source module with dependencies on the prebuilt
-// when both modules exist and the prebuilt should be used.
+// PrebuiltReplaceMutator replaces dependencies on the source module with dependencies on the
+// prebuilt when both modules exist and the prebuilt should be used. When the prebuilt should not
+// be used, disable installing it.
func PrebuiltReplaceMutator(ctx BottomUpMutatorContext) {
if m, ok := ctx.Module().(PrebuiltInterface); ok && m.Prebuilt() != nil {
p := m.Prebuilt()
name := m.base().BaseModuleName()
- if p.Properties.SourceExists && p.usePrebuilt(ctx) {
- ctx.ReplaceDependencies(name)
+ if p.usePrebuilt(ctx) {
+ if p.Properties.SourceExists {
+ ctx.ReplaceDependencies(name)
+ }
+ } else {
+ m.SkipInstall()
}
}
}