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
This commit is contained in:
@@ -68,6 +68,7 @@ func (p *Prebuilt) Path(ctx ModuleContext) Path {
|
|||||||
type PrebuiltInterface interface {
|
type PrebuiltInterface interface {
|
||||||
Module
|
Module
|
||||||
Prebuilt() *Prebuilt
|
Prebuilt() *Prebuilt
|
||||||
|
SkipInstall()
|
||||||
}
|
}
|
||||||
|
|
||||||
type PrebuiltSourceInterface interface {
|
type PrebuiltSourceInterface interface {
|
||||||
@@ -89,14 +90,19 @@ func prebuiltMutator(ctx BottomUpMutatorContext) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// PrebuiltReplaceMutator replaces dependencies on the source module with dependencies on the prebuilt
|
// PrebuiltReplaceMutator replaces dependencies on the source module with dependencies on the
|
||||||
// when both modules exist and the prebuilt should be used.
|
// 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) {
|
func PrebuiltReplaceMutator(ctx BottomUpMutatorContext) {
|
||||||
if m, ok := ctx.Module().(PrebuiltInterface); ok && m.Prebuilt() != nil {
|
if m, ok := ctx.Module().(PrebuiltInterface); ok && m.Prebuilt() != nil {
|
||||||
p := m.Prebuilt()
|
p := m.Prebuilt()
|
||||||
name := m.base().BaseModuleName()
|
name := m.base().BaseModuleName()
|
||||||
if p.Properties.SourceExists && p.usePrebuilt(ctx) {
|
if p.usePrebuilt(ctx) {
|
||||||
ctx.ReplaceDependencies(name)
|
if p.Properties.SourceExists {
|
||||||
|
ctx.ReplaceDependencies(name)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
m.SkipInstall()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user