Merge changes I0dcc9c7b,I9bc40642
* changes: Move cc.imageMutator into the android package Make CreateVariations return []android.Module
This commit is contained in:
@@ -51,6 +51,7 @@ bootstrap_go_package {
|
|||||||
"android/expand.go",
|
"android/expand.go",
|
||||||
"android/filegroup.go",
|
"android/filegroup.go",
|
||||||
"android/hooks.go",
|
"android/hooks.go",
|
||||||
|
"android/image.go",
|
||||||
"android/makevars.go",
|
"android/makevars.go",
|
||||||
"android/module.go",
|
"android/module.go",
|
||||||
"android/mutator.go",
|
"android/mutator.go",
|
||||||
|
@@ -17,8 +17,6 @@ package android
|
|||||||
import (
|
import (
|
||||||
"sort"
|
"sort"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/google/blueprint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// ApexModule is the interface that a module type is expected to implement if
|
// ApexModule is the interface that a module type is expected to implement if
|
||||||
@@ -69,7 +67,7 @@ type ApexModule interface {
|
|||||||
|
|
||||||
// Mutate this module into one or more variants each of which is built
|
// Mutate this module into one or more variants each of which is built
|
||||||
// for an APEX marked via BuildForApex().
|
// for an APEX marked via BuildForApex().
|
||||||
CreateApexVariations(mctx BottomUpMutatorContext) []blueprint.Module
|
CreateApexVariations(mctx BottomUpMutatorContext) []Module
|
||||||
|
|
||||||
// Sets the name of the apex variant of this module. Called inside
|
// Sets the name of the apex variant of this module. Called inside
|
||||||
// CreateApexVariations.
|
// CreateApexVariations.
|
||||||
@@ -176,7 +174,7 @@ func (m *ApexModuleBase) checkApexAvailableProperty(mctx BaseModuleContext) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *ApexModuleBase) CreateApexVariations(mctx BottomUpMutatorContext) []blueprint.Module {
|
func (m *ApexModuleBase) CreateApexVariations(mctx BottomUpMutatorContext) []Module {
|
||||||
if len(m.apexVariations) > 0 {
|
if len(m.apexVariations) > 0 {
|
||||||
m.checkApexAvailableProperty(mctx)
|
m.checkApexAvailableProperty(mctx)
|
||||||
sort.Strings(m.apexVariations)
|
sort.Strings(m.apexVariations)
|
||||||
|
83
android/image.go
Normal file
83
android/image.go
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
// Copyright 2019 Google Inc. All rights reserved.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
package android
|
||||||
|
|
||||||
|
// ImageInterface is implemented by modules that need to be split by the ImageMutator.
|
||||||
|
type ImageInterface interface {
|
||||||
|
// ImageMutatorBegin is called before any other method in the ImageInterface.
|
||||||
|
ImageMutatorBegin(ctx BaseModuleContext)
|
||||||
|
|
||||||
|
// CoreVariantNeeded should return true if the module needs a core variant (installed on the system image).
|
||||||
|
CoreVariantNeeded(ctx BaseModuleContext) bool
|
||||||
|
|
||||||
|
// RecoveryVariantNeeded should return true if the module needs a recovery variant (installed on the
|
||||||
|
// recovery partition).
|
||||||
|
RecoveryVariantNeeded(ctx BaseModuleContext) bool
|
||||||
|
|
||||||
|
// ExtraImageVariations should return a list of the additional variations needed for the module. After the
|
||||||
|
// variants are created the SetImageVariation method will be called on each newly created variant with the
|
||||||
|
// its variation.
|
||||||
|
ExtraImageVariations(ctx BaseModuleContext) []string
|
||||||
|
|
||||||
|
// SetImageVariation will be passed a newly created recovery variant of the module. ModuleBase implements
|
||||||
|
// SetImageVariation, most module types will not need to override it, and those that do must call the
|
||||||
|
// overridden method. Implementors of SetImageVariation must be careful to modify the module argument
|
||||||
|
// and not the receiver.
|
||||||
|
SetImageVariation(ctx BaseModuleContext, variation string, module Module)
|
||||||
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
// CoreVariation is the variant used for framework-private libraries, or
|
||||||
|
// SDK libraries. (which framework-private libraries can use), which
|
||||||
|
// will be installed to the system image.
|
||||||
|
CoreVariation string = "core"
|
||||||
|
|
||||||
|
// RecoveryVariation means a module to be installed to recovery image.
|
||||||
|
RecoveryVariation string = "recovery"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ImageMutator creates variants for modules that implement the ImageInterface that
|
||||||
|
// allow them to build differently for each partition (recovery, core, vendor, etc.).
|
||||||
|
func ImageMutator(ctx BottomUpMutatorContext) {
|
||||||
|
if ctx.Os() != Android {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if m, ok := ctx.Module().(ImageInterface); ok {
|
||||||
|
m.ImageMutatorBegin(ctx)
|
||||||
|
|
||||||
|
var variations []string
|
||||||
|
|
||||||
|
if m.CoreVariantNeeded(ctx) {
|
||||||
|
variations = append(variations, CoreVariation)
|
||||||
|
}
|
||||||
|
if m.RecoveryVariantNeeded(ctx) {
|
||||||
|
variations = append(variations, RecoveryVariation)
|
||||||
|
}
|
||||||
|
|
||||||
|
extraVariations := m.ExtraImageVariations(ctx)
|
||||||
|
variations = append(variations, extraVariations...)
|
||||||
|
|
||||||
|
if len(variations) == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
mod := ctx.CreateVariations(variations...)
|
||||||
|
for i, v := range variations {
|
||||||
|
mod[i].base().setImageVariation(v)
|
||||||
|
m.SetImageVariation(ctx, v, mod[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -431,6 +431,9 @@ type commonProperties struct {
|
|||||||
DebugName string `blueprint:"mutated"`
|
DebugName string `blueprint:"mutated"`
|
||||||
DebugMutators []string `blueprint:"mutated"`
|
DebugMutators []string `blueprint:"mutated"`
|
||||||
DebugVariations []string `blueprint:"mutated"`
|
DebugVariations []string `blueprint:"mutated"`
|
||||||
|
|
||||||
|
// set by ImageMutator
|
||||||
|
ImageVariation string `blueprint:"mutated"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type hostAndDeviceProperties struct {
|
type hostAndDeviceProperties struct {
|
||||||
@@ -865,6 +868,21 @@ func (m *ModuleBase) NoticeFile() OptionalPath {
|
|||||||
return m.noticeFile
|
return m.noticeFile
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *ModuleBase) setImageVariation(variant string) {
|
||||||
|
m.commonProperties.ImageVariation = variant
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *ModuleBase) ImageVariation() blueprint.Variation {
|
||||||
|
return blueprint.Variation{
|
||||||
|
Mutator: "image",
|
||||||
|
Variation: m.base().commonProperties.ImageVariation,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *ModuleBase) InRecovery() bool {
|
||||||
|
return m.base().commonProperties.ImageVariation == RecoveryVariation
|
||||||
|
}
|
||||||
|
|
||||||
func (m *ModuleBase) generateModuleTarget(ctx ModuleContext) {
|
func (m *ModuleBase) generateModuleTarget(ctx ModuleContext) {
|
||||||
allInstalledFiles := Paths{}
|
allInstalledFiles := Paths{}
|
||||||
allCheckbuildFiles := Paths{}
|
allCheckbuildFiles := Paths{}
|
||||||
|
@@ -143,8 +143,8 @@ type BottomUpMutatorContext interface {
|
|||||||
|
|
||||||
AddDependency(module blueprint.Module, tag blueprint.DependencyTag, name ...string)
|
AddDependency(module blueprint.Module, tag blueprint.DependencyTag, name ...string)
|
||||||
AddReverseDependency(module blueprint.Module, tag blueprint.DependencyTag, name string)
|
AddReverseDependency(module blueprint.Module, tag blueprint.DependencyTag, name string)
|
||||||
CreateVariations(...string) []blueprint.Module
|
CreateVariations(...string) []Module
|
||||||
CreateLocalVariations(...string) []blueprint.Module
|
CreateLocalVariations(...string) []Module
|
||||||
SetDependencyVariation(string)
|
SetDependencyVariation(string)
|
||||||
SetDefaultDependencyVariation(*string)
|
SetDefaultDependencyVariation(*string)
|
||||||
AddVariationDependencies([]blueprint.Variation, blueprint.DependencyTag, ...string)
|
AddVariationDependencies([]blueprint.Variation, blueprint.DependencyTag, ...string)
|
||||||
@@ -285,28 +285,32 @@ func (b *bottomUpMutatorContext) AddReverseDependency(module blueprint.Module, t
|
|||||||
b.bp.AddReverseDependency(module, tag, name)
|
b.bp.AddReverseDependency(module, tag, name)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *bottomUpMutatorContext) CreateVariations(variations ...string) []blueprint.Module {
|
func (b *bottomUpMutatorContext) CreateVariations(variations ...string) []Module {
|
||||||
modules := b.bp.CreateVariations(variations...)
|
modules := b.bp.CreateVariations(variations...)
|
||||||
|
|
||||||
|
aModules := make([]Module, len(modules))
|
||||||
for i := range variations {
|
for i := range variations {
|
||||||
base := modules[i].(Module).base()
|
aModules[i] = modules[i].(Module)
|
||||||
|
base := aModules[i].base()
|
||||||
base.commonProperties.DebugMutators = append(base.commonProperties.DebugMutators, b.MutatorName())
|
base.commonProperties.DebugMutators = append(base.commonProperties.DebugMutators, b.MutatorName())
|
||||||
base.commonProperties.DebugVariations = append(base.commonProperties.DebugVariations, variations[i])
|
base.commonProperties.DebugVariations = append(base.commonProperties.DebugVariations, variations[i])
|
||||||
}
|
}
|
||||||
|
|
||||||
return modules
|
return aModules
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *bottomUpMutatorContext) CreateLocalVariations(variations ...string) []blueprint.Module {
|
func (b *bottomUpMutatorContext) CreateLocalVariations(variations ...string) []Module {
|
||||||
modules := b.bp.CreateLocalVariations(variations...)
|
modules := b.bp.CreateLocalVariations(variations...)
|
||||||
|
|
||||||
|
aModules := make([]Module, len(modules))
|
||||||
for i := range variations {
|
for i := range variations {
|
||||||
base := modules[i].(Module).base()
|
aModules[i] = modules[i].(Module)
|
||||||
|
base := aModules[i].base()
|
||||||
base.commonProperties.DebugMutators = append(base.commonProperties.DebugMutators, b.MutatorName())
|
base.commonProperties.DebugMutators = append(base.commonProperties.DebugMutators, b.MutatorName())
|
||||||
base.commonProperties.DebugVariations = append(base.commonProperties.DebugVariations, variations[i])
|
base.commonProperties.DebugVariations = append(base.commonProperties.DebugVariations, variations[i])
|
||||||
}
|
}
|
||||||
|
|
||||||
return modules
|
return aModules
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *bottomUpMutatorContext) SetDependencyVariation(variation string) {
|
func (b *bottomUpMutatorContext) SetDependencyVariation(variation string) {
|
||||||
|
@@ -25,10 +25,6 @@ func init() {
|
|||||||
RegisterModuleType("prebuilt_usr_share_host", PrebuiltUserShareHostFactory)
|
RegisterModuleType("prebuilt_usr_share_host", PrebuiltUserShareHostFactory)
|
||||||
RegisterModuleType("prebuilt_font", PrebuiltFontFactory)
|
RegisterModuleType("prebuilt_font", PrebuiltFontFactory)
|
||||||
RegisterModuleType("prebuilt_firmware", PrebuiltFirmwareFactory)
|
RegisterModuleType("prebuilt_firmware", PrebuiltFirmwareFactory)
|
||||||
|
|
||||||
PreDepsMutators(func(ctx RegisterMutatorsContext) {
|
|
||||||
ctx.BottomUp("prebuilt_etc", prebuiltEtcMutator).Parallel()
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type prebuiltEtcProperties struct {
|
type prebuiltEtcProperties struct {
|
||||||
@@ -48,8 +44,6 @@ type prebuiltEtcProperties struct {
|
|||||||
// Make this module available when building for recovery.
|
// Make this module available when building for recovery.
|
||||||
Recovery_available *bool
|
Recovery_available *bool
|
||||||
|
|
||||||
InRecovery bool `blueprint:"mutated"`
|
|
||||||
|
|
||||||
// Whether this module is directly installable to one of the partitions. Default: true.
|
// Whether this module is directly installable to one of the partitions. Default: true.
|
||||||
Installable *bool
|
Installable *bool
|
||||||
}
|
}
|
||||||
@@ -76,7 +70,7 @@ type PrebuiltEtc struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *PrebuiltEtc) inRecovery() bool {
|
func (p *PrebuiltEtc) inRecovery() bool {
|
||||||
return p.properties.InRecovery || p.ModuleBase.InstallInRecovery()
|
return p.ModuleBase.InRecovery() || p.ModuleBase.InstallInRecovery()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *PrebuiltEtc) onlyInRecovery() bool {
|
func (p *PrebuiltEtc) onlyInRecovery() bool {
|
||||||
@@ -87,6 +81,25 @@ func (p *PrebuiltEtc) InstallInRecovery() bool {
|
|||||||
return p.inRecovery()
|
return p.inRecovery()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var _ ImageInterface = (*PrebuiltEtc)(nil)
|
||||||
|
|
||||||
|
func (p *PrebuiltEtc) ImageMutatorBegin(ctx BaseModuleContext) {}
|
||||||
|
|
||||||
|
func (p *PrebuiltEtc) CoreVariantNeeded(ctx BaseModuleContext) bool {
|
||||||
|
return !p.ModuleBase.InstallInRecovery()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *PrebuiltEtc) RecoveryVariantNeeded(ctx BaseModuleContext) bool {
|
||||||
|
return Bool(p.properties.Recovery_available) || p.ModuleBase.InstallInRecovery()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *PrebuiltEtc) ExtraImageVariations(ctx BaseModuleContext) []string {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *PrebuiltEtc) SetImageVariation(ctx BaseModuleContext, variation string, module Module) {
|
||||||
|
}
|
||||||
|
|
||||||
func (p *PrebuiltEtc) DepsMutator(ctx BottomUpMutatorContext) {
|
func (p *PrebuiltEtc) DepsMutator(ctx BottomUpMutatorContext) {
|
||||||
if p.properties.Src == nil {
|
if p.properties.Src == nil {
|
||||||
ctx.PropertyErrorf("src", "missing prebuilt source file")
|
ctx.PropertyErrorf("src", "missing prebuilt source file")
|
||||||
@@ -222,49 +235,6 @@ func PrebuiltUserShareHostFactory() Module {
|
|||||||
return module
|
return module
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
|
||||||
// coreMode is the variant for modules to be installed to system.
|
|
||||||
coreMode = "core"
|
|
||||||
|
|
||||||
// recoveryMode means a module to be installed to recovery image.
|
|
||||||
recoveryMode = "recovery"
|
|
||||||
)
|
|
||||||
|
|
||||||
// prebuiltEtcMutator creates the needed variants to install the module to
|
|
||||||
// system or recovery.
|
|
||||||
func prebuiltEtcMutator(mctx BottomUpMutatorContext) {
|
|
||||||
m, ok := mctx.Module().(*PrebuiltEtc)
|
|
||||||
if !ok || m.Host() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
var coreVariantNeeded bool = true
|
|
||||||
var recoveryVariantNeeded bool = false
|
|
||||||
if Bool(m.properties.Recovery_available) {
|
|
||||||
recoveryVariantNeeded = true
|
|
||||||
}
|
|
||||||
|
|
||||||
if m.ModuleBase.InstallInRecovery() {
|
|
||||||
recoveryVariantNeeded = true
|
|
||||||
coreVariantNeeded = false
|
|
||||||
}
|
|
||||||
|
|
||||||
var variants []string
|
|
||||||
if coreVariantNeeded {
|
|
||||||
variants = append(variants, coreMode)
|
|
||||||
}
|
|
||||||
if recoveryVariantNeeded {
|
|
||||||
variants = append(variants, recoveryMode)
|
|
||||||
}
|
|
||||||
mod := mctx.CreateVariations(variants...)
|
|
||||||
for i, v := range variants {
|
|
||||||
if v == recoveryMode {
|
|
||||||
m := mod[i].(*PrebuiltEtc)
|
|
||||||
m.properties.InRecovery = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// prebuilt_font installs a font in <partition>/fonts directory.
|
// prebuilt_font installs a font in <partition>/fonts directory.
|
||||||
func PrebuiltFontFactory() Module {
|
func PrebuiltFontFactory() Module {
|
||||||
module := &PrebuiltEtc{}
|
module := &PrebuiltEtc{}
|
||||||
|
@@ -30,7 +30,7 @@ func testPrebuiltEtc(t *testing.T, bp string) (*TestContext, Config) {
|
|||||||
ctx.RegisterModuleType("prebuilt_font", PrebuiltFontFactory)
|
ctx.RegisterModuleType("prebuilt_font", PrebuiltFontFactory)
|
||||||
ctx.RegisterModuleType("prebuilt_firmware", PrebuiltFirmwareFactory)
|
ctx.RegisterModuleType("prebuilt_firmware", PrebuiltFirmwareFactory)
|
||||||
ctx.PreDepsMutators(func(ctx RegisterMutatorsContext) {
|
ctx.PreDepsMutators(func(ctx RegisterMutatorsContext) {
|
||||||
ctx.BottomUp("prebuilt_etc", prebuiltEtcMutator).Parallel()
|
ctx.BottomUp("prebuilt_etc", ImageMutator).Parallel()
|
||||||
})
|
})
|
||||||
ctx.Register()
|
ctx.Register()
|
||||||
mockFiles := map[string][]byte{
|
mockFiles := map[string][]byte{
|
||||||
|
@@ -716,12 +716,12 @@ func (a *apexBundle) installable() bool {
|
|||||||
|
|
||||||
func (a *apexBundle) getImageVariation(config android.DeviceConfig) string {
|
func (a *apexBundle) getImageVariation(config android.DeviceConfig) string {
|
||||||
if a.vndkApex {
|
if a.vndkApex {
|
||||||
return "vendor." + a.vndkVersion(config)
|
return cc.VendorVariationPrefix + a.vndkVersion(config)
|
||||||
}
|
}
|
||||||
if config.VndkVersion() != "" && proptools.Bool(a.properties.Use_vendor) {
|
if config.VndkVersion() != "" && proptools.Bool(a.properties.Use_vendor) {
|
||||||
return "vendor." + config.PlatformVndkVersion()
|
return cc.VendorVariationPrefix + config.PlatformVndkVersion()
|
||||||
} else {
|
} else {
|
||||||
return "core"
|
return android.CoreVariation
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -140,7 +140,7 @@ func testApexContext(t *testing.T, bp string, handlers ...testCustomizer) (*andr
|
|||||||
ctx.BottomUp("prebuilts", android.PrebuiltMutator).Parallel()
|
ctx.BottomUp("prebuilts", android.PrebuiltMutator).Parallel()
|
||||||
})
|
})
|
||||||
ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) {
|
ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) {
|
||||||
ctx.BottomUp("image", cc.ImageMutator).Parallel()
|
ctx.BottomUp("image", android.ImageMutator).Parallel()
|
||||||
ctx.BottomUp("link", cc.LinkageMutator).Parallel()
|
ctx.BottomUp("link", cc.LinkageMutator).Parallel()
|
||||||
ctx.BottomUp("vndk", cc.VndkMutator).Parallel()
|
ctx.BottomUp("vndk", cc.VndkMutator).Parallel()
|
||||||
ctx.BottomUp("test_per_src", cc.TestPerSrcMutator).Parallel()
|
ctx.BottomUp("test_per_src", cc.TestPerSrcMutator).Parallel()
|
||||||
|
161
cc/cc.go
161
cc/cc.go
@@ -37,7 +37,7 @@ func init() {
|
|||||||
|
|
||||||
android.PreDepsMutators(func(ctx android.RegisterMutatorsContext) {
|
android.PreDepsMutators(func(ctx android.RegisterMutatorsContext) {
|
||||||
ctx.BottomUp("vndk", VndkMutator).Parallel()
|
ctx.BottomUp("vndk", VndkMutator).Parallel()
|
||||||
ctx.BottomUp("image", ImageMutator).Parallel()
|
ctx.BottomUp("image", android.ImageMutator).Parallel()
|
||||||
ctx.BottomUp("link", LinkageMutator).Parallel()
|
ctx.BottomUp("link", LinkageMutator).Parallel()
|
||||||
ctx.BottomUp("ndk_api", ndkApiMutator).Parallel()
|
ctx.BottomUp("ndk_api", ndkApiMutator).Parallel()
|
||||||
ctx.BottomUp("test_per_src", TestPerSrcMutator).Parallel()
|
ctx.BottomUp("test_per_src", TestPerSrcMutator).Parallel()
|
||||||
@@ -218,7 +218,10 @@ type BaseProperties struct {
|
|||||||
// Make this module available when building for recovery
|
// Make this module available when building for recovery
|
||||||
Recovery_available *bool
|
Recovery_available *bool
|
||||||
|
|
||||||
InRecovery bool `blueprint:"mutated"`
|
// Set by ImageMutator
|
||||||
|
CoreVariantNeeded bool `blueprint:"mutated"`
|
||||||
|
RecoveryVariantNeeded bool `blueprint:"mutated"`
|
||||||
|
VendorVariants []string `blueprint:"mutated"`
|
||||||
|
|
||||||
// Allows this module to use non-APEX version of libraries. Useful
|
// Allows this module to use non-APEX version of libraries. Useful
|
||||||
// for building binaries that are started before APEXes are activated.
|
// for building binaries that are started before APEXes are activated.
|
||||||
@@ -826,7 +829,7 @@ func (c *Module) HasVendorVariant() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Module) InRecovery() bool {
|
func (c *Module) InRecovery() bool {
|
||||||
return c.Properties.InRecovery || c.ModuleBase.InstallInRecovery()
|
return c.ModuleBase.InRecovery() || c.ModuleBase.InstallInRecovery()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Module) OnlyInRecovery() bool {
|
func (c *Module) OnlyInRecovery() bool {
|
||||||
@@ -1588,8 +1591,7 @@ func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) {
|
|||||||
depTag = headerExportDepTag
|
depTag = headerExportDepTag
|
||||||
}
|
}
|
||||||
if buildStubs {
|
if buildStubs {
|
||||||
actx.AddFarVariationDependencies(append(ctx.Target().Variations(),
|
actx.AddFarVariationDependencies(append(ctx.Target().Variations(), c.ImageVariation()),
|
||||||
blueprint.Variation{Mutator: "image", Variation: c.imageVariation()}),
|
|
||||||
depTag, lib)
|
depTag, lib)
|
||||||
} else {
|
} else {
|
||||||
actx.AddVariationDependencies(nil, depTag, lib)
|
actx.AddVariationDependencies(nil, depTag, lib)
|
||||||
@@ -1727,14 +1729,8 @@ func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) {
|
|||||||
|
|
||||||
if vndkdep := c.vndkdep; vndkdep != nil {
|
if vndkdep := c.vndkdep; vndkdep != nil {
|
||||||
if vndkdep.isVndkExt() {
|
if vndkdep.isVndkExt() {
|
||||||
var baseModuleMode string
|
|
||||||
if actx.DeviceConfig().VndkVersion() == "" {
|
|
||||||
baseModuleMode = coreMode
|
|
||||||
} else {
|
|
||||||
baseModuleMode = c.imageVariation()
|
|
||||||
}
|
|
||||||
actx.AddVariationDependencies([]blueprint.Variation{
|
actx.AddVariationDependencies([]blueprint.Variation{
|
||||||
{Mutator: "image", Variation: baseModuleMode},
|
c.ImageVariation(),
|
||||||
{Mutator: "link", Variation: "shared"},
|
{Mutator: "link", Variation: "shared"},
|
||||||
}, vndkExtDepTag, vndkdep.getVndkExtendsModuleName())
|
}, vndkExtDepTag, vndkdep.getVndkExtendsModuleName())
|
||||||
}
|
}
|
||||||
@@ -2389,15 +2385,6 @@ func (c *Module) installable() bool {
|
|||||||
return c.installer != nil && !c.Properties.PreventInstall && c.IsForPlatform() && c.outputFile.Valid()
|
return c.installer != nil && !c.Properties.PreventInstall && c.IsForPlatform() && c.outputFile.Valid()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Module) imageVariation() string {
|
|
||||||
if c.UseVndk() {
|
|
||||||
return vendorMode + "." + c.Properties.VndkVersion
|
|
||||||
} else if c.InRecovery() {
|
|
||||||
return recoveryMode
|
|
||||||
}
|
|
||||||
return coreMode
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Module) IDEInfo(dpInfo *android.IdeInfo) {
|
func (c *Module) IDEInfo(dpInfo *android.IdeInfo) {
|
||||||
outputFiles, err := c.OutputFiles("")
|
outputFiles, err := c.OutputFiles("")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -2481,15 +2468,9 @@ func DefaultsFactory(props ...interface{}) android.Module {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// coreMode is the variant used for framework-private libraries, or
|
// VendorVariationPrefix is the variant prefix used for /vendor code that compiles
|
||||||
// SDK libraries. (which framework-private libraries can use)
|
|
||||||
coreMode = "core"
|
|
||||||
|
|
||||||
// vendorMode is the variant prefix used for /vendor code that compiles
|
|
||||||
// against the VNDK.
|
// against the VNDK.
|
||||||
vendorMode = "vendor"
|
VendorVariationPrefix = "vendor."
|
||||||
|
|
||||||
recoveryMode = "recovery"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func squashVendorSrcs(m *Module) {
|
func squashVendorSrcs(m *Module) {
|
||||||
@@ -2512,74 +2493,9 @@ func squashRecoverySrcs(m *Module) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func ImageMutator(mctx android.BottomUpMutatorContext) {
|
var _ android.ImageInterface = (*Module)(nil)
|
||||||
if mctx.Os() != android.Android {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if g, ok := mctx.Module().(*genrule.Module); ok {
|
|
||||||
if props, ok := g.Extra.(*GenruleExtraProperties); ok {
|
|
||||||
var coreVariantNeeded bool = false
|
|
||||||
var vendorVariantNeeded bool = false
|
|
||||||
var recoveryVariantNeeded bool = false
|
|
||||||
if mctx.DeviceConfig().VndkVersion() == "" {
|
|
||||||
coreVariantNeeded = true
|
|
||||||
} else if Bool(props.Vendor_available) {
|
|
||||||
coreVariantNeeded = true
|
|
||||||
vendorVariantNeeded = true
|
|
||||||
} else if mctx.SocSpecific() || mctx.DeviceSpecific() {
|
|
||||||
vendorVariantNeeded = true
|
|
||||||
} else {
|
|
||||||
coreVariantNeeded = true
|
|
||||||
}
|
|
||||||
if Bool(props.Recovery_available) {
|
|
||||||
recoveryVariantNeeded = true
|
|
||||||
}
|
|
||||||
|
|
||||||
if recoveryVariantNeeded {
|
|
||||||
primaryArch := mctx.Config().DevicePrimaryArchType()
|
|
||||||
moduleArch := g.Target().Arch.ArchType
|
|
||||||
if moduleArch != primaryArch {
|
|
||||||
recoveryVariantNeeded = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var variants []string
|
|
||||||
if coreVariantNeeded {
|
|
||||||
variants = append(variants, coreMode)
|
|
||||||
}
|
|
||||||
if vendorVariantNeeded {
|
|
||||||
variants = append(variants, vendorMode+"."+mctx.DeviceConfig().PlatformVndkVersion())
|
|
||||||
if vndkVersion := mctx.DeviceConfig().VndkVersion(); vndkVersion != "current" {
|
|
||||||
variants = append(variants, vendorMode+"."+vndkVersion)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if recoveryVariantNeeded {
|
|
||||||
variants = append(variants, recoveryMode)
|
|
||||||
}
|
|
||||||
mod := mctx.CreateVariations(variants...)
|
|
||||||
for i, v := range variants {
|
|
||||||
if v == recoveryMode {
|
|
||||||
m := mod[i].(*genrule.Module)
|
|
||||||
m.Extra.(*GenruleExtraProperties).InRecovery = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO When LinkableInterface supports VNDK, this should be mctx.Module().(LinkableInterface)
|
|
||||||
m, ok := mctx.Module().(*Module)
|
|
||||||
if !ok {
|
|
||||||
if linkable, ok := mctx.Module().(LinkableInterface); ok {
|
|
||||||
variations := []string{coreMode}
|
|
||||||
if linkable.InRecovery() {
|
|
||||||
variations = append(variations, recoveryMode)
|
|
||||||
}
|
|
||||||
mctx.CreateVariations(variations...)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
|
func (m *Module) ImageMutatorBegin(mctx android.BaseModuleContext) {
|
||||||
// Sanity check
|
// Sanity check
|
||||||
vendorSpecific := mctx.SocSpecific() || mctx.DeviceSpecific()
|
vendorSpecific := mctx.SocSpecific() || mctx.DeviceSpecific()
|
||||||
productSpecific := mctx.ProductSpecific()
|
productSpecific := mctx.ProductSpecific()
|
||||||
@@ -2587,7 +2503,6 @@ func ImageMutator(mctx android.BottomUpMutatorContext) {
|
|||||||
if m.VendorProperties.Vendor_available != nil && vendorSpecific {
|
if m.VendorProperties.Vendor_available != nil && vendorSpecific {
|
||||||
mctx.PropertyErrorf("vendor_available",
|
mctx.PropertyErrorf("vendor_available",
|
||||||
"doesn't make sense at the same time as `vendor: true`, `proprietary: true`, or `device_specific:true`")
|
"doesn't make sense at the same time as `vendor: true`, `proprietary: true`, or `device_specific:true`")
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if vndkdep := m.vndkdep; vndkdep != nil {
|
if vndkdep := m.vndkdep; vndkdep != nil {
|
||||||
@@ -2595,38 +2510,32 @@ func ImageMutator(mctx android.BottomUpMutatorContext) {
|
|||||||
if productSpecific {
|
if productSpecific {
|
||||||
mctx.PropertyErrorf("product_specific",
|
mctx.PropertyErrorf("product_specific",
|
||||||
"product_specific must not be true when `vndk: {enabled: true}`")
|
"product_specific must not be true when `vndk: {enabled: true}`")
|
||||||
return
|
|
||||||
}
|
}
|
||||||
if vendorSpecific {
|
if vendorSpecific {
|
||||||
if !vndkdep.isVndkExt() {
|
if !vndkdep.isVndkExt() {
|
||||||
mctx.PropertyErrorf("vndk",
|
mctx.PropertyErrorf("vndk",
|
||||||
"must set `extends: \"...\"` to vndk extension")
|
"must set `extends: \"...\"` to vndk extension")
|
||||||
return
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if vndkdep.isVndkExt() {
|
if vndkdep.isVndkExt() {
|
||||||
mctx.PropertyErrorf("vndk",
|
mctx.PropertyErrorf("vndk",
|
||||||
"must set `vendor: true` to set `extends: %q`",
|
"must set `vendor: true` to set `extends: %q`",
|
||||||
m.getVndkExtendsModuleName())
|
m.getVndkExtendsModuleName())
|
||||||
return
|
|
||||||
}
|
}
|
||||||
if m.VendorProperties.Vendor_available == nil {
|
if m.VendorProperties.Vendor_available == nil {
|
||||||
mctx.PropertyErrorf("vndk",
|
mctx.PropertyErrorf("vndk",
|
||||||
"vendor_available must be set to either true or false when `vndk: {enabled: true}`")
|
"vendor_available must be set to either true or false when `vndk: {enabled: true}`")
|
||||||
return
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if vndkdep.isVndkSp() {
|
if vndkdep.isVndkSp() {
|
||||||
mctx.PropertyErrorf("vndk",
|
mctx.PropertyErrorf("vndk",
|
||||||
"must set `enabled: true` to set `support_system_process: true`")
|
"must set `enabled: true` to set `support_system_process: true`")
|
||||||
return
|
|
||||||
}
|
}
|
||||||
if vndkdep.isVndkExt() {
|
if vndkdep.isVndkExt() {
|
||||||
mctx.PropertyErrorf("vndk",
|
mctx.PropertyErrorf("vndk",
|
||||||
"must set `enabled: true` to set `extends: %q`",
|
"must set `enabled: true` to set `extends: %q`",
|
||||||
m.getVndkExtendsModuleName())
|
m.getVndkExtendsModuleName())
|
||||||
return
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2705,28 +2614,34 @@ func ImageMutator(mctx android.BottomUpMutatorContext) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var variants []string
|
|
||||||
if coreVariantNeeded {
|
|
||||||
variants = append(variants, coreMode)
|
|
||||||
}
|
|
||||||
for _, variant := range android.FirstUniqueStrings(vendorVariants) {
|
for _, variant := range android.FirstUniqueStrings(vendorVariants) {
|
||||||
variants = append(variants, vendorMode+"."+variant)
|
m.Properties.VendorVariants = append(m.Properties.VendorVariants, VendorVariationPrefix+variant)
|
||||||
}
|
}
|
||||||
if recoveryVariantNeeded {
|
|
||||||
variants = append(variants, recoveryMode)
|
m.Properties.RecoveryVariantNeeded = recoveryVariantNeeded
|
||||||
}
|
m.Properties.CoreVariantNeeded = coreVariantNeeded
|
||||||
mod := mctx.CreateVariations(variants...)
|
}
|
||||||
for i, v := range variants {
|
|
||||||
if strings.HasPrefix(v, vendorMode+".") {
|
func (c *Module) CoreVariantNeeded(ctx android.BaseModuleContext) bool {
|
||||||
m := mod[i].(*Module)
|
return c.Properties.CoreVariantNeeded
|
||||||
m.Properties.VndkVersion = strings.TrimPrefix(v, vendorMode+".")
|
}
|
||||||
squashVendorSrcs(m)
|
|
||||||
} else if v == recoveryMode {
|
func (c *Module) RecoveryVariantNeeded(ctx android.BaseModuleContext) bool {
|
||||||
m := mod[i].(*Module)
|
return c.Properties.RecoveryVariantNeeded
|
||||||
m.Properties.InRecovery = true
|
}
|
||||||
m.MakeAsPlatform()
|
|
||||||
squashRecoverySrcs(m)
|
func (c *Module) ExtraImageVariations(ctx android.BaseModuleContext) []string {
|
||||||
}
|
return c.Properties.VendorVariants
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Module) SetImageVariation(ctx android.BaseModuleContext, variant string, module android.Module) {
|
||||||
|
m := module.(*Module)
|
||||||
|
if variant == android.RecoveryVariation {
|
||||||
|
m.MakeAsPlatform()
|
||||||
|
squashRecoverySrcs(m)
|
||||||
|
} else if strings.HasPrefix(variant, VendorVariationPrefix) {
|
||||||
|
m.Properties.VndkVersion = strings.TrimPrefix(variant, VendorVariationPrefix)
|
||||||
|
squashVendorSrcs(m)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -26,9 +26,6 @@ func init() {
|
|||||||
type GenruleExtraProperties struct {
|
type GenruleExtraProperties struct {
|
||||||
Vendor_available *bool
|
Vendor_available *bool
|
||||||
Recovery_available *bool
|
Recovery_available *bool
|
||||||
|
|
||||||
// This genrule is for recovery variant
|
|
||||||
InRecovery bool `blueprint:"mutated"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// cc_genrule is a genrule that can depend on other cc_* objects.
|
// cc_genrule is a genrule that can depend on other cc_* objects.
|
||||||
@@ -37,7 +34,9 @@ type GenruleExtraProperties struct {
|
|||||||
func genRuleFactory() android.Module {
|
func genRuleFactory() android.Module {
|
||||||
module := genrule.NewGenRule()
|
module := genrule.NewGenRule()
|
||||||
|
|
||||||
module.Extra = &GenruleExtraProperties{}
|
extra := &GenruleExtraProperties{}
|
||||||
|
module.Extra = extra
|
||||||
|
module.ImageInterface = extra
|
||||||
module.AddProperties(module.Extra)
|
module.AddProperties(module.Extra)
|
||||||
|
|
||||||
android.InitAndroidArchModule(module, android.HostAndDeviceSupported, android.MultilibBoth)
|
android.InitAndroidArchModule(module, android.HostAndDeviceSupported, android.MultilibBoth)
|
||||||
@@ -46,3 +45,44 @@ func genRuleFactory() android.Module {
|
|||||||
|
|
||||||
return module
|
return module
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var _ android.ImageInterface = (*GenruleExtraProperties)(nil)
|
||||||
|
|
||||||
|
func (g *GenruleExtraProperties) ImageMutatorBegin(ctx android.BaseModuleContext) {}
|
||||||
|
|
||||||
|
func (g *GenruleExtraProperties) CoreVariantNeeded(ctx android.BaseModuleContext) bool {
|
||||||
|
if ctx.DeviceConfig().VndkVersion() == "" {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
return Bool(g.Vendor_available) || !(ctx.SocSpecific() || ctx.DeviceSpecific())
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GenruleExtraProperties) RecoveryVariantNeeded(ctx android.BaseModuleContext) bool {
|
||||||
|
if Bool(g.Recovery_available) {
|
||||||
|
primaryArch := ctx.Config().DevicePrimaryArchType()
|
||||||
|
moduleArch := ctx.Target().Arch.ArchType
|
||||||
|
return moduleArch == primaryArch
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GenruleExtraProperties) ExtraImageVariations(ctx android.BaseModuleContext) []string {
|
||||||
|
if ctx.DeviceConfig().VndkVersion() == "" {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if Bool(g.Vendor_available) || ctx.SocSpecific() || ctx.DeviceSpecific() {
|
||||||
|
var variants []string
|
||||||
|
variants = append(variants, VendorVariationPrefix+ctx.DeviceConfig().PlatformVndkVersion())
|
||||||
|
if vndkVersion := ctx.DeviceConfig().VndkVersion(); vndkVersion != "current" {
|
||||||
|
variants = append(variants, VendorVariationPrefix+vndkVersion)
|
||||||
|
}
|
||||||
|
return variants
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GenruleExtraProperties) SetImageVariation(ctx android.BaseModuleContext, variation string, module android.Module) {
|
||||||
|
}
|
||||||
|
@@ -1359,9 +1359,11 @@ func VersionMutator(mctx android.BottomUpMutatorContext) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if genrule, ok := mctx.Module().(*genrule.Module); ok {
|
if genrule, ok := mctx.Module().(*genrule.Module); ok {
|
||||||
if props, ok := genrule.Extra.(*GenruleExtraProperties); ok && !props.InRecovery {
|
if _, ok := genrule.Extra.(*GenruleExtraProperties); ok {
|
||||||
mctx.CreateVariations("")
|
if !genrule.InRecovery() {
|
||||||
return
|
mctx.CreateVariations("")
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -886,13 +886,13 @@ func sanitizerRuntimeMutator(mctx android.BottomUpMutatorContext) {
|
|||||||
// static executable gets static runtime libs
|
// static executable gets static runtime libs
|
||||||
mctx.AddFarVariationDependencies(append(mctx.Target().Variations(), []blueprint.Variation{
|
mctx.AddFarVariationDependencies(append(mctx.Target().Variations(), []blueprint.Variation{
|
||||||
{Mutator: "link", Variation: "static"},
|
{Mutator: "link", Variation: "static"},
|
||||||
{Mutator: "image", Variation: c.imageVariation()},
|
c.ImageVariation(),
|
||||||
}...), StaticDepTag, append([]string{runtimeLibrary}, extraStaticDeps...)...)
|
}...), StaticDepTag, append([]string{runtimeLibrary}, extraStaticDeps...)...)
|
||||||
} else if !c.static() && !c.header() {
|
} else if !c.static() && !c.header() {
|
||||||
// dynamic executable and shared libs get shared runtime libs
|
// dynamic executable and shared libs get shared runtime libs
|
||||||
mctx.AddFarVariationDependencies(append(mctx.Target().Variations(), []blueprint.Variation{
|
mctx.AddFarVariationDependencies(append(mctx.Target().Variations(), []blueprint.Variation{
|
||||||
{Mutator: "link", Variation: "shared"},
|
{Mutator: "link", Variation: "shared"},
|
||||||
{Mutator: "image", Variation: c.imageVariation()},
|
c.ImageVariation(),
|
||||||
}...), earlySharedDepTag, runtimeLibrary)
|
}...), earlySharedDepTag, runtimeLibrary)
|
||||||
}
|
}
|
||||||
// static lib does not have dependency to the runtime library. The
|
// static lib does not have dependency to the runtime library. The
|
||||||
|
@@ -271,7 +271,7 @@ func CreateTestContext(bp string, fs map[string][]byte,
|
|||||||
ctx.RegisterModuleType("vndk_prebuilt_shared", VndkPrebuiltSharedFactory)
|
ctx.RegisterModuleType("vndk_prebuilt_shared", VndkPrebuiltSharedFactory)
|
||||||
ctx.RegisterModuleType("vndk_libraries_txt", VndkLibrariesTxtFactory)
|
ctx.RegisterModuleType("vndk_libraries_txt", VndkLibrariesTxtFactory)
|
||||||
ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) {
|
ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) {
|
||||||
ctx.BottomUp("image", ImageMutator).Parallel()
|
ctx.BottomUp("image", android.ImageMutator).Parallel()
|
||||||
ctx.BottomUp("link", LinkageMutator).Parallel()
|
ctx.BottomUp("link", LinkageMutator).Parallel()
|
||||||
ctx.BottomUp("vndk", VndkMutator).Parallel()
|
ctx.BottomUp("vndk", VndkMutator).Parallel()
|
||||||
ctx.BottomUp("version", VersionMutator).Parallel()
|
ctx.BottomUp("version", VersionMutator).Parallel()
|
||||||
|
@@ -118,6 +118,7 @@ type Module struct {
|
|||||||
// For other packages to make their own genrules with extra
|
// For other packages to make their own genrules with extra
|
||||||
// properties
|
// properties
|
||||||
Extra interface{}
|
Extra interface{}
|
||||||
|
android.ImageInterface
|
||||||
|
|
||||||
properties generatorProperties
|
properties generatorProperties
|
||||||
|
|
||||||
@@ -532,9 +533,20 @@ func generatorFactory(taskGenerator taskFunc, props ...interface{}) *Module {
|
|||||||
module.AddProperties(props...)
|
module.AddProperties(props...)
|
||||||
module.AddProperties(&module.properties)
|
module.AddProperties(&module.properties)
|
||||||
|
|
||||||
|
module.ImageInterface = noopImageInterface{}
|
||||||
|
|
||||||
return module
|
return module
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type noopImageInterface struct{}
|
||||||
|
|
||||||
|
func (x noopImageInterface) ImageMutatorBegin(android.BaseModuleContext) {}
|
||||||
|
func (x noopImageInterface) CoreVariantNeeded(android.BaseModuleContext) bool { return false }
|
||||||
|
func (x noopImageInterface) RecoveryVariantNeeded(android.BaseModuleContext) bool { return false }
|
||||||
|
func (x noopImageInterface) ExtraImageVariations(ctx android.BaseModuleContext) []string { return nil }
|
||||||
|
func (x noopImageInterface) SetImageVariation(ctx android.BaseModuleContext, variation string, module android.Module) {
|
||||||
|
}
|
||||||
|
|
||||||
// replace "out" with "__SBOX_OUT_DIR__/<the value of ${out}>"
|
// replace "out" with "__SBOX_OUT_DIR__/<the value of ${out}>"
|
||||||
func pathToSandboxOut(path android.Path, genDir android.Path) string {
|
func pathToSandboxOut(path android.Path, genDir android.Path) string {
|
||||||
relOut, err := filepath.Rel(genDir.String(), path.String())
|
relOut, err := filepath.Rel(genDir.String(), path.String())
|
||||||
|
21
rust/rust.go
21
rust/rust.go
@@ -77,6 +77,25 @@ type Module struct {
|
|||||||
outputFile android.OptionalPath
|
outputFile android.OptionalPath
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var _ android.ImageInterface = (*Module)(nil)
|
||||||
|
|
||||||
|
func (mod *Module) ImageMutatorBegin(ctx android.BaseModuleContext) {}
|
||||||
|
|
||||||
|
func (mod *Module) CoreVariantNeeded(ctx android.BaseModuleContext) bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (mod *Module) RecoveryVariantNeeded(android.BaseModuleContext) bool {
|
||||||
|
return mod.InRecovery()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (mod *Module) ExtraImageVariations(android.BaseModuleContext) []string {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Module) SetImageVariation(ctx android.BaseModuleContext, variant string, module android.Module) {
|
||||||
|
}
|
||||||
|
|
||||||
func (mod *Module) BuildStubs() bool {
|
func (mod *Module) BuildStubs() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@@ -687,7 +706,7 @@ func (mod *Module) DepsMutator(actx android.BottomUpMutatorContext) {
|
|||||||
blueprint.Variation{Mutator: "version", Variation: ""})
|
blueprint.Variation{Mutator: "version", Variation: ""})
|
||||||
if !mod.Host() {
|
if !mod.Host() {
|
||||||
commonDepVariations = append(commonDepVariations,
|
commonDepVariations = append(commonDepVariations,
|
||||||
blueprint.Variation{Mutator: "image", Variation: "core"})
|
blueprint.Variation{Mutator: "image", Variation: android.CoreVariation})
|
||||||
}
|
}
|
||||||
|
|
||||||
actx.AddVariationDependencies(
|
actx.AddVariationDependencies(
|
||||||
|
@@ -185,7 +185,7 @@ func CreateTestContext(bp string) *android.TestContext {
|
|||||||
ctx.RegisterModuleType("toolchain_library", cc.ToolchainLibraryFactory)
|
ctx.RegisterModuleType("toolchain_library", cc.ToolchainLibraryFactory)
|
||||||
ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) {
|
ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) {
|
||||||
// cc mutators
|
// cc mutators
|
||||||
ctx.BottomUp("image", cc.ImageMutator).Parallel()
|
ctx.BottomUp("image", android.ImageMutator).Parallel()
|
||||||
ctx.BottomUp("link", cc.LinkageMutator).Parallel()
|
ctx.BottomUp("link", cc.LinkageMutator).Parallel()
|
||||||
ctx.BottomUp("version", cc.VersionMutator).Parallel()
|
ctx.BottomUp("version", cc.VersionMutator).Parallel()
|
||||||
ctx.BottomUp("begin", cc.BeginMutator).Parallel()
|
ctx.BottomUp("begin", cc.BeginMutator).Parallel()
|
||||||
|
@@ -187,7 +187,7 @@ func memberMutator(mctx android.BottomUpMutatorContext) {
|
|||||||
version = cc.LatestStubsVersionFor(mctx.Config(), name)
|
version = cc.LatestStubsVersionFor(mctx.Config(), name)
|
||||||
}
|
}
|
||||||
mctx.AddFarVariationDependencies(append(target.Variations(), []blueprint.Variation{
|
mctx.AddFarVariationDependencies(append(target.Variations(), []blueprint.Variation{
|
||||||
{Mutator: "image", Variation: "core"},
|
{Mutator: "image", Variation: android.CoreVariation},
|
||||||
{Mutator: "link", Variation: "shared"},
|
{Mutator: "link", Variation: "shared"},
|
||||||
{Mutator: "version", Variation: version},
|
{Mutator: "version", Variation: version},
|
||||||
}...), sdkMemberDepTag, name)
|
}...), sdkMemberDepTag, name)
|
||||||
|
@@ -57,7 +57,7 @@ func testSdkContext(t *testing.T, bp string) (*android.TestContext, android.Conf
|
|||||||
ctx.RegisterModuleType("llndk_library", cc.LlndkLibraryFactory)
|
ctx.RegisterModuleType("llndk_library", cc.LlndkLibraryFactory)
|
||||||
ctx.RegisterModuleType("toolchain_library", cc.ToolchainLibraryFactory)
|
ctx.RegisterModuleType("toolchain_library", cc.ToolchainLibraryFactory)
|
||||||
ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) {
|
ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) {
|
||||||
ctx.BottomUp("image", cc.ImageMutator).Parallel()
|
ctx.BottomUp("image", android.ImageMutator).Parallel()
|
||||||
ctx.BottomUp("link", cc.LinkageMutator).Parallel()
|
ctx.BottomUp("link", cc.LinkageMutator).Parallel()
|
||||||
ctx.BottomUp("vndk", cc.VndkMutator).Parallel()
|
ctx.BottomUp("vndk", cc.VndkMutator).Parallel()
|
||||||
ctx.BottomUp("test_per_src", cc.TestPerSrcMutator).Parallel()
|
ctx.BottomUp("test_per_src", cc.TestPerSrcMutator).Parallel()
|
||||||
|
@@ -73,7 +73,7 @@ func testContext(config android.Config, bp string,
|
|||||||
ctx.RegisterModuleType("llndk_library", cc.LlndkLibraryFactory)
|
ctx.RegisterModuleType("llndk_library", cc.LlndkLibraryFactory)
|
||||||
ctx.RegisterModuleType("toolchain_library", cc.ToolchainLibraryFactory)
|
ctx.RegisterModuleType("toolchain_library", cc.ToolchainLibraryFactory)
|
||||||
ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) {
|
ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) {
|
||||||
ctx.BottomUp("image", cc.ImageMutator).Parallel()
|
ctx.BottomUp("image", android.ImageMutator).Parallel()
|
||||||
ctx.BottomUp("link", cc.LinkageMutator).Parallel()
|
ctx.BottomUp("link", cc.LinkageMutator).Parallel()
|
||||||
ctx.BottomUp("vndk", cc.VndkMutator).Parallel()
|
ctx.BottomUp("vndk", cc.VndkMutator).Parallel()
|
||||||
ctx.BottomUp("version", cc.VersionMutator).Parallel()
|
ctx.BottomUp("version", cc.VersionMutator).Parallel()
|
||||||
|
Reference in New Issue
Block a user