Snap for 12385180 from 10c4a0aacb
to 24Q4-release
Change-Id: Ie7832fec0d5bc6050a17488a6889618e2869090d
This commit is contained in:
@@ -88,6 +88,7 @@ bootstrap_go_package {
|
||||
"prebuilt.go",
|
||||
"prebuilt_build_tool.go",
|
||||
"product_config.go",
|
||||
"product_config_to_bp.go",
|
||||
"proto.go",
|
||||
"provider.go",
|
||||
"raw_files.go",
|
||||
|
@@ -238,6 +238,11 @@ func (c Config) ReleaseAconfigFlagDefaultPermission() string {
|
||||
return c.config.productVariables.ReleaseAconfigFlagDefaultPermission
|
||||
}
|
||||
|
||||
// Enable object size sanitizer
|
||||
func (c Config) ReleaseBuildObjectSizeSanitizer() bool {
|
||||
return c.config.productVariables.GetBuildFlagBool("RELEASE_BUILD_OBJECT_SIZE_SANITIZER")
|
||||
}
|
||||
|
||||
// The flag indicating behavior for the tree wrt building modules or using prebuilts
|
||||
// derived from RELEASE_DEFAULT_MODULE_BUILD_FROM_SOURCE
|
||||
func (c Config) ReleaseDefaultModuleBuildFromSource() bool {
|
||||
@@ -1965,6 +1970,10 @@ func (c *config) GetBuildFlag(name string) (string, bool) {
|
||||
return val, ok
|
||||
}
|
||||
|
||||
func (c *config) UseOptimizedResourceShrinkingByDefault() bool {
|
||||
return c.productVariables.GetBuildFlagBool("RELEASE_USE_OPTIMIZED_RESOURCE_SHRINKING_BY_DEFAULT")
|
||||
}
|
||||
|
||||
func (c *config) UseResourceProcessorByDefault() bool {
|
||||
return c.productVariables.GetBuildFlagBool("RELEASE_USE_RESOURCE_PROCESSOR_BY_DEFAULT")
|
||||
}
|
||||
|
@@ -69,7 +69,7 @@ type Defaultable interface {
|
||||
|
||||
// Apply defaults from the supplied Defaults to the property structures supplied to
|
||||
// setProperties(...).
|
||||
applyDefaults(TopDownMutatorContext, []Defaults)
|
||||
applyDefaults(BottomUpMutatorContext, []Defaults)
|
||||
|
||||
// Set the hook to be called after any defaults have been applied.
|
||||
//
|
||||
@@ -101,6 +101,7 @@ func InitDefaultableModule(module DefaultableModule) {
|
||||
// A restricted subset of context methods, similar to LoadHookContext.
|
||||
type DefaultableHookContext interface {
|
||||
EarlyModuleContext
|
||||
OtherModuleProviderContext
|
||||
|
||||
CreateModule(ModuleFactory, ...interface{}) Module
|
||||
AddMissingDependencies(missingDeps []string)
|
||||
@@ -209,7 +210,7 @@ func InitDefaultsModule(module DefaultsModule) {
|
||||
|
||||
var _ Defaults = (*DefaultsModuleBase)(nil)
|
||||
|
||||
func (defaultable *DefaultableModuleBase) applyDefaults(ctx TopDownMutatorContext,
|
||||
func (defaultable *DefaultableModuleBase) applyDefaults(ctx BottomUpMutatorContext,
|
||||
defaultsList []Defaults) {
|
||||
|
||||
for _, defaults := range defaultsList {
|
||||
@@ -226,7 +227,7 @@ func (defaultable *DefaultableModuleBase) applyDefaults(ctx TopDownMutatorContex
|
||||
// Product variable properties need special handling, the type of the filtered product variable
|
||||
// property struct may not be identical between the defaults module and the defaultable module.
|
||||
// Use PrependMatchingProperties to apply whichever properties match.
|
||||
func (defaultable *DefaultableModuleBase) applyDefaultVariableProperties(ctx TopDownMutatorContext,
|
||||
func (defaultable *DefaultableModuleBase) applyDefaultVariableProperties(ctx BottomUpMutatorContext,
|
||||
defaults Defaults, defaultableProp interface{}) {
|
||||
if defaultableProp == nil {
|
||||
return
|
||||
@@ -254,7 +255,7 @@ func (defaultable *DefaultableModuleBase) applyDefaultVariableProperties(ctx Top
|
||||
}
|
||||
}
|
||||
|
||||
func (defaultable *DefaultableModuleBase) applyDefaultProperties(ctx TopDownMutatorContext,
|
||||
func (defaultable *DefaultableModuleBase) applyDefaultProperties(ctx BottomUpMutatorContext,
|
||||
defaults Defaults, defaultableProp interface{}) {
|
||||
|
||||
for _, def := range defaults.properties() {
|
||||
@@ -273,7 +274,7 @@ func (defaultable *DefaultableModuleBase) applyDefaultProperties(ctx TopDownMuta
|
||||
|
||||
func RegisterDefaultsPreArchMutators(ctx RegisterMutatorsContext) {
|
||||
ctx.BottomUp("defaults_deps", defaultsDepsMutator).Parallel()
|
||||
ctx.TopDown("defaults", defaultsMutator).Parallel()
|
||||
ctx.BottomUp("defaults", defaultsMutator).Parallel()
|
||||
}
|
||||
|
||||
func defaultsDepsMutator(ctx BottomUpMutatorContext) {
|
||||
@@ -282,8 +283,12 @@ func defaultsDepsMutator(ctx BottomUpMutatorContext) {
|
||||
}
|
||||
}
|
||||
|
||||
func defaultsMutator(ctx TopDownMutatorContext) {
|
||||
func defaultsMutator(ctx BottomUpMutatorContext) {
|
||||
if defaultable, ok := ctx.Module().(Defaultable); ok {
|
||||
if _, isDefaultsModule := ctx.Module().(Defaults); isDefaultsModule {
|
||||
// Don't squash transitive defaults into defaults modules
|
||||
return
|
||||
}
|
||||
defaults := defaultable.defaults().Defaults
|
||||
if len(defaults) > 0 {
|
||||
var defaultsList []Defaults
|
||||
|
@@ -2211,6 +2211,7 @@ type ConfigContext interface {
|
||||
}
|
||||
|
||||
type ConfigurableEvaluatorContext interface {
|
||||
OtherModuleProviderContext
|
||||
Config() Config
|
||||
OtherModulePropertyErrorf(module Module, property string, fmt string, args ...interface{})
|
||||
HasMutatorFinished(mutatorName string) bool
|
||||
|
@@ -193,16 +193,16 @@ type BaseMutatorContext interface {
|
||||
// Rename all variants of a module. The new name is not visible to calls to ModuleName,
|
||||
// AddDependency or OtherModuleName until after this mutator pass is complete.
|
||||
Rename(name string)
|
||||
|
||||
// CreateModule creates a new module by calling the factory method for the specified moduleType, and applies
|
||||
// the specified property structs to it as if the properties were set in a blueprint file.
|
||||
CreateModule(ModuleFactory, ...interface{}) Module
|
||||
}
|
||||
|
||||
type TopDownMutator func(TopDownMutatorContext)
|
||||
|
||||
type TopDownMutatorContext interface {
|
||||
BaseMutatorContext
|
||||
|
||||
// CreateModule creates a new module by calling the factory method for the specified moduleType, and applies
|
||||
// the specified property structs to it as if the properties were set in a blueprint file.
|
||||
CreateModule(ModuleFactory, ...interface{}) Module
|
||||
}
|
||||
|
||||
type topDownMutatorContext struct {
|
||||
@@ -742,6 +742,14 @@ func (b *bottomUpMutatorContext) Rename(name string) {
|
||||
b.Module().base().commonProperties.DebugName = name
|
||||
}
|
||||
|
||||
func (b *bottomUpMutatorContext) createModule(factory blueprint.ModuleFactory, name string, props ...interface{}) blueprint.Module {
|
||||
return b.bp.CreateModule(factory, name, props...)
|
||||
}
|
||||
|
||||
func (b *bottomUpMutatorContext) CreateModule(factory ModuleFactory, props ...interface{}) Module {
|
||||
return createModule(b, factory, "_bottomUpMutatorModule", props...)
|
||||
}
|
||||
|
||||
func (b *bottomUpMutatorContext) AddDependency(module blueprint.Module, tag blueprint.DependencyTag, name ...string) []blueprint.Module {
|
||||
if b.baseModuleContext.checkedMissingDeps() {
|
||||
panic("Adding deps not allowed after checking for missing deps")
|
||||
|
@@ -91,6 +91,7 @@ func GlobFiles(ctx EarlyModulePathContext, globPattern string, excludes []string
|
||||
// the Path methods that rely on module dependencies having been resolved.
|
||||
type ModuleWithDepsPathContext interface {
|
||||
EarlyModulePathContext
|
||||
OtherModuleProviderContext
|
||||
VisitDirectDepsBlueprint(visit func(blueprint.Module))
|
||||
OtherModuleDependencyTag(m blueprint.Module) blueprint.DependencyTag
|
||||
HasMutatorFinished(mutatorName string) bool
|
||||
|
@@ -14,7 +14,9 @@
|
||||
|
||||
package android
|
||||
|
||||
import "github.com/google/blueprint/proptools"
|
||||
import (
|
||||
"github.com/google/blueprint/proptools"
|
||||
)
|
||||
|
||||
func init() {
|
||||
ctx := InitRegistrationContext
|
||||
|
35
android/product_config_to_bp.go
Normal file
35
android/product_config_to_bp.go
Normal file
@@ -0,0 +1,35 @@
|
||||
// Copyright 2024 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
|
||||
|
||||
func init() {
|
||||
ctx := InitRegistrationContext
|
||||
ctx.RegisterParallelSingletonType("product_config_to_bp_singleton", productConfigToBpSingletonFactory)
|
||||
}
|
||||
|
||||
type productConfigToBpSingleton struct{}
|
||||
|
||||
func (s *productConfigToBpSingleton) GenerateBuildActions(ctx SingletonContext) {
|
||||
// TODO: update content from make-based product config
|
||||
var content string
|
||||
generatedBp := PathForOutput(ctx, "soong_generated_product_config.bp")
|
||||
WriteFileRule(ctx, generatedBp, content)
|
||||
ctx.Phony("product_config_to_bp", generatedBp)
|
||||
}
|
||||
|
||||
// productConfigToBpSingleton generates a bp file from make-based product config
|
||||
func productConfigToBpSingletonFactory() Singleton {
|
||||
return &productConfigToBpSingleton{}
|
||||
}
|
@@ -1330,6 +1330,10 @@ func (ctx *panickingConfigAndErrorContext) HasMutatorFinished(mutatorName string
|
||||
return ctx.ctx.HasMutatorFinished(mutatorName)
|
||||
}
|
||||
|
||||
func (ctx *panickingConfigAndErrorContext) otherModuleProvider(m blueprint.Module, p blueprint.AnyProviderKey) (any, bool) {
|
||||
return ctx.ctx.otherModuleProvider(m, p)
|
||||
}
|
||||
|
||||
func PanickingConfigAndErrorContext(ctx *TestContext) ConfigurableEvaluatorContext {
|
||||
return &panickingConfigAndErrorContext{
|
||||
ctx: ctx,
|
||||
|
@@ -283,7 +283,7 @@ func RegisterVisibilityRuleGatherer(ctx RegisterMutatorsContext) {
|
||||
|
||||
// This must be registered after the deps have been resolved.
|
||||
func RegisterVisibilityRuleEnforcer(ctx RegisterMutatorsContext) {
|
||||
ctx.TopDown("visibilityRuleEnforcer", visibilityRuleEnforcer).Parallel()
|
||||
ctx.BottomUp("visibilityRuleEnforcer", visibilityRuleEnforcer).Parallel()
|
||||
}
|
||||
|
||||
// Checks the per-module visibility rule lists before defaults expansion.
|
||||
@@ -507,7 +507,7 @@ func splitRule(ctx BaseModuleContext, ruleExpression string, currentPkg, propert
|
||||
return true, pkg, name
|
||||
}
|
||||
|
||||
func visibilityRuleEnforcer(ctx TopDownMutatorContext) {
|
||||
func visibilityRuleEnforcer(ctx BottomUpMutatorContext) {
|
||||
qualified := createVisibilityModuleReference(ctx.ModuleName(), ctx.ModuleDir(), ctx.Module())
|
||||
|
||||
// Visit all the dependencies making sure that this module has access to them all.
|
||||
|
@@ -55,11 +55,10 @@ func registerApexBuildComponents(ctx android.RegistrationContext) {
|
||||
}
|
||||
|
||||
func registerPreArchMutators(ctx android.RegisterMutatorsContext) {
|
||||
ctx.TopDown("prebuilt_apex_module_creator", prebuiltApexModuleCreatorMutator).Parallel()
|
||||
ctx.BottomUp("prebuilt_apex_module_creator", prebuiltApexModuleCreatorMutator).Parallel()
|
||||
}
|
||||
|
||||
func RegisterPreDepsMutators(ctx android.RegisterMutatorsContext) {
|
||||
ctx.TopDown("apex_vndk", apexVndkMutator).Parallel()
|
||||
ctx.BottomUp("apex_vndk_deps", apexVndkDepsMutator).Parallel()
|
||||
}
|
||||
|
||||
|
@@ -265,7 +265,7 @@ func (p *prebuiltCommon) AndroidMkEntries() []android.AndroidMkEntries {
|
||||
// prebuiltApexModuleCreator defines the methods that need to be implemented by prebuilt_apex and
|
||||
// apex_set in order to create the modules needed to provide access to the prebuilt .apex file.
|
||||
type prebuiltApexModuleCreator interface {
|
||||
createPrebuiltApexModules(ctx android.TopDownMutatorContext)
|
||||
createPrebuiltApexModules(ctx android.BottomUpMutatorContext)
|
||||
}
|
||||
|
||||
// prebuiltApexModuleCreatorMutator is the mutator responsible for invoking the
|
||||
@@ -275,7 +275,7 @@ type prebuiltApexModuleCreator interface {
|
||||
// will need to access dependencies added by that (exported modules) but must run before the
|
||||
// DepsMutator so that the deapexer module it creates can add dependencies onto itself from the
|
||||
// exported modules.
|
||||
func prebuiltApexModuleCreatorMutator(ctx android.TopDownMutatorContext) {
|
||||
func prebuiltApexModuleCreatorMutator(ctx android.BottomUpMutatorContext) {
|
||||
module := ctx.Module()
|
||||
if creator, ok := module.(prebuiltApexModuleCreator); ok {
|
||||
creator.createPrebuiltApexModules(ctx)
|
||||
@@ -543,7 +543,7 @@ func PrebuiltFactory() android.Module {
|
||||
return module
|
||||
}
|
||||
|
||||
func createApexSelectorModule(ctx android.TopDownMutatorContext, name string, apexFileProperties *ApexFileProperties) {
|
||||
func createApexSelectorModule(ctx android.BottomUpMutatorContext, name string, apexFileProperties *ApexFileProperties) {
|
||||
props := struct {
|
||||
Name *string
|
||||
}{
|
||||
@@ -561,7 +561,7 @@ func createApexSelectorModule(ctx android.TopDownMutatorContext, name string, ap
|
||||
// A deapexer module is only needed when the prebuilt apex specifies one or more modules in either
|
||||
// the `exported_java_libs` or `exported_bootclasspath_fragments` properties as that indicates that
|
||||
// the listed modules need access to files from within the prebuilt .apex file.
|
||||
func (p *prebuiltCommon) createDeapexerModuleIfNeeded(ctx android.TopDownMutatorContext, deapexerName string, apexFileSource string) {
|
||||
func (p *prebuiltCommon) createDeapexerModuleIfNeeded(ctx android.BottomUpMutatorContext, deapexerName string, apexFileSource string) {
|
||||
// Only create the deapexer module if it is needed.
|
||||
if !p.hasExportedDeps() {
|
||||
return
|
||||
@@ -703,7 +703,7 @@ var _ prebuiltApexModuleCreator = (*Prebuilt)(nil)
|
||||
// / | \
|
||||
// V V V
|
||||
// selector <--- deapexer <--- exported java lib
|
||||
func (p *Prebuilt) createPrebuiltApexModules(ctx android.TopDownMutatorContext) {
|
||||
func (p *Prebuilt) createPrebuiltApexModules(ctx android.BottomUpMutatorContext) {
|
||||
apexSelectorModuleName := apexSelectorModuleName(p.Name())
|
||||
createApexSelectorModule(ctx, apexSelectorModuleName, &p.properties.ApexFileProperties)
|
||||
|
||||
@@ -958,7 +958,7 @@ func apexSetFactory() android.Module {
|
||||
return module
|
||||
}
|
||||
|
||||
func createApexExtractorModule(ctx android.TopDownMutatorContext, name string, apexExtractorProperties *ApexExtractorProperties) {
|
||||
func createApexExtractorModule(ctx android.BottomUpMutatorContext, name string, apexExtractorProperties *ApexExtractorProperties) {
|
||||
props := struct {
|
||||
Name *string
|
||||
}{
|
||||
@@ -984,7 +984,7 @@ var _ prebuiltApexModuleCreator = (*ApexSet)(nil)
|
||||
// prebuilt_apex except that instead of creating a selector module which selects one .apex file
|
||||
// from those provided this creates an extractor module which extracts the appropriate .apex file
|
||||
// from the zip file containing them.
|
||||
func (a *ApexSet) createPrebuiltApexModules(ctx android.TopDownMutatorContext) {
|
||||
func (a *ApexSet) createPrebuiltApexModules(ctx android.BottomUpMutatorContext) {
|
||||
apexExtractorModuleName := apexExtractorModuleName(a.Name())
|
||||
createApexExtractorModule(ctx, apexExtractorModuleName, &a.properties.ApexExtractorProperties)
|
||||
|
||||
|
47
apex/vndk.go
47
apex/vndk.go
@@ -54,30 +54,6 @@ type apexVndkProperties struct {
|
||||
Vndk_version *string
|
||||
}
|
||||
|
||||
func apexVndkMutator(mctx android.TopDownMutatorContext) {
|
||||
if ab, ok := mctx.Module().(*apexBundle); ok && ab.vndkApex {
|
||||
if ab.IsNativeBridgeSupported() {
|
||||
mctx.PropertyErrorf("native_bridge_supported", "%q doesn't support native bridge binary.", mctx.ModuleType())
|
||||
}
|
||||
|
||||
vndkVersion := ab.vndkVersion()
|
||||
if vndkVersion != "" {
|
||||
apiLevel, err := android.ApiLevelFromUser(mctx, vndkVersion)
|
||||
if err != nil {
|
||||
mctx.PropertyErrorf("vndk_version", "%s", err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
targets := mctx.MultiTargets()
|
||||
if len(targets) > 0 && apiLevel.LessThan(cc.MinApiForArch(mctx, targets[0].Arch.ArchType)) {
|
||||
// Disable VNDK APEXes for VNDK versions less than the minimum supported API
|
||||
// level for the primary architecture.
|
||||
ab.Disable()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func apexVndkDepsMutator(mctx android.BottomUpMutatorContext) {
|
||||
if m, ok := mctx.Module().(*cc.Module); ok && cc.IsForVndkApex(mctx, m) {
|
||||
vndkVersion := m.VndkVersion()
|
||||
@@ -93,8 +69,27 @@ func apexVndkDepsMutator(mctx android.BottomUpMutatorContext) {
|
||||
mctx.AddReverseDependency(mctx.Module(), sharedLibTag, vndkApexName)
|
||||
}
|
||||
} else if a, ok := mctx.Module().(*apexBundle); ok && a.vndkApex {
|
||||
vndkVersion := proptools.StringDefault(a.vndkProperties.Vndk_version, "current")
|
||||
mctx.AddDependency(mctx.Module(), prebuiltTag, cc.VndkLibrariesTxtModules(vndkVersion, mctx)...)
|
||||
if a.IsNativeBridgeSupported() {
|
||||
mctx.PropertyErrorf("native_bridge_supported", "%q doesn't support native bridge binary.", mctx.ModuleType())
|
||||
}
|
||||
|
||||
vndkVersion := a.vndkVersion()
|
||||
if vndkVersion != "" {
|
||||
apiLevel, err := android.ApiLevelFromUser(mctx, vndkVersion)
|
||||
if err != nil {
|
||||
mctx.PropertyErrorf("vndk_version", "%s", err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
targets := mctx.MultiTargets()
|
||||
if len(targets) > 0 && apiLevel.LessThan(cc.MinApiForArch(mctx, targets[0].Arch.ArchType)) {
|
||||
// Disable VNDK APEXes for VNDK versions less than the minimum supported API
|
||||
// level for the primary architecture.
|
||||
a.Disable()
|
||||
} else {
|
||||
mctx.AddDependency(mctx.Module(), prebuiltTag, cc.VndkLibrariesTxtModules(vndkVersion, mctx)...)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -61,6 +61,7 @@ var (
|
||||
)
|
||||
|
||||
func registerLibbpfProgBuildComponents(ctx android.RegistrationContext) {
|
||||
ctx.RegisterModuleType("libbpf_defaults", defaultsFactory)
|
||||
ctx.RegisterModuleType("libbpf_prog", LibbpfProgFactory)
|
||||
}
|
||||
|
||||
@@ -88,14 +89,17 @@ type LibbpfProgProperties struct {
|
||||
// be added to the include path using -I
|
||||
Local_include_dirs []string `android:"arch_variant"`
|
||||
|
||||
Header_libs []string `android:"arch_variant"`
|
||||
|
||||
// optional subdirectory under which this module is installed into.
|
||||
Relative_install_path string
|
||||
}
|
||||
|
||||
type libbpfProg struct {
|
||||
android.ModuleBase
|
||||
android.DefaultableModuleBase
|
||||
properties LibbpfProgProperties
|
||||
objs android.Paths
|
||||
objs android.Paths
|
||||
}
|
||||
|
||||
var _ android.ImageInterface = (*libbpfProg)(nil)
|
||||
@@ -139,6 +143,7 @@ func (libbpf *libbpfProg) SetImageVariation(ctx android.BaseModuleContext, varia
|
||||
|
||||
func (libbpf *libbpfProg) DepsMutator(ctx android.BottomUpMutatorContext) {
|
||||
ctx.AddDependency(ctx.Module(), libbpfProgDepTag, "libbpf_headers")
|
||||
ctx.AddVariationDependencies(nil, cc.HeaderDepTag(), libbpf.properties.Header_libs...)
|
||||
}
|
||||
|
||||
func (libbpf *libbpfProg) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
@@ -180,6 +185,11 @@ func (libbpf *libbpfProg) GenerateAndroidBuildActions(ctx android.ModuleContext)
|
||||
depName := ctx.OtherModuleName(dep)
|
||||
ctx.ModuleErrorf("module %q is not a genrule", depName)
|
||||
}
|
||||
} else if depTag == cc.HeaderDepTag() {
|
||||
depExporterInfo, _ := android.OtherModuleProvider(ctx, dep, cc.FlagExporterInfoProvider)
|
||||
for _, dir := range depExporterInfo.IncludeDirs {
|
||||
cflags = append(cflags, "-I "+dir.String())
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -269,10 +279,32 @@ func (libbpf *libbpfProg) AndroidMk() android.AndroidMkData {
|
||||
}
|
||||
}
|
||||
|
||||
type Defaults struct {
|
||||
android.ModuleBase
|
||||
android.DefaultsModuleBase
|
||||
}
|
||||
|
||||
func defaultsFactory() android.Module {
|
||||
return DefaultsFactory()
|
||||
}
|
||||
|
||||
func DefaultsFactory(props ...interface{}) android.Module {
|
||||
module := &Defaults{}
|
||||
|
||||
module.AddProperties(props...)
|
||||
module.AddProperties(&LibbpfProgProperties{})
|
||||
|
||||
android.InitDefaultsModule(module)
|
||||
|
||||
return module
|
||||
}
|
||||
|
||||
func LibbpfProgFactory() android.Module {
|
||||
module := &libbpfProg{}
|
||||
|
||||
module.AddProperties(&module.properties)
|
||||
android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
|
||||
android.InitDefaultableModule(module)
|
||||
|
||||
return module
|
||||
}
|
||||
|
7
cc/TEST_MAPPING
Normal file
7
cc/TEST_MAPPING
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"imports": [
|
||||
{
|
||||
"path": "bionic"
|
||||
}
|
||||
]
|
||||
}
|
8
cc/cc.go
8
cc/cc.go
@@ -59,10 +59,10 @@ func RegisterCCBuildComponents(ctx android.RegistrationContext) {
|
||||
san.registerMutators(ctx)
|
||||
}
|
||||
|
||||
ctx.TopDown("sanitize_runtime_deps", sanitizerRuntimeDepsMutator).Parallel()
|
||||
ctx.BottomUp("sanitize_runtime_deps", sanitizerRuntimeDepsMutator).Parallel()
|
||||
ctx.BottomUp("sanitize_runtime", sanitizerRuntimeMutator).Parallel()
|
||||
|
||||
ctx.TopDown("fuzz_deps", fuzzMutatorDeps)
|
||||
ctx.BottomUp("fuzz_deps", fuzzMutatorDeps)
|
||||
|
||||
ctx.Transition("coverage", &coverageTransitionMutator{})
|
||||
|
||||
@@ -73,7 +73,7 @@ func RegisterCCBuildComponents(ctx android.RegistrationContext) {
|
||||
ctx.Transition("lto", <oTransitionMutator{})
|
||||
|
||||
ctx.BottomUp("check_linktype", checkLinkTypeMutator).Parallel()
|
||||
ctx.TopDown("double_loadable", checkDoubleLoadableLibraries).Parallel()
|
||||
ctx.BottomUp("double_loadable", checkDoubleLoadableLibraries).Parallel()
|
||||
})
|
||||
|
||||
ctx.FinalDepsMutators(func(ctx android.RegisterMutatorsContext) {
|
||||
@@ -2783,7 +2783,7 @@ func checkLinkTypeMutator(ctx android.BottomUpMutatorContext) {
|
||||
// If a library has a vendor variant and is a (transitive) dependency of an LLNDK library,
|
||||
// it is subject to be double loaded. Such lib should be explicitly marked as double_loadable: true
|
||||
// or as vndk-sp (vndk: { enabled: true, support_system_process: true}).
|
||||
func checkDoubleLoadableLibraries(ctx android.TopDownMutatorContext) {
|
||||
func checkDoubleLoadableLibraries(ctx android.BottomUpMutatorContext) {
|
||||
check := func(child, parent android.Module) bool {
|
||||
to, ok := child.(*Module)
|
||||
if !ok {
|
||||
|
@@ -57,7 +57,7 @@ func (fuzzer *fuzzer) props() []interface{} {
|
||||
return []interface{}{&fuzzer.Properties}
|
||||
}
|
||||
|
||||
func fuzzMutatorDeps(mctx android.TopDownMutatorContext) {
|
||||
func fuzzMutatorDeps(mctx android.BottomUpMutatorContext) {
|
||||
currentModule, ok := mctx.Module().(*Module)
|
||||
if !ok {
|
||||
return
|
||||
|
@@ -176,7 +176,7 @@ func (t SanitizerType) registerMutators(ctx android.RegisterMutatorsContext) {
|
||||
switch t {
|
||||
case cfi, Hwasan, Asan, tsan, Fuzzer, scs, Memtag_stack:
|
||||
sanitizer := &sanitizerSplitMutator{t}
|
||||
ctx.TopDown(t.variationName()+"_markapexes", sanitizer.markSanitizableApexesMutator)
|
||||
ctx.BottomUp(t.variationName()+"_markapexes", sanitizer.markSanitizableApexesMutator)
|
||||
ctx.Transition(t.variationName(), sanitizer)
|
||||
case Memtag_heap, Memtag_globals, intOverflow:
|
||||
// do nothing
|
||||
@@ -1153,7 +1153,7 @@ type sanitizerSplitMutator struct {
|
||||
// If an APEX is sanitized or not depends on whether it contains at least one
|
||||
// sanitized module. Transition mutators cannot propagate information up the
|
||||
// dependency graph this way, so we need an auxiliary mutator to do so.
|
||||
func (s *sanitizerSplitMutator) markSanitizableApexesMutator(ctx android.TopDownMutatorContext) {
|
||||
func (s *sanitizerSplitMutator) markSanitizableApexesMutator(ctx android.BottomUpMutatorContext) {
|
||||
if sanitizeable, ok := ctx.Module().(Sanitizeable); ok {
|
||||
enabled := sanitizeable.IsSanitizerEnabled(ctx.Config(), s.sanitizer.name())
|
||||
ctx.VisitDirectDeps(func(dep android.Module) {
|
||||
@@ -1355,7 +1355,7 @@ func (c *Module) IsSanitizerExplicitlyDisabled(t SanitizerType) bool {
|
||||
}
|
||||
|
||||
// Propagate the ubsan minimal runtime dependency when there are integer overflow sanitized static dependencies.
|
||||
func sanitizerRuntimeDepsMutator(mctx android.TopDownMutatorContext) {
|
||||
func sanitizerRuntimeDepsMutator(mctx android.BottomUpMutatorContext) {
|
||||
// Change this to PlatformSanitizable when/if non-cc modules support ubsan sanitizers.
|
||||
if c, ok := mctx.Module().(*Module); ok && c.sanitize != nil {
|
||||
if c.sanitize.Properties.ForceDisable {
|
||||
@@ -1437,11 +1437,11 @@ func sanitizerRuntimeMutator(mctx android.BottomUpMutatorContext) {
|
||||
//"null",
|
||||
//"shift-base",
|
||||
//"signed-integer-overflow",
|
||||
// TODO(danalbert): Fix UB in libc++'s __tree so we can turn this on.
|
||||
// https://llvm.org/PR19302
|
||||
// http://reviews.llvm.org/D6974
|
||||
// "object-size",
|
||||
)
|
||||
|
||||
if mctx.Config().ReleaseBuildObjectSizeSanitizer() {
|
||||
sanitizers = append(sanitizers, "object-size")
|
||||
}
|
||||
}
|
||||
sanitizers = append(sanitizers, sanProps.Misc_undefined...)
|
||||
}
|
||||
|
@@ -147,14 +147,14 @@ type filesystemProperties struct {
|
||||
func filesystemFactory() android.Module {
|
||||
module := &filesystem{}
|
||||
module.filterPackagingSpec = module.filterInstallablePackagingSpec
|
||||
initFilesystemModule(module)
|
||||
initFilesystemModule(module, module)
|
||||
return module
|
||||
}
|
||||
|
||||
func initFilesystemModule(module *filesystem) {
|
||||
module.AddProperties(&module.properties)
|
||||
android.InitPackageModule(module)
|
||||
module.PackagingBase.DepsCollectFirstTargetOnly = true
|
||||
func initFilesystemModule(module android.DefaultableModule, filesystemModule *filesystem) {
|
||||
module.AddProperties(&filesystemModule.properties)
|
||||
android.InitPackageModule(filesystemModule)
|
||||
filesystemModule.PackagingBase.DepsCollectFirstTargetOnly = true
|
||||
android.InitAndroidMultiTargetsArchModule(module, android.DeviceSupported, android.MultilibCommon)
|
||||
android.InitDefaultableModule(module)
|
||||
}
|
||||
|
@@ -38,7 +38,7 @@ func systemImageFactory() android.Module {
|
||||
module.AddProperties(&module.properties)
|
||||
module.filesystem.buildExtraFiles = module.buildExtraFiles
|
||||
module.filesystem.filterPackagingSpec = module.filterPackagingSpec
|
||||
initFilesystemModule(&module.filesystem)
|
||||
initFilesystemModule(module, &module.filesystem)
|
||||
return module
|
||||
}
|
||||
|
||||
|
@@ -120,7 +120,7 @@ func (d *DexProperties) resourceShrinkingEnabled(ctx android.ModuleContext) bool
|
||||
}
|
||||
|
||||
func (d *DexProperties) optimizedResourceShrinkingEnabled(ctx android.ModuleContext) bool {
|
||||
return d.resourceShrinkingEnabled(ctx) && Bool(d.Optimize.Optimized_shrink_resources)
|
||||
return d.resourceShrinkingEnabled(ctx) && BoolDefault(d.Optimize.Optimized_shrink_resources, ctx.Config().UseOptimizedResourceShrinkingByDefault())
|
||||
}
|
||||
|
||||
func (d *dexer) optimizeOrObfuscateEnabled() bool {
|
||||
@@ -400,7 +400,7 @@ func (d *dexer) r8Flags(ctx android.ModuleContext, dexParams *compileDexParams)
|
||||
r8Flags = append(r8Flags, "--resource-input", d.resourcesInput.Path().String())
|
||||
r8Deps = append(r8Deps, d.resourcesInput.Path())
|
||||
r8Flags = append(r8Flags, "--resource-output", d.resourcesOutput.Path().String())
|
||||
if Bool(opt.Optimized_shrink_resources) {
|
||||
if d.dexProperties.optimizedResourceShrinkingEnabled(ctx) {
|
||||
r8Flags = append(r8Flags, "--optimized-resource-shrinking")
|
||||
}
|
||||
}
|
||||
|
@@ -3345,6 +3345,10 @@ func addCLCFromDep(ctx android.ModuleContext, depModule android.Module,
|
||||
if lib, ok := depModule.(SdkLibraryDependency); ok && lib.sharedLibrary() {
|
||||
// A shared SDK library. This should be added as a top-level CLC element.
|
||||
sdkLib = &depName
|
||||
} else if lib, ok := depModule.(SdkLibraryComponentDependency); ok && lib.OptionalSdkLibraryImplementation() != nil {
|
||||
if depModule.Name() == proptools.String(lib.OptionalSdkLibraryImplementation())+".impl" {
|
||||
sdkLib = lib.OptionalSdkLibraryImplementation()
|
||||
}
|
||||
} else if ulib, ok := depModule.(ProvidesUsesLib); ok {
|
||||
// A non-SDK library disguised as an SDK library by the means of `provides_uses_lib`
|
||||
// property. This should be handled in the same way as a shared SDK library.
|
||||
|
@@ -34,6 +34,7 @@ var ravenwoodLibContentTag = dependencyTag{name: "ravenwoodlibcontent"}
|
||||
var ravenwoodUtilsTag = dependencyTag{name: "ravenwoodutils"}
|
||||
var ravenwoodRuntimeTag = dependencyTag{name: "ravenwoodruntime"}
|
||||
var ravenwoodTestResourceApkTag = dependencyTag{name: "ravenwoodtestresapk"}
|
||||
var ravenwoodTestInstResourceApkTag = dependencyTag{name: "ravenwoodtest-inst-res-apk"}
|
||||
|
||||
const ravenwoodUtilsName = "ravenwood-utils"
|
||||
const ravenwoodRuntimeName = "ravenwood-runtime"
|
||||
@@ -56,11 +57,17 @@ type ravenwoodTestProperties struct {
|
||||
Jni_libs []string
|
||||
|
||||
// Specify another android_app module here to copy it to the test directory, so that
|
||||
// the ravenwood test can access it.
|
||||
// the ravenwood test can access it. This APK will be loaded as resources of the test
|
||||
// target app.
|
||||
// TODO: For now, we simply refer to another android_app module and copy it to the
|
||||
// test directory. Eventually, android_ravenwood_test should support all the resource
|
||||
// related properties and build resources from the `res/` directory.
|
||||
Resource_apk *string
|
||||
|
||||
// Specify another android_app module here to copy it to the test directory, so that
|
||||
// the ravenwood test can access it. This APK will be loaded as resources of the test
|
||||
// instrumentation app itself.
|
||||
Inst_resource_apk *string
|
||||
}
|
||||
|
||||
type ravenwoodTest struct {
|
||||
@@ -127,6 +134,10 @@ func (r *ravenwoodTest) DepsMutator(ctx android.BottomUpMutatorContext) {
|
||||
if resourceApk := proptools.String(r.ravenwoodTestProperties.Resource_apk); resourceApk != "" {
|
||||
ctx.AddVariationDependencies(nil, ravenwoodTestResourceApkTag, resourceApk)
|
||||
}
|
||||
|
||||
if resourceApk := proptools.String(r.ravenwoodTestProperties.Inst_resource_apk); resourceApk != "" {
|
||||
ctx.AddVariationDependencies(nil, ravenwoodTestInstResourceApkTag, resourceApk)
|
||||
}
|
||||
}
|
||||
|
||||
func (r *ravenwoodTest) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
@@ -194,13 +205,16 @@ func (r *ravenwoodTest) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
}
|
||||
|
||||
resApkInstallPath := installPath.Join(ctx, "ravenwood-res-apks")
|
||||
if resApk := ctx.GetDirectDepsWithTag(ravenwoodTestResourceApkTag); len(resApk) > 0 {
|
||||
for _, installFile := range android.OtherModuleProviderOrDefault(
|
||||
ctx, resApk[0], android.InstallFilesProvider).InstallFiles {
|
||||
installResApk := ctx.InstallFile(resApkInstallPath, "ravenwood-res.apk", installFile)
|
||||
|
||||
copyResApk := func(tag blueprint.DependencyTag, toFileName string) {
|
||||
if resApk := ctx.GetDirectDepsWithTag(tag); len(resApk) > 0 {
|
||||
installFile := android.OutputFileForModule(ctx, resApk[0], "")
|
||||
installResApk := ctx.InstallFile(resApkInstallPath, toFileName, installFile)
|
||||
installDeps = append(installDeps, installResApk)
|
||||
}
|
||||
}
|
||||
copyResApk(ravenwoodTestResourceApkTag, "ravenwood-res.apk")
|
||||
copyResApk(ravenwoodTestInstResourceApkTag, "ravenwood-inst-res.apk")
|
||||
|
||||
// Install our JAR with all dependencies
|
||||
ctx.InstallFile(installPath, ctx.ModuleName()+".jar", r.outputFile, installDeps...)
|
||||
|
@@ -66,6 +66,10 @@ var prepareRavenwoodRuntime = android.GroupFixturePreparers(
|
||||
name: "app2",
|
||||
sdk_version: "current",
|
||||
}
|
||||
android_app {
|
||||
name: "app3",
|
||||
sdk_version: "current",
|
||||
}
|
||||
prebuilt_font {
|
||||
name: "Font.ttf",
|
||||
src: "Font.ttf",
|
||||
@@ -167,6 +171,7 @@ func TestRavenwoodTest(t *testing.T) {
|
||||
"ravenwood-runtime-jni2",
|
||||
],
|
||||
resource_apk: "app2",
|
||||
inst_resource_apk: "app3",
|
||||
sdk_version: "test_current",
|
||||
}
|
||||
`)
|
||||
@@ -194,6 +199,7 @@ func TestRavenwoodTest(t *testing.T) {
|
||||
module.Output(installPathPrefix + "/ravenwood-test/lib64/libblue.so")
|
||||
module.Output(installPathPrefix + "/ravenwood-test/lib64/libpink.so")
|
||||
module.Output(installPathPrefix + "/ravenwood-test/ravenwood-res-apks/ravenwood-res.apk")
|
||||
module.Output(installPathPrefix + "/ravenwood-test/ravenwood-res-apks/ravenwood-inst-res.apk")
|
||||
|
||||
// ravenwood-runtime*.so are included in the runtime, so it shouldn't be emitted.
|
||||
for _, o := range module.AllOutputs() {
|
||||
|
Reference in New Issue
Block a user