Merge "Add compat symlinks for prebuilt_apex"
diff --git a/android/hooks.go b/android/hooks.go
index 0e0f5a4..04ba69e 100644
--- a/android/hooks.go
+++ b/android/hooks.go
@@ -15,7 +15,10 @@
package android
import (
+ "reflect"
+
"github.com/google/blueprint"
+ "github.com/google/blueprint/proptools"
)
// This file implements hooks that external module types can use to inject logic into existing
@@ -26,29 +29,78 @@
// before the module has been split into architecture variants, and before defaults modules have
// been applied.
type LoadHookContext interface {
- // TODO: a new context that includes Config() but not Target(), etc.?
- BaseModuleContext
+ EarlyModuleContext
+
AppendProperties(...interface{})
PrependProperties(...interface{})
CreateModule(ModuleFactory, ...interface{}) Module
}
func AddLoadHook(m blueprint.Module, hook func(LoadHookContext)) {
- h := &m.(Module).base().hooks
- h.load = append(h.load, hook)
+ blueprint.AddLoadHook(m, func(ctx blueprint.LoadHookContext) {
+ actx := &loadHookContext{
+ earlyModuleContext: m.(Module).base().earlyModuleContextFactory(ctx),
+ bp: ctx,
+ }
+ hook(actx)
+ })
}
-func (x *hooks) runLoadHooks(ctx LoadHookContext, m *ModuleBase) {
- if len(x.load) > 0 {
- for _, x := range x.load {
- x(ctx)
- if ctx.Failed() {
- return
+type loadHookContext struct {
+ earlyModuleContext
+ bp blueprint.LoadHookContext
+ module Module
+}
+
+func (l *loadHookContext) AppendProperties(props ...interface{}) {
+ for _, p := range props {
+ err := proptools.AppendMatchingProperties(l.Module().base().customizableProperties,
+ p, nil)
+ if err != nil {
+ if propertyErr, ok := err.(*proptools.ExtendPropertyError); ok {
+ l.PropertyErrorf(propertyErr.Property, "%s", propertyErr.Err.Error())
+ } else {
+ panic(err)
}
}
}
}
+func (l *loadHookContext) PrependProperties(props ...interface{}) {
+ for _, p := range props {
+ err := proptools.PrependMatchingProperties(l.Module().base().customizableProperties,
+ p, nil)
+ if err != nil {
+ if propertyErr, ok := err.(*proptools.ExtendPropertyError); ok {
+ l.PropertyErrorf(propertyErr.Property, "%s", propertyErr.Err.Error())
+ } else {
+ panic(err)
+ }
+ }
+ }
+}
+
+func (l *loadHookContext) CreateModule(factory ModuleFactory, props ...interface{}) Module {
+ inherited := []interface{}{&l.Module().base().commonProperties}
+ module := l.bp.CreateModule(ModuleFactoryAdaptor(factory), append(inherited, props...)...).(Module)
+
+ if l.Module().base().variableProperties != nil && module.base().variableProperties != nil {
+ src := l.Module().base().variableProperties
+ dst := []interface{}{
+ module.base().variableProperties,
+ // Put an empty copy of the src properties into dst so that properties in src that are not in dst
+ // don't cause a "failed to find property to extend" error.
+ proptools.CloneEmptyProperties(reflect.ValueOf(src).Elem()).Interface(),
+ }
+ err := proptools.AppendMatchingProperties(dst, src, nil)
+ if err != nil {
+ panic(err)
+ }
+ }
+
+ return module
+}
+
type InstallHookContext interface {
ModuleContext
Path() InstallPath
@@ -94,21 +146,5 @@
}
type hooks struct {
- load []func(LoadHookContext)
install []func(InstallHookContext)
}
-
-func registerLoadHookMutator(ctx RegisterMutatorsContext) {
- ctx.TopDown("load_hooks", LoadHookMutator).Parallel()
-}
-
-func LoadHookMutator(ctx TopDownMutatorContext) {
- if m, ok := ctx.Module().(Module); ok {
- m.base().commonProperties.DebugName = ctx.ModuleName()
-
- // Cast through *topDownMutatorContext because AppendProperties is implemented
- // on *topDownMutatorContext but not exposed through TopDownMutatorContext
- var loadHookCtx LoadHookContext = ctx.(*topDownMutatorContext)
- m.base().hooks.runLoadHooks(loadHookCtx, m.base())
- }
-}
diff --git a/android/module.go b/android/module.go
index a14e575..c998007 100644
--- a/android/module.go
+++ b/android/module.go
@@ -55,16 +55,51 @@
type ModuleBuildParams BuildParams
+// EarlyModuleContext provides methods that can be called early, as soon as the properties have
+// been parsed into the module and before any mutators have run.
+type EarlyModuleContext interface {
+ Module() Module
+ ModuleName() string
+ ModuleDir() string
+ ModuleType() string
+
+ ContainsProperty(name string) bool
+ Errorf(pos scanner.Position, fmt string, args ...interface{})
+ ModuleErrorf(fmt string, args ...interface{})
+ PropertyErrorf(property, fmt string, args ...interface{})
+ Failed() bool
+
+ AddNinjaFileDeps(deps ...string)
+
+ DeviceSpecific() bool
+ SocSpecific() bool
+ ProductSpecific() bool
+ SystemExtSpecific() bool
+ Platform() bool
+
+ Config() Config
+ DeviceConfig() DeviceConfig
+
+ // Deprecated: use Config()
+ AConfig() Config
+
+ // GlobWithDeps returns a list of files that match the specified pattern but do not match any
+ // of the patterns in excludes. It also adds efficient dependencies to rerun the primary
+ // builder whenever a file matching the pattern as added or removed, without rerunning if a
+ // file that does not match the pattern is added to a searched directory.
+ GlobWithDeps(pattern string, excludes []string) ([]string, error)
+
+ Glob(globPattern string, excludes []string) Paths
+ GlobFiles(globPattern string, excludes []string) Paths
+ Fs() pathtools.FileSystem
+}
+
// BaseModuleContext is the same as blueprint.BaseModuleContext except that Config() returns
// a Config instead of an interface{}, and some methods have been wrapped to use an android.Module
// instead of a blueprint.Module, plus some extra methods that return Android-specific information
// about the current module.
type BaseModuleContext interface {
- Module() Module
- ModuleName() string
- ModuleDir() string
- ModuleType() string
- Config() Config
+ EarlyModuleContext
OtherModuleName(m blueprint.Module) string
OtherModuleDir(m blueprint.Module) string
@@ -91,24 +126,6 @@
// and returns a top-down dependency path from a start module to current child module.
GetWalkPath() []Module
- ContainsProperty(name string) bool
- Errorf(pos scanner.Position, fmt string, args ...interface{})
- ModuleErrorf(fmt string, args ...interface{})
- PropertyErrorf(property, fmt string, args ...interface{})
- Failed() bool
-
- // GlobWithDeps returns a list of files that match the specified pattern but do not match any
- // of the patterns in excludes. It also adds efficient dependencies to rerun the primary
- // builder whenever a file matching the pattern as added or removed, without rerunning if a
- // file that does not match the pattern is added to a searched directory.
- GlobWithDeps(pattern string, excludes []string) ([]string, error)
-
- Glob(globPattern string, excludes []string) Paths
- GlobFiles(globPattern string, excludes []string) Paths
-
- Fs() pathtools.FileSystem
- AddNinjaFileDeps(deps ...string)
-
AddMissingDependencies(missingDeps []string)
Target() Target
@@ -123,18 +140,11 @@
Windows() bool
Debug() bool
PrimaryArch() bool
- Platform() bool
- DeviceSpecific() bool
- SocSpecific() bool
- ProductSpecific() bool
- SystemExtSpecific() bool
- AConfig() Config
- DeviceConfig() DeviceConfig
}
-// Deprecated: use BaseModuleContext instead
+// Deprecated: use EarlyModuleContext instead
type BaseContext interface {
- BaseModuleContext
+ EarlyModuleContext
}
type ModuleContext interface {
@@ -221,6 +231,10 @@
// Get the visibility rules that control the visibility of this module.
visibility() []string
+
+ RequiredModuleNames() []string
+ HostRequiredModuleNames() []string
+ TargetRequiredModuleNames() []string
}
// Qualified id for a module
@@ -887,6 +901,18 @@
return m.base().commonProperties.ImageVariation == RecoveryVariation
}
+func (m *ModuleBase) RequiredModuleNames() []string {
+ return m.base().commonProperties.Required
+}
+
+func (m *ModuleBase) HostRequiredModuleNames() []string {
+ return m.base().commonProperties.Host_required
+}
+
+func (m *ModuleBase) TargetRequiredModuleNames() []string {
+ return m.base().commonProperties.Target_required
+}
+
func (m *ModuleBase) generateModuleTarget(ctx ModuleContext) {
allInstalledFiles := Paths{}
allCheckbuildFiles := Paths{}
@@ -943,7 +969,7 @@
}
}
-func determineModuleKind(m *ModuleBase, ctx blueprint.BaseModuleContext) moduleKind {
+func determineModuleKind(m *ModuleBase, ctx blueprint.EarlyModuleContext) moduleKind {
var socSpecific = Bool(m.commonProperties.Vendor) || Bool(m.commonProperties.Proprietary) || Bool(m.commonProperties.Soc_specific)
var deviceSpecific = Bool(m.commonProperties.Device_specific)
var productSpecific = Bool(m.commonProperties.Product_specific)
@@ -1002,15 +1028,22 @@
}
}
+func (m *ModuleBase) earlyModuleContextFactory(ctx blueprint.EarlyModuleContext) earlyModuleContext {
+ return earlyModuleContext{
+ EarlyModuleContext: ctx,
+ kind: determineModuleKind(m, ctx),
+ config: ctx.Config().(Config),
+ }
+}
+
func (m *ModuleBase) baseModuleContextFactory(ctx blueprint.BaseModuleContext) baseModuleContext {
return baseModuleContext{
- BaseModuleContext: ctx,
- os: m.commonProperties.CompileOS,
- target: m.commonProperties.CompileTarget,
- targetPrimary: m.commonProperties.CompilePrimary,
- multiTargets: m.commonProperties.CompileMultiTargets,
- kind: determineModuleKind(m, ctx),
- config: ctx.Config().(Config),
+ bp: ctx,
+ earlyModuleContext: m.earlyModuleContextFactory(ctx),
+ os: m.commonProperties.CompileOS,
+ target: m.commonProperties.CompileTarget,
+ targetPrimary: m.commonProperties.CompilePrimary,
+ multiTargets: m.commonProperties.CompileMultiTargets,
}
}
@@ -1116,21 +1149,95 @@
m.variables = ctx.variables
}
+type earlyModuleContext struct {
+ blueprint.EarlyModuleContext
+
+ kind moduleKind
+ config Config
+}
+
+func (e *earlyModuleContext) Glob(globPattern string, excludes []string) Paths {
+ ret, err := e.GlobWithDeps(globPattern, excludes)
+ if err != nil {
+ e.ModuleErrorf("glob: %s", err.Error())
+ }
+ return pathsForModuleSrcFromFullPath(e, ret, true)
+}
+
+func (e *earlyModuleContext) GlobFiles(globPattern string, excludes []string) Paths {
+ ret, err := e.GlobWithDeps(globPattern, excludes)
+ if err != nil {
+ e.ModuleErrorf("glob: %s", err.Error())
+ }
+ return pathsForModuleSrcFromFullPath(e, ret, false)
+}
+
+func (e *earlyModuleContext) Module() Module {
+ module, _ := e.EarlyModuleContext.Module().(Module)
+ return module
+}
+
+func (e *earlyModuleContext) Config() Config {
+ return e.EarlyModuleContext.Config().(Config)
+}
+
+func (e *earlyModuleContext) AConfig() Config {
+ return e.config
+}
+
+func (e *earlyModuleContext) DeviceConfig() DeviceConfig {
+ return DeviceConfig{e.config.deviceConfig}
+}
+
+func (e *earlyModuleContext) Platform() bool {
+ return e.kind == platformModule
+}
+
+func (e *earlyModuleContext) DeviceSpecific() bool {
+ return e.kind == deviceSpecificModule
+}
+
+func (e *earlyModuleContext) SocSpecific() bool {
+ return e.kind == socSpecificModule
+}
+
+func (e *earlyModuleContext) ProductSpecific() bool {
+ return e.kind == productSpecificModule
+}
+
+func (e *earlyModuleContext) SystemExtSpecific() bool {
+ return e.kind == systemExtSpecificModule
+}
+
type baseModuleContext struct {
- blueprint.BaseModuleContext
+ bp blueprint.BaseModuleContext
+ earlyModuleContext
os OsType
target Target
multiTargets []Target
targetPrimary bool
debug bool
- kind moduleKind
- config Config
walkPath []Module
strictVisitDeps bool // If true, enforce that all dependencies are enabled
}
+func (b *baseModuleContext) OtherModuleName(m blueprint.Module) string { return b.bp.OtherModuleName(m) }
+func (b *baseModuleContext) OtherModuleDir(m blueprint.Module) string { return b.bp.OtherModuleDir(m) }
+func (b *baseModuleContext) OtherModuleErrorf(m blueprint.Module, fmt string, args ...interface{}) {
+ b.bp.OtherModuleErrorf(m, fmt, args)
+}
+func (b *baseModuleContext) OtherModuleDependencyTag(m blueprint.Module) blueprint.DependencyTag {
+ return b.bp.OtherModuleDependencyTag(m)
+}
+func (b *baseModuleContext) OtherModuleExists(name string) bool { return b.bp.OtherModuleExists(name) }
+func (b *baseModuleContext) OtherModuleType(m blueprint.Module) string { return b.bp.OtherModuleType(m) }
+
+func (b *baseModuleContext) GetDirectDepWithTag(name string, tag blueprint.DependencyTag) blueprint.Module {
+ return b.bp.GetDirectDepWithTag(name, tag)
+}
+
type moduleContext struct {
bp blueprint.ModuleContext
baseModuleContext
@@ -1245,16 +1352,6 @@
m.bp.Build(pctx.PackageContext, convertBuildParams(params))
}
-
-func (b *baseModuleContext) Module() Module {
- module, _ := b.BaseModuleContext.Module().(Module)
- return module
-}
-
-func (b *baseModuleContext) Config() Config {
- return b.BaseModuleContext.Config().(Config)
-}
-
func (m *moduleContext) GetMissingDependencies() []string {
var missingDeps []string
missingDeps = append(missingDeps, m.Module().base().commonProperties.MissingDeps...)
@@ -1302,7 +1399,7 @@
var deps []dep
b.VisitDirectDepsBlueprint(func(module blueprint.Module) {
if aModule, _ := module.(Module); aModule != nil && aModule.base().BaseModuleName() == name {
- returnedTag := b.BaseModuleContext.OtherModuleDependencyTag(aModule)
+ returnedTag := b.bp.OtherModuleDependencyTag(aModule)
if tag == nil || returnedTag == tag {
deps = append(deps, dep{aModule, returnedTag})
}
@@ -1322,7 +1419,7 @@
var deps []Module
b.VisitDirectDepsBlueprint(func(module blueprint.Module) {
if aModule, _ := module.(Module); aModule != nil {
- if b.BaseModuleContext.OtherModuleDependencyTag(aModule) == tag {
+ if b.bp.OtherModuleDependencyTag(aModule) == tag {
deps = append(deps, aModule)
}
}
@@ -1340,11 +1437,11 @@
}
func (b *baseModuleContext) VisitDirectDepsBlueprint(visit func(blueprint.Module)) {
- b.BaseModuleContext.VisitDirectDeps(visit)
+ b.bp.VisitDirectDeps(visit)
}
func (b *baseModuleContext) VisitDirectDeps(visit func(Module)) {
- b.BaseModuleContext.VisitDirectDeps(func(module blueprint.Module) {
+ b.bp.VisitDirectDeps(func(module blueprint.Module) {
if aModule := b.validateAndroidModule(module, b.strictVisitDeps); aModule != nil {
visit(aModule)
}
@@ -1352,9 +1449,9 @@
}
func (b *baseModuleContext) VisitDirectDepsWithTag(tag blueprint.DependencyTag, visit func(Module)) {
- b.BaseModuleContext.VisitDirectDeps(func(module blueprint.Module) {
+ b.bp.VisitDirectDeps(func(module blueprint.Module) {
if aModule := b.validateAndroidModule(module, b.strictVisitDeps); aModule != nil {
- if b.BaseModuleContext.OtherModuleDependencyTag(aModule) == tag {
+ if b.bp.OtherModuleDependencyTag(aModule) == tag {
visit(aModule)
}
}
@@ -1362,7 +1459,7 @@
}
func (b *baseModuleContext) VisitDirectDepsIf(pred func(Module) bool, visit func(Module)) {
- b.BaseModuleContext.VisitDirectDepsIf(
+ b.bp.VisitDirectDepsIf(
// pred
func(module blueprint.Module) bool {
if aModule := b.validateAndroidModule(module, b.strictVisitDeps); aModule != nil {
@@ -1378,7 +1475,7 @@
}
func (b *baseModuleContext) VisitDepsDepthFirst(visit func(Module)) {
- b.BaseModuleContext.VisitDepsDepthFirst(func(module blueprint.Module) {
+ b.bp.VisitDepsDepthFirst(func(module blueprint.Module) {
if aModule := b.validateAndroidModule(module, b.strictVisitDeps); aModule != nil {
visit(aModule)
}
@@ -1386,7 +1483,7 @@
}
func (b *baseModuleContext) VisitDepsDepthFirstIf(pred func(Module) bool, visit func(Module)) {
- b.BaseModuleContext.VisitDepsDepthFirstIf(
+ b.bp.VisitDepsDepthFirstIf(
// pred
func(module blueprint.Module) bool {
if aModule := b.validateAndroidModule(module, b.strictVisitDeps); aModule != nil {
@@ -1402,12 +1499,12 @@
}
func (b *baseModuleContext) WalkDepsBlueprint(visit func(blueprint.Module, blueprint.Module) bool) {
- b.BaseModuleContext.WalkDeps(visit)
+ b.bp.WalkDeps(visit)
}
func (b *baseModuleContext) WalkDeps(visit func(Module, Module) bool) {
b.walkPath = []Module{b.Module()}
- b.BaseModuleContext.WalkDeps(func(child, parent blueprint.Module) bool {
+ b.bp.WalkDeps(func(child, parent blueprint.Module) bool {
childAndroidModule, _ := child.(Module)
parentAndroidModule, _ := parent.(Module)
if childAndroidModule != nil && parentAndroidModule != nil {
@@ -1496,34 +1593,6 @@
return b.target.Arch.ArchType == b.config.Targets[b.target.Os][0].Arch.ArchType
}
-func (b *baseModuleContext) AConfig() Config {
- return b.config
-}
-
-func (b *baseModuleContext) DeviceConfig() DeviceConfig {
- return DeviceConfig{b.config.deviceConfig}
-}
-
-func (b *baseModuleContext) Platform() bool {
- return b.kind == platformModule
-}
-
-func (b *baseModuleContext) DeviceSpecific() bool {
- return b.kind == deviceSpecificModule
-}
-
-func (b *baseModuleContext) SocSpecific() bool {
- return b.kind == socSpecificModule
-}
-
-func (b *baseModuleContext) ProductSpecific() bool {
- return b.kind == productSpecificModule
-}
-
-func (b *baseModuleContext) SystemExtSpecific() bool {
- return b.kind == systemExtSpecificModule
-}
-
// Makes this module a platform module, i.e. not specific to soc, device,
// product, or system_ext.
func (m *ModuleBase) MakeAsPlatform() {
@@ -1877,31 +1946,15 @@
}
func (m *moduleContext) RequiredModuleNames() []string {
- return m.module.base().commonProperties.Required
+ return m.module.RequiredModuleNames()
}
func (m *moduleContext) HostRequiredModuleNames() []string {
- return m.module.base().commonProperties.Host_required
+ return m.module.HostRequiredModuleNames()
}
func (m *moduleContext) TargetRequiredModuleNames() []string {
- return m.module.base().commonProperties.Target_required
-}
-
-func (b *baseModuleContext) Glob(globPattern string, excludes []string) Paths {
- ret, err := b.GlobWithDeps(globPattern, excludes)
- if err != nil {
- b.ModuleErrorf("glob: %s", err.Error())
- }
- return pathsForModuleSrcFromFullPath(b, ret, true)
-}
-
-func (b *baseModuleContext) GlobFiles(globPattern string, excludes []string) Paths {
- ret, err := b.GlobWithDeps(globPattern, excludes)
- if err != nil {
- b.ModuleErrorf("glob: %s", err.Error())
- }
- return pathsForModuleSrcFromFullPath(b, ret, false)
+ return m.module.TargetRequiredModuleNames()
}
func init() {
diff --git a/android/mutator.go b/android/mutator.go
index 709d9c0..f2f9663 100644
--- a/android/mutator.go
+++ b/android/mutator.go
@@ -75,7 +75,6 @@
type RegisterMutatorFunc func(RegisterMutatorsContext)
var preArch = []RegisterMutatorFunc{
- registerLoadHookMutator,
RegisterNamespaceMutator,
// Rename package module types.
RegisterPackageRenamer,
diff --git a/android/namespace.go b/android/namespace.go
index 27ec163..64ad7e9 100644
--- a/android/namespace.go
+++ b/android/namespace.go
@@ -185,6 +185,7 @@
if ok {
// inform the module whether its namespace is one that we want to export to Make
amod.base().commonProperties.NamespaceExportedToMake = ns.exportToKati
+ amod.base().commonProperties.DebugName = module.Name()
}
return ns, nil
diff --git a/android/paths.go b/android/paths.go
index c841372..a03fe17 100644
--- a/android/paths.go
+++ b/android/paths.go
@@ -409,7 +409,7 @@
// each string. If incDirs is false, strip paths with a trailing '/' from the list.
// It intended for use in globs that only list files that exist, so it allows '$' in
// filenames.
-func pathsForModuleSrcFromFullPath(ctx BaseModuleContext, paths []string, incDirs bool) Paths {
+func pathsForModuleSrcFromFullPath(ctx EarlyModuleContext, paths []string, incDirs bool) Paths {
prefix := filepath.Join(ctx.Config().srcDir, ctx.ModuleDir()) + "/"
if prefix == "./" {
prefix = ""
diff --git a/android/paths_test.go b/android/paths_test.go
index 5ff5f99..ec5e598 100644
--- a/android/paths_test.go
+++ b/android/paths_test.go
@@ -286,7 +286,9 @@
baseModuleContext: baseModuleContext{
os: deviceTarget.Os,
target: deviceTarget,
- kind: socSpecificModule,
+ earlyModuleContext: earlyModuleContext{
+ kind: socSpecificModule,
+ },
},
},
in: []string{"bin", "my_test"},
@@ -298,7 +300,9 @@
baseModuleContext: baseModuleContext{
os: deviceTarget.Os,
target: deviceTarget,
- kind: deviceSpecificModule,
+ earlyModuleContext: earlyModuleContext{
+ kind: deviceSpecificModule,
+ },
},
},
in: []string{"bin", "my_test"},
@@ -310,7 +314,9 @@
baseModuleContext: baseModuleContext{
os: deviceTarget.Os,
target: deviceTarget,
- kind: productSpecificModule,
+ earlyModuleContext: earlyModuleContext{
+ kind: productSpecificModule,
+ },
},
},
in: []string{"bin", "my_test"},
@@ -322,7 +328,9 @@
baseModuleContext: baseModuleContext{
os: deviceTarget.Os,
target: deviceTarget,
- kind: systemExtSpecificModule,
+ earlyModuleContext: earlyModuleContext{
+ kind: systemExtSpecificModule,
+ },
},
},
in: []string{"bin", "my_test"},
@@ -384,7 +392,9 @@
baseModuleContext: baseModuleContext{
os: deviceTarget.Os,
target: deviceTarget,
- kind: socSpecificModule,
+ earlyModuleContext: earlyModuleContext{
+ kind: socSpecificModule,
+ },
},
inData: true,
},
@@ -397,7 +407,9 @@
baseModuleContext: baseModuleContext{
os: deviceTarget.Os,
target: deviceTarget,
- kind: deviceSpecificModule,
+ earlyModuleContext: earlyModuleContext{
+ kind: deviceSpecificModule,
+ },
},
inData: true,
},
@@ -410,7 +422,9 @@
baseModuleContext: baseModuleContext{
os: deviceTarget.Os,
target: deviceTarget,
- kind: productSpecificModule,
+ earlyModuleContext: earlyModuleContext{
+ kind: productSpecificModule,
+ },
},
inData: true,
},
@@ -424,7 +438,9 @@
baseModuleContext: baseModuleContext{
os: deviceTarget.Os,
target: deviceTarget,
- kind: systemExtSpecificModule,
+ earlyModuleContext: earlyModuleContext{
+ kind: systemExtSpecificModule,
+ },
},
inData: true,
},
@@ -450,7 +466,9 @@
baseModuleContext: baseModuleContext{
os: deviceTarget.Os,
target: deviceTarget,
- kind: socSpecificModule,
+ earlyModuleContext: earlyModuleContext{
+ kind: socSpecificModule,
+ },
},
inSanitizerDir: true,
},
@@ -463,7 +481,9 @@
baseModuleContext: baseModuleContext{
os: deviceTarget.Os,
target: deviceTarget,
- kind: deviceSpecificModule,
+ earlyModuleContext: earlyModuleContext{
+ kind: deviceSpecificModule,
+ },
},
inSanitizerDir: true,
},
@@ -476,7 +496,9 @@
baseModuleContext: baseModuleContext{
os: deviceTarget.Os,
target: deviceTarget,
- kind: productSpecificModule,
+ earlyModuleContext: earlyModuleContext{
+ kind: productSpecificModule,
+ },
},
inSanitizerDir: true,
},
@@ -490,7 +512,9 @@
baseModuleContext: baseModuleContext{
os: deviceTarget.Os,
target: deviceTarget,
- kind: systemExtSpecificModule,
+ earlyModuleContext: earlyModuleContext{
+ kind: systemExtSpecificModule,
+ },
},
inSanitizerDir: true,
},
@@ -517,7 +541,9 @@
baseModuleContext: baseModuleContext{
os: deviceTarget.Os,
target: deviceTarget,
- kind: socSpecificModule,
+ earlyModuleContext: earlyModuleContext{
+ kind: socSpecificModule,
+ },
},
inData: true,
inSanitizerDir: true,
@@ -531,7 +557,9 @@
baseModuleContext: baseModuleContext{
os: deviceTarget.Os,
target: deviceTarget,
- kind: deviceSpecificModule,
+ earlyModuleContext: earlyModuleContext{
+ kind: deviceSpecificModule,
+ },
},
inData: true,
inSanitizerDir: true,
@@ -545,7 +573,9 @@
baseModuleContext: baseModuleContext{
os: deviceTarget.Os,
target: deviceTarget,
- kind: productSpecificModule,
+ earlyModuleContext: earlyModuleContext{
+ kind: productSpecificModule,
+ },
},
inData: true,
inSanitizerDir: true,
@@ -559,7 +589,9 @@
baseModuleContext: baseModuleContext{
os: deviceTarget.Os,
target: deviceTarget,
- kind: systemExtSpecificModule,
+ earlyModuleContext: earlyModuleContext{
+ kind: systemExtSpecificModule,
+ },
},
inData: true,
inSanitizerDir: true,
diff --git a/android/testing.go b/android/testing.go
index 4f0591b..6663728 100644
--- a/android/testing.go
+++ b/android/testing.go
@@ -37,8 +37,6 @@
ctx.SetNameInterface(nameResolver)
- ctx.preArch = append(ctx.preArch, registerLoadHookMutator)
-
ctx.postDeps = append(ctx.postDeps, registerPathDepsMutator)
return ctx
@@ -54,6 +52,7 @@
*Context
preArch, preDeps, postDeps []RegisterMutatorFunc
NameResolver *NameResolver
+ config Config
}
func (ctx *TestContext) PreArchMutators(f RegisterMutatorFunc) {
@@ -76,6 +75,20 @@
registerMutators(ctx.Context.Context, ctx.preArch, ctx.preDeps, ctx.postDeps)
ctx.RegisterSingletonType("env", EnvSingleton)
+
+ ctx.config = config
+}
+
+func (ctx *TestContext) ParseFileList(rootDir string, filePaths []string) (deps []string, errs []error) {
+ // This function adapts the old style ParseFileList calls that are spread throughout the tests
+ // to the new style that takes a config.
+ return ctx.Context.ParseFileList(rootDir, filePaths, ctx.config)
+}
+
+func (ctx *TestContext) ParseBlueprintsFiles(rootDir string) (deps []string, errs []error) {
+ // This function adapts the old style ParseBlueprintsFiles calls that are spread throughout the
+ // tests to the new style that takes a config.
+ return ctx.Context.ParseBlueprintsFiles(rootDir, ctx.config)
}
func (ctx *TestContext) RegisterModuleType(name string, factory ModuleFactory) {
diff --git a/apex/androidmk.go b/apex/androidmk.go
index c42b348..b5c5331 100644
--- a/apex/androidmk.go
+++ b/apex/androidmk.go
@@ -117,6 +117,9 @@
fmt.Fprintln(w, "LOCAL_IS_HOST_MODULE := true")
}
}
+ if fi.jacocoReportClassesFile != nil {
+ fmt.Fprintln(w, "LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR :=", fi.jacocoReportClassesFile.String())
+ }
if fi.class == javaSharedLib {
javaModule := fi.module.(javaLibrary)
// soong_java_prebuilt.mk sets LOCAL_MODULE_SUFFIX := .jar Therefore
@@ -128,6 +131,12 @@
fmt.Fprintln(w, "LOCAL_SOONG_DEX_JAR :=", fi.builtFile.String())
fmt.Fprintln(w, "LOCAL_DEX_PREOPT := false")
fmt.Fprintln(w, "include $(BUILD_SYSTEM)/soong_java_prebuilt.mk")
+ } else if fi.class == app {
+ // soong_app_prebuilt.mk sets LOCAL_MODULE_SUFFIX := .apk Therefore
+ // we need to remove the suffix from LOCAL_MODULE_STEM, otherwise
+ // we will have foo.apk.apk
+ fmt.Fprintln(w, "LOCAL_MODULE_STEM :=", strings.TrimSuffix(fi.builtFile.Base(), ".apk"))
+ fmt.Fprintln(w, "include $(BUILD_SYSTEM)/soong_app_prebuilt.mk")
} else if fi.class == nativeSharedLib || fi.class == nativeExecutable || fi.class == nativeTest {
fmt.Fprintln(w, "LOCAL_MODULE_STEM :=", fi.builtFile.Base())
if cc, ok := fi.module.(*cc.Module); ok {
@@ -152,6 +161,27 @@
return moduleNames
}
+func (a *apexBundle) writeRequiredModules(w io.Writer) {
+ var required []string
+ var targetRequired []string
+ var hostRequired []string
+ for _, fi := range a.filesInfo {
+ required = append(required, fi.requiredModuleNames...)
+ targetRequired = append(targetRequired, fi.targetRequiredModuleNames...)
+ hostRequired = append(hostRequired, fi.hostRequiredModuleNames...)
+ }
+
+ if len(required) > 0 {
+ fmt.Fprintln(w, "LOCAL_REQUIRED_MODULES +=", strings.Join(required, " "))
+ }
+ if len(targetRequired) > 0 {
+ fmt.Fprintln(w, "LOCAL_TARGET_REQUIRED_MODULES +=", strings.Join(targetRequired, " "))
+ }
+ if len(hostRequired) > 0 {
+ fmt.Fprintln(w, "LOCAL_HOST_REQUIRED_MODULES +=", strings.Join(hostRequired, " "))
+ }
+}
+
func (a *apexBundle) androidMkForType() android.AndroidMkData {
return android.AndroidMkData{
Custom: func(w io.Writer, name, prefix, moduleDir string, data android.AndroidMkData) {
@@ -170,6 +200,7 @@
if len(moduleNames) > 0 {
fmt.Fprintln(w, "LOCAL_REQUIRED_MODULES :=", strings.Join(moduleNames, " "))
}
+ a.writeRequiredModules(w)
fmt.Fprintln(w, "include $(BUILD_PHONY_PACKAGE)")
} else {
@@ -188,6 +219,7 @@
if len(a.externalDeps) > 0 {
fmt.Fprintln(w, "LOCAL_REQUIRED_MODULES +=", strings.Join(a.externalDeps, " "))
}
+ a.writeRequiredModules(w)
var postInstallCommands []string
if a.prebuiltFileToDelete != "" {
postInstallCommands = append(postInstallCommands, "rm -rf "+
diff --git a/apex/apex.go b/apex/apex.go
index cd80503..3026b60 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -461,6 +461,12 @@
symlinks []string
transitiveDep bool
moduleDir string
+
+ requiredModuleNames []string
+ targetRequiredModuleNames []string
+ hostRequiredModuleNames []string
+
+ jacocoReportClassesFile android.Path // only for javalibs and apps
}
func newApexFile(ctx android.BaseModuleContext, builtFile android.Path, moduleName string, installDir string, class apexFileClass, module android.Module) apexFile {
@@ -473,6 +479,9 @@
}
if module != nil {
ret.moduleDir = ctx.OtherModuleDir(module)
+ ret.requiredModuleNames = module.RequiredModuleNames()
+ ret.targetRequiredModuleNames = module.TargetRequiredModuleNames()
+ ret.hostRequiredModuleNames = module.HostRequiredModuleNames()
}
return ret
}
@@ -692,6 +701,12 @@
ctx.AddFarVariationDependencies(ctx.Config().AndroidCommonTarget.Variations(),
javaLibTag, a.properties.Java_libs...)
+ // With EMMA_INSTRUMENT_FRAMEWORK=true the ART boot image includes jacoco library.
+ if a.artApex && ctx.Config().IsEnvTrue("EMMA_INSTRUMENT_FRAMEWORK") {
+ ctx.AddFarVariationDependencies(ctx.Config().AndroidCommonTarget.Variations(),
+ javaLibTag, "jacocoagent")
+ }
+
if String(a.properties.Key) == "" {
ctx.ModuleErrorf("key is missing")
return
@@ -882,7 +897,9 @@
func apexFileForJavaLibrary(ctx android.BaseModuleContext, lib javaLibrary) apexFile {
dirInApex := "javalib"
fileToCopy := lib.DexJar()
- return newApexFile(ctx, fileToCopy, lib.Name(), dirInApex, javaSharedLib, lib)
+ af := newApexFile(ctx, fileToCopy, lib.Name(), dirInApex, javaSharedLib, lib)
+ af.jacocoReportClassesFile = lib.JacocoReportClassesFile()
+ return af
}
func apexFileForPrebuiltEtc(ctx android.BaseModuleContext, prebuilt android.PrebuiltEtcModule, depName string) apexFile {
@@ -895,6 +912,7 @@
android.Module
Privileged() bool
OutputFile() android.Path
+ JacocoReportClassesFile() android.Path
}, pkgName string) apexFile {
appDir := "app"
if aapp.Privileged() {
@@ -902,7 +920,9 @@
}
dirInApex := filepath.Join(appDir, pkgName)
fileToCopy := aapp.OutputFile()
- return newApexFile(ctx, fileToCopy, aapp.Name(), dirInApex, app, aapp)
+ af := newApexFile(ctx, fileToCopy, aapp.Name(), dirInApex, app, aapp)
+ af.jacocoReportClassesFile = aapp.JacocoReportClassesFile()
+ return af
}
// Context "decorator", overriding the InstallBypassMake method to always reply `true`.
diff --git a/apex/apex_test.go b/apex/apex_test.go
index 0d929ed..cc346e9 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -3328,6 +3328,43 @@
`)
}
+func TestCarryRequiredModuleNames(t *testing.T) {
+ ctx, config := testApex(t, `
+ apex {
+ name: "myapex",
+ key: "myapex.key",
+ native_shared_libs: ["mylib"],
+ }
+
+ apex_key {
+ name: "myapex.key",
+ public_key: "testkey.avbpubkey",
+ private_key: "testkey.pem",
+ }
+
+ cc_library {
+ name: "mylib",
+ srcs: ["mylib.cpp"],
+ system_shared_libs: [],
+ stl: "none",
+ required: ["a", "b"],
+ host_required: ["c", "d"],
+ target_required: ["e", "f"],
+ }
+ `)
+
+ apexBundle := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle)
+ data := android.AndroidMkDataForTest(t, config, "", apexBundle)
+ name := apexBundle.BaseModuleName()
+ prefix := "TARGET_"
+ var builder strings.Builder
+ data.Custom(&builder, name, prefix, "", data)
+ androidMk := builder.String()
+ ensureContains(t, androidMk, "LOCAL_REQUIRED_MODULES += a b\n")
+ ensureContains(t, androidMk, "LOCAL_HOST_REQUIRED_MODULES += c d\n")
+ ensureContains(t, androidMk, "LOCAL_TARGET_REQUIRED_MODULES += e f\n")
+}
+
func TestMain(m *testing.M) {
run := func() int {
setUp()
diff --git a/cc/androidmk.go b/cc/androidmk.go
index 988ebd4..ff88091 100644
--- a/cc/androidmk.go
+++ b/cc/androidmk.go
@@ -284,6 +284,9 @@
fmt.Fprintln(w, "LOCAL_FULL_TEST_CONFIG :=", benchmark.testConfig.String())
}
fmt.Fprintln(w, "LOCAL_NATIVE_BENCHMARK := true")
+ if !BoolDefault(benchmark.Properties.Auto_gen_config, true) {
+ fmt.Fprintln(w, "LOCAL_DISABLE_AUTO_GENERATE_TEST_CONFIG := true")
+ }
})
androidMkWriteTestData(benchmark.data, ctx, ret)
@@ -304,6 +307,9 @@
if test.testConfig != nil {
fmt.Fprintln(w, "LOCAL_FULL_TEST_CONFIG :=", test.testConfig.String())
}
+ if !BoolDefault(test.Properties.Auto_gen_config, true) {
+ fmt.Fprintln(w, "LOCAL_DISABLE_AUTO_GENERATE_TEST_CONFIG := true")
+ }
})
androidMkWriteTestData(test.data, ctx, ret)
diff --git a/cc/config/vndk.go b/cc/config/vndk.go
index c3cda49..9feb5a3 100644
--- a/cc/config/vndk.go
+++ b/cc/config/vndk.go
@@ -84,6 +84,7 @@
"android.hardware.thermal@1.0",
"android.hardware.tv.cec@1.0",
"android.hardware.tv.input@1.0",
+ "android.hardware.vibrator-ndk_platform",
"android.hardware.vibrator@1.0",
"android.hardware.vibrator@1.1",
"android.hardware.vibrator@1.2",
@@ -165,5 +166,4 @@
"libxml2",
"libyuv",
"libziparchive",
- "vintf-vibrator-ndk_platform",
}
diff --git a/cc/pgo.go b/cc/pgo.go
index 4618f4e..0072355 100644
--- a/cc/pgo.go
+++ b/cc/pgo.go
@@ -210,11 +210,6 @@
ctx.ModuleErrorf("PGO specification is missing properties: " + missingProps)
}
- // Sampling not supported yet
- if isSampling {
- ctx.PropertyErrorf("pgo.sampling", "\"sampling\" is not supported yet)")
- }
-
if isSampling && isInstrumentation {
ctx.PropertyErrorf("pgo", "Exactly one of \"instrumentation\" and \"sampling\" properties must be set")
}
diff --git a/dexpreopt/config.go b/dexpreopt/config.go
index 83e3673..0c79ccc 100644
--- a/dexpreopt/config.go
+++ b/dexpreopt/config.go
@@ -22,7 +22,9 @@
"android/soong/android"
)
-// GlobalConfig stores the configuration for dex preopting set by the product
+// GlobalConfig stores the configuration for dex preopting. The fields are set
+// from product variables via dex_preopt_config.mk, except for SoongConfig
+// which come from CreateGlobalSoongConfig.
type GlobalConfig struct {
DisablePreopt bool // disable preopt for all modules
DisablePreoptModules []string // modules with preopt disabled by product-specific config
@@ -82,19 +84,19 @@
Dex2oatImageXmx string // max heap size for dex2oat for the boot image
Dex2oatImageXms string // initial heap size for dex2oat for the boot image
- Tools Tools // paths to tools possibly used by the generated commands
+ SoongConfig GlobalSoongConfig // settings read from dexpreopt_soong.config
}
-// Tools contains paths to tools possibly used by the generated commands. If you add a new tool here you MUST add it
-// to the order-only dependency list in DEXPREOPT_GEN_DEPS.
-type Tools struct {
- Profman android.Path
- Dex2oat android.Path
- Aapt android.Path
- SoongZip android.Path
- Zip2zip android.Path
- ManifestCheck android.Path
-
+// GlobalSoongConfig contains the global config that is generated from Soong,
+// stored in dexpreopt_soong.config.
+type GlobalSoongConfig struct {
+ // Paths to tools possibly used by the generated commands.
+ Profman android.Path
+ Dex2oat android.Path
+ Aapt android.Path
+ SoongZip android.Path
+ Zip2zip android.Path
+ ManifestCheck android.Path
ConstructContext android.Path
}
@@ -133,6 +135,17 @@
PresignedPrebuilt bool
}
+type globalSoongConfigSingleton struct{}
+
+var pctx = android.NewPackageContext("android/soong/dexpreopt")
+
+func init() {
+ pctx.Import("android/soong/android")
+ android.RegisterSingletonType("dexpreopt-soong-config", func() android.Singleton {
+ return &globalSoongConfigSingleton{}
+ })
+}
+
func constructPath(ctx android.PathContext, path string) android.Path {
buildDirPrefix := ctx.Config().BuildDir() + "/"
if path == "" {
@@ -167,9 +180,12 @@
return constructPath(ctx, path).(android.WritablePath)
}
-// LoadGlobalConfig reads the global dexpreopt.config file into a GlobalConfig struct. It is used directly in Soong
-// and in dexpreopt_gen called from Make to read the $OUT/dexpreopt.config written by Make.
-func LoadGlobalConfig(ctx android.PathContext, path string) (GlobalConfig, []byte, error) {
+// LoadGlobalConfig reads the global dexpreopt.config file into a GlobalConfig
+// struct, except the SoongConfig field which is set from the provided
+// soongConfig argument. LoadGlobalConfig is used directly in Soong and in
+// dexpreopt_gen called from Make to read the $OUT/dexpreopt.config written by
+// Make.
+func LoadGlobalConfig(ctx android.PathContext, path string, soongConfig GlobalSoongConfig) (GlobalConfig, []byte, error) {
type GlobalJSONConfig struct {
GlobalConfig
@@ -177,17 +193,6 @@
// used to construct the real value manually below.
DirtyImageObjects string
BootImageProfiles []string
-
- Tools struct {
- Profman string
- Dex2oat string
- Aapt string
- SoongZip string
- Zip2zip string
- ManifestCheck string
-
- ConstructContext string
- }
}
config := GlobalJSONConfig{}
@@ -200,13 +205,9 @@
config.GlobalConfig.DirtyImageObjects = android.OptionalPathForPath(constructPath(ctx, config.DirtyImageObjects))
config.GlobalConfig.BootImageProfiles = constructPaths(ctx, config.BootImageProfiles)
- config.GlobalConfig.Tools.Profman = constructPath(ctx, config.Tools.Profman)
- config.GlobalConfig.Tools.Dex2oat = constructPath(ctx, config.Tools.Dex2oat)
- config.GlobalConfig.Tools.Aapt = constructPath(ctx, config.Tools.Aapt)
- config.GlobalConfig.Tools.SoongZip = constructPath(ctx, config.Tools.SoongZip)
- config.GlobalConfig.Tools.Zip2zip = constructPath(ctx, config.Tools.Zip2zip)
- config.GlobalConfig.Tools.ManifestCheck = constructPath(ctx, config.Tools.ManifestCheck)
- config.GlobalConfig.Tools.ConstructContext = constructPath(ctx, config.Tools.ConstructContext)
+ // Set this here to force the caller to provide a value for this struct (from
+ // either CreateGlobalSoongConfig or LoadGlobalSoongConfig).
+ config.GlobalConfig.SoongConfig = soongConfig
return config.GlobalConfig, data, nil
}
@@ -253,6 +254,104 @@
return config.ModuleConfig, nil
}
+// CreateGlobalSoongConfig creates a GlobalSoongConfig from the current context.
+// Should not be used in dexpreopt_gen.
+func CreateGlobalSoongConfig(ctx android.PathContext) GlobalSoongConfig {
+ // Default to debug version to help find bugs.
+ // Set USE_DEX2OAT_DEBUG to false for only building non-debug versions.
+ var dex2oatBinary string
+ if ctx.Config().Getenv("USE_DEX2OAT_DEBUG") == "false" {
+ dex2oatBinary = "dex2oat"
+ } else {
+ dex2oatBinary = "dex2oatd"
+ }
+
+ return GlobalSoongConfig{
+ Profman: ctx.Config().HostToolPath(ctx, "profman"),
+ Dex2oat: ctx.Config().HostToolPath(ctx, dex2oatBinary),
+ Aapt: ctx.Config().HostToolPath(ctx, "aapt"),
+ SoongZip: ctx.Config().HostToolPath(ctx, "soong_zip"),
+ Zip2zip: ctx.Config().HostToolPath(ctx, "zip2zip"),
+ ManifestCheck: ctx.Config().HostToolPath(ctx, "manifest_check"),
+ ConstructContext: android.PathForSource(ctx, "build/make/core/construct_context.sh"),
+ }
+}
+
+type globalJsonSoongConfig struct {
+ Profman string
+ Dex2oat string
+ Aapt string
+ SoongZip string
+ Zip2zip string
+ ManifestCheck string
+ ConstructContext string
+}
+
+// LoadGlobalSoongConfig reads the dexpreopt_soong.config file into a
+// GlobalSoongConfig struct. It is only used in dexpreopt_gen.
+func LoadGlobalSoongConfig(ctx android.PathContext, path string) (GlobalSoongConfig, error) {
+ var jc globalJsonSoongConfig
+
+ _, err := loadConfig(ctx, path, &jc)
+ if err != nil {
+ return GlobalSoongConfig{}, err
+ }
+
+ config := GlobalSoongConfig{
+ Profman: constructPath(ctx, jc.Profman),
+ Dex2oat: constructPath(ctx, jc.Dex2oat),
+ Aapt: constructPath(ctx, jc.Aapt),
+ SoongZip: constructPath(ctx, jc.SoongZip),
+ Zip2zip: constructPath(ctx, jc.Zip2zip),
+ ManifestCheck: constructPath(ctx, jc.ManifestCheck),
+ ConstructContext: constructPath(ctx, jc.ConstructContext),
+ }
+
+ return config, nil
+}
+
+func (s *globalSoongConfigSingleton) GenerateBuildActions(ctx android.SingletonContext) {
+ config := CreateGlobalSoongConfig(ctx)
+ jc := globalJsonSoongConfig{
+ Profman: config.Profman.String(),
+ Dex2oat: config.Dex2oat.String(),
+ Aapt: config.Aapt.String(),
+ SoongZip: config.SoongZip.String(),
+ Zip2zip: config.Zip2zip.String(),
+ ManifestCheck: config.ManifestCheck.String(),
+ ConstructContext: config.ConstructContext.String(),
+ }
+
+ data, err := json.Marshal(jc)
+ if err != nil {
+ ctx.Errorf("failed to JSON marshal GlobalSoongConfig: %v", err)
+ return
+ }
+
+ ctx.Build(pctx, android.BuildParams{
+ Rule: android.WriteFile,
+ Output: android.PathForOutput(ctx, "dexpreopt_soong.config"),
+ Args: map[string]string{
+ "content": string(data),
+ },
+ })
+}
+
+func (s *globalSoongConfigSingleton) MakeVars(ctx android.MakeVarsContext) {
+ config := CreateGlobalSoongConfig(ctx)
+
+ ctx.Strict("DEX2OAT", config.Dex2oat.String())
+ ctx.Strict("DEXPREOPT_GEN_DEPS", strings.Join([]string{
+ config.Profman.String(),
+ config.Dex2oat.String(),
+ config.Aapt.String(),
+ config.SoongZip.String(),
+ config.Zip2zip.String(),
+ config.ManifestCheck.String(),
+ config.ConstructContext.String(),
+ }, " "))
+}
+
func loadConfig(ctx android.PathContext, path string, config interface{}) ([]byte, error) {
r, err := ctx.Fs().Open(path)
if err != nil {
@@ -312,7 +411,7 @@
BootFlags: "",
Dex2oatImageXmx: "",
Dex2oatImageXms: "",
- Tools: Tools{
+ SoongConfig: GlobalSoongConfig{
Profman: android.PathForTesting("profman"),
Dex2oat: android.PathForTesting("dex2oat"),
Aapt: android.PathForTesting("aapt"),
diff --git a/dexpreopt/dexpreopt.go b/dexpreopt/dexpreopt.go
index fc1bae1..ac5b691 100644
--- a/dexpreopt/dexpreopt.go
+++ b/dexpreopt/dexpreopt.go
@@ -131,7 +131,7 @@
cmd := rule.Command().
Text(`ANDROID_LOG_TAGS="*:e"`).
- Tool(global.Tools.Profman)
+ Tool(global.SoongConfig.Profman)
if module.ProfileIsTextListing {
// The profile is a test listing of classes (used for framework jars).
@@ -170,7 +170,7 @@
cmd := rule.Command().
Text(`ANDROID_LOG_TAGS="*:e"`).
- Tool(global.Tools.Profman)
+ Tool(global.SoongConfig.Profman)
// The profile is a test listing of methods.
// We need to generate the actual binary profile.
@@ -222,14 +222,6 @@
invocationPath := odexPath.ReplaceExtension(ctx, "invocation")
- // TODO(skvadrik): fix this to use boot image location in the module config (currently it is broken
- // in JIT-zygote builds, because "default" boot image is hard-coded in parts of the module config).
- bootImage := module.DexPreoptImages[archIdx]
- var bootImageLocation string
- if bootImage != nil {
- bootImageLocation = PathToLocation(bootImage, arch)
- }
-
// The class loader context using paths in the build
var classLoaderContextHost android.Paths
@@ -307,14 +299,14 @@
if module.EnforceUsesLibraries {
if module.ManifestPath != nil {
rule.Command().Text(`target_sdk_version="$(`).
- Tool(global.Tools.ManifestCheck).
+ Tool(global.SoongConfig.ManifestCheck).
Flag("--extract-target-sdk-version").
Input(module.ManifestPath).
Text(`)"`)
} else {
// No manifest to extract targetSdkVersion from, hope that DexJar is an APK
rule.Command().Text(`target_sdk_version="$(`).
- Tool(global.Tools.Aapt).
+ Tool(global.SoongConfig.Aapt).
Flag("dump badging").
Input(module.DexPath).
Text(`| grep "targetSdkVersion" | sed -n "s/targetSdkVersion:'\(.*\)'/\1/p"`).
@@ -335,7 +327,7 @@
Implicits(conditionalClassLoaderContextHost29)
rule.Command().Textf(`conditional_target_libs_29="%s"`,
strings.Join(conditionalClassLoaderContextTarget29, " "))
- rule.Command().Text("source").Tool(global.Tools.ConstructContext).Input(module.DexPath)
+ rule.Command().Text("source").Tool(global.SoongConfig.ConstructContext).Input(module.DexPath)
}
// Devices that do not have a product partition use a symlink from /product to /system/product.
@@ -348,7 +340,7 @@
cmd := rule.Command().
Text(`ANDROID_LOG_TAGS="*:e"`).
- Tool(global.Tools.Dex2oat).
+ Tool(global.SoongConfig.Dex2oat).
Flag("--avoid-storing-invocation").
FlagWithOutput("--write-invocation-to=", invocationPath).ImplicitOutput(invocationPath).
Flag("--runtime-arg").FlagWithArg("-Xms", global.Dex2oatXms).
@@ -357,7 +349,7 @@
Flag("--runtime-arg").FlagWithList("-Xbootclasspath-locations:", module.PreoptBootClassPathDexLocations, ":").
Flag("${class_loader_context_arg}").
Flag("${stored_class_loader_context_arg}").
- FlagWithArg("--boot-image=", bootImageLocation).Implicits(module.DexPreoptImagesDeps[archIdx].Paths()).
+ FlagWithArg("--boot-image=", strings.Join(module.DexPreoptImageLocations, ":")).Implicits(module.DexPreoptImagesDeps[archIdx].Paths()).
FlagWithInput("--dex-file=", module.DexPath).
FlagWithArg("--dex-location=", dexLocationArg).
FlagWithOutput("--oat-file=", odexPath).ImplicitOutput(vdexPath).
@@ -417,7 +409,7 @@
dmInstalledPath := pathtools.ReplaceExtension(module.DexLocation, "dm")
tmpPath := module.BuildPath.InSameDir(ctx, "primary.vdex")
rule.Command().Text("cp -f").Input(vdexPath).Output(tmpPath)
- rule.Command().Tool(global.Tools.SoongZip).
+ rule.Command().Tool(global.SoongConfig.SoongZip).
FlagWithArg("-L", "9").
FlagWithOutput("-o", dmPath).
Flag("-j").
diff --git a/dexpreopt/dexpreopt_gen/dexpreopt_gen.go b/dexpreopt/dexpreopt_gen/dexpreopt_gen.go
index 6f51080..d2faa00 100644
--- a/dexpreopt/dexpreopt_gen/dexpreopt_gen.go
+++ b/dexpreopt/dexpreopt_gen/dexpreopt_gen.go
@@ -30,10 +30,11 @@
)
var (
- dexpreoptScriptPath = flag.String("dexpreopt_script", "", "path to output dexpreopt script")
- globalConfigPath = flag.String("global", "", "path to global configuration file")
- moduleConfigPath = flag.String("module", "", "path to module configuration file")
- outDir = flag.String("out_dir", "", "path to output directory")
+ dexpreoptScriptPath = flag.String("dexpreopt_script", "", "path to output dexpreopt script")
+ globalSoongConfigPath = flag.String("global_soong", "", "path to global configuration file for settings originating from Soong")
+ globalConfigPath = flag.String("global", "", "path to global configuration file")
+ moduleConfigPath = flag.String("module", "", "path to module configuration file")
+ outDir = flag.String("out_dir", "", "path to output directory")
)
type pathContext struct {
@@ -63,17 +64,27 @@
usage("path to output dexpreopt script is required")
}
+ if *globalSoongConfigPath == "" {
+ usage("--global_soong configuration file is required")
+ }
+
if *globalConfigPath == "" {
- usage("path to global configuration file is required")
+ usage("--global configuration file is required")
}
if *moduleConfigPath == "" {
- usage("path to module configuration file is required")
+ usage("--module configuration file is required")
}
ctx := &pathContext{android.TestConfig(*outDir, nil, "", nil)}
- globalConfig, _, err := dexpreopt.LoadGlobalConfig(ctx, *globalConfigPath)
+ globalSoongConfig, err := dexpreopt.LoadGlobalSoongConfig(ctx, *globalSoongConfigPath)
+ if err != nil {
+ fmt.Fprintf(os.Stderr, "error loading global config %q: %s\n", *globalSoongConfigPath, err)
+ os.Exit(2)
+ }
+
+ globalConfig, _, err := dexpreopt.LoadGlobalConfig(ctx, *globalConfigPath, globalSoongConfig)
if err != nil {
fmt.Fprintf(os.Stderr, "error loading global config %q: %s\n", *globalConfigPath, err)
os.Exit(2)
@@ -121,7 +132,7 @@
dexpreoptRule.Command().Text("mkdir -p").Flag(filepath.Dir(installPath.String()))
dexpreoptRule.Command().Text("cp -f").Input(install.From).Output(installPath)
}
- dexpreoptRule.Command().Tool(global.Tools.SoongZip).
+ dexpreoptRule.Command().Tool(global.SoongConfig.SoongZip).
FlagWithArg("-o ", "$2").
FlagWithArg("-C ", installDir.String()).
FlagWithArg("-D ", installDir.String())
diff --git a/java/aar.go b/java/aar.go
index 201e590..ae064e5 100644
--- a/java/aar.go
+++ b/java/aar.go
@@ -576,6 +576,10 @@
return a.prebuilt.Name(a.ModuleBase.Name())
}
+func (a *AARImport) JacocoReportClassesFile() android.Path {
+ return nil
+}
+
func (a *AARImport) DepsMutator(ctx android.BottomUpMutatorContext) {
if !ctx.Config().UnbundledBuildUsePrebuiltSdks() {
sdkDep := decodeSdkDep(ctx, sdkContext(a))
diff --git a/java/androidmk.go b/java/androidmk.go
index 11fea82..04bf15c 100644
--- a/java/androidmk.go
+++ b/java/androidmk.go
@@ -141,6 +141,9 @@
entries.SetPath("LOCAL_FULL_TEST_CONFIG", j.testConfig)
}
androidMkWriteTestData(j.data, entries)
+ if !BoolDefault(j.testProperties.Auto_gen_config, true) {
+ entries.SetString("LOCAL_DISABLE_AUTO_GENERATE_TEST_CONFIG", "true")
+ }
})
return entriesList
@@ -613,7 +616,7 @@
fmt.Fprintln(w, dstubs.Name()+"-check-last-released-api:",
dstubs.checkLastReleasedApiTimestamp.String())
- if dstubs.Name() == "api-stubs-docs" || dstubs.Name() == "system-api-stubs-docs" {
+ if dstubs.Name() != "android.car-system-stubs-docs" {
fmt.Fprintln(w, ".PHONY: checkapi")
fmt.Fprintln(w, "checkapi:",
dstubs.checkLastReleasedApiTimestamp.String())
diff --git a/java/app.go b/java/app.go
index 94f6bb1..05fa505 100755
--- a/java/app.go
+++ b/java/app.go
@@ -897,7 +897,7 @@
MergePropertiesFromVariant(ctx, &a.properties, archProps, archType.Name)
}
-func MergePropertiesFromVariant(ctx android.BaseModuleContext,
+func MergePropertiesFromVariant(ctx android.EarlyModuleContext,
dst interface{}, variantGroup reflect.Value, variant string) {
src := variantGroup.FieldByName(proptools.FieldNameForProperty(variant))
if !src.IsValid() {
@@ -1062,6 +1062,10 @@
return a.outputFile
}
+func (a *AndroidAppImport) JacocoReportClassesFile() android.Path {
+ return nil
+}
+
var dpiVariantGroupType reflect.Type
var archVariantGroupType reflect.Type
diff --git a/java/device_host_converter.go b/java/device_host_converter.go
index 1524418..b40ab93 100644
--- a/java/device_host_converter.go
+++ b/java/device_host_converter.go
@@ -170,6 +170,10 @@
return d.srcJarArgs, d.srcJarDeps
}
+func (d *DeviceHostConverter) JacocoReportClassesFile() android.Path {
+ return nil
+}
+
func (d *DeviceHostConverter) AndroidMk() android.AndroidMkData {
return android.AndroidMkData{
Class: "JAVA_LIBRARIES",
diff --git a/java/dexpreopt_bootjars.go b/java/dexpreopt_bootjars.go
index 1d363c9..fe5bed5 100644
--- a/java/dexpreopt_bootjars.go
+++ b/java/dexpreopt_bootjars.go
@@ -178,12 +178,6 @@
return false
}
-func skipDexpreoptArtBootJars(ctx android.BuilderContext) bool {
- // with EMMA_INSTRUMENT_FRAMEWORK=true ART boot class path libraries have dependencies on framework,
- // therefore dexpreopt ART libraries cannot be dexpreopted in isolation => no ART boot image
- return ctx.Config().IsEnvTrue("EMMA_INSTRUMENT_FRAMEWORK")
-}
-
type dexpreoptBootJars struct {
defaultBootImage *bootImage
otherImages []*bootImage
@@ -193,7 +187,7 @@
// Accessor function for the apex package. Returns nil if dexpreopt is disabled.
func DexpreoptedArtApexJars(ctx android.BuilderContext) map[android.ArchType]android.OutputPaths {
- if skipDexpreoptBootJars(ctx) || skipDexpreoptArtBootJars(ctx) {
+ if skipDexpreoptBootJars(ctx) {
return nil
}
return artBootImageConfig(ctx).imagesDeps
@@ -222,10 +216,8 @@
// Always create the default boot image first, to get a unique profile rule for all images.
d.defaultBootImage = buildBootImage(ctx, defaultBootImageConfig(ctx))
- if !skipDexpreoptArtBootJars(ctx) {
- // Create boot image for the ART apex (build artifacts are accessed via the global boot image config).
- d.otherImages = append(d.otherImages, buildBootImage(ctx, artBootImageConfig(ctx)))
- }
+ // Create boot image for the ART apex (build artifacts are accessed via the global boot image config).
+ d.otherImages = append(d.otherImages, buildBootImage(ctx, artBootImageConfig(ctx)))
if global.GenerateApexImage {
// Create boot images for the JIT-zygote experiment.
d.otherImages = append(d.otherImages, buildBootImage(ctx, apexBootImageConfig(ctx)))
@@ -335,7 +327,7 @@
invocationPath := outputPath.ReplaceExtension(ctx, "invocation")
- cmd.Tool(global.Tools.Dex2oat).
+ cmd.Tool(global.SoongConfig.Dex2oat).
Flag("--avoid-storing-invocation").
FlagWithOutput("--write-invocation-to=", invocationPath).ImplicitOutput(invocationPath).
Flag("--runtime-arg").FlagWithArg("-Xms", global.Dex2oatImageXms).
@@ -444,7 +436,6 @@
return nil
}
profile := ctx.Config().Once(bootImageProfileRuleKey, func() interface{} {
- tools := global.Tools
defaultProfile := "frameworks/base/config/boot-image-profile.txt"
rule := android.NewRuleBuilder()
@@ -470,7 +461,7 @@
rule.Command().
Text(`ANDROID_LOG_TAGS="*:e"`).
- Tool(tools.Profman).
+ Tool(global.SoongConfig.Profman).
FlagWithInput("--create-profile-from=", bootImageProfile).
FlagForEachInput("--apk=", image.dexPathsDeps.Paths()).
FlagForEachArg("--dex-location=", image.dexLocationsDeps).
@@ -499,8 +490,6 @@
return nil
}
return ctx.Config().Once(bootFrameworkProfileRuleKey, func() interface{} {
- tools := global.Tools
-
rule := android.NewRuleBuilder()
rule.MissingDeps(missingDeps)
@@ -521,7 +510,7 @@
rule.Command().
Text(`ANDROID_LOG_TAGS="*:e"`).
- Tool(tools.Profman).
+ Tool(global.SoongConfig.Profman).
Flag("--generate-boot-profile").
FlagWithInput("--create-profile-from=", bootFrameworkProfile).
FlagForEachInput("--apk=", image.dexPathsDeps.Paths()).
@@ -598,6 +587,7 @@
func (d *dexpreoptBootJars) MakeVars(ctx android.MakeVarsContext) {
if d.dexpreoptConfigForMake != nil {
ctx.Strict("DEX_PREOPT_CONFIG_FOR_MAKE", d.dexpreoptConfigForMake.String())
+ ctx.Strict("DEX_PREOPT_SOONG_CONFIG_FOR_MAKE", android.PathForOutput(ctx, "dexpreopt_soong.config").String())
}
image := d.defaultBootImage
@@ -605,7 +595,6 @@
ctx.Strict("DEXPREOPT_IMAGE_PROFILE_BUILT_INSTALLED", image.profileInstalls.String())
ctx.Strict("DEXPREOPT_BOOTCLASSPATH_DEX_FILES", strings.Join(image.dexPathsDeps.Strings(), " "))
ctx.Strict("DEXPREOPT_BOOTCLASSPATH_DEX_LOCATIONS", strings.Join(image.dexLocationsDeps, " "))
- ctx.Strict("DEXPREOPT_IMAGE_LOCATIONS", strings.Join(image.imageLocations, ":"))
var imageNames []string
for _, current := range append(d.otherImages, image) {
@@ -618,15 +607,15 @@
sort.Slice(arches, func(i, j int) bool { return arches[i].String() < arches[j].String() })
for _, arch := range arches {
- ctx.Strict("DEXPREOPT_IMAGE_VDEX_BUILT_INSTALLED_"+current.name+"_"+arch.String(), current.vdexInstalls[arch].String())
- ctx.Strict("DEXPREOPT_IMAGE_"+current.name+"_"+arch.String(), current.images[arch].String())
- ctx.Strict("DEXPREOPT_IMAGE_DEPS_"+current.name+"_"+arch.String(), strings.Join(current.imagesDeps[arch].Strings(), " "))
- ctx.Strict("DEXPREOPT_IMAGE_BUILT_INSTALLED_"+current.name+"_"+arch.String(), current.installs[arch].String())
- ctx.Strict("DEXPREOPT_IMAGE_UNSTRIPPED_BUILT_INSTALLED_"+current.name+"_"+arch.String(), current.unstrippedInstalls[arch].String())
- if current.zip != nil {
- }
+ sfx := current.name + "_" + arch.String()
+ ctx.Strict("DEXPREOPT_IMAGE_VDEX_BUILT_INSTALLED_"+sfx, current.vdexInstalls[arch].String())
+ ctx.Strict("DEXPREOPT_IMAGE_"+sfx, current.images[arch].String())
+ ctx.Strict("DEXPREOPT_IMAGE_DEPS_"+sfx, strings.Join(current.imagesDeps[arch].Strings(), " "))
+ ctx.Strict("DEXPREOPT_IMAGE_BUILT_INSTALLED_"+sfx, current.installs[arch].String())
+ ctx.Strict("DEXPREOPT_IMAGE_UNSTRIPPED_BUILT_INSTALLED_"+sfx, current.unstrippedInstalls[arch].String())
}
+ ctx.Strict("DEXPREOPT_IMAGE_LOCATIONS_"+current.name, strings.Join(current.imageLocations, ":"))
ctx.Strict("DEXPREOPT_IMAGE_ZIP_"+current.name, current.zip.String())
}
ctx.Strict("DEXPREOPT_IMAGE_NAMES", strings.Join(imageNames, " "))
diff --git a/java/dexpreopt_config.go b/java/dexpreopt_config.go
index 91e0dfb..35748b8 100644
--- a/java/dexpreopt_config.go
+++ b/java/dexpreopt_config.go
@@ -37,8 +37,9 @@
func dexpreoptGlobalConfigRaw(ctx android.PathContext) globalConfigAndRaw {
return ctx.Config().Once(dexpreoptGlobalConfigKey, func() interface{} {
if f := ctx.Config().DexpreoptGlobalConfig(); f != "" {
+ soongConfig := dexpreopt.CreateGlobalSoongConfig(ctx)
ctx.AddNinjaFileDeps(f)
- globalConfig, data, err := dexpreopt.LoadGlobalConfig(ctx, f)
+ globalConfig, data, err := dexpreopt.LoadGlobalConfig(ctx, f, soongConfig)
if err != nil {
panic(err)
}
@@ -135,6 +136,10 @@
deviceDir := android.PathForOutput(ctx, ctx.Config().DeviceName())
artModules := global.ArtApexJars
+ // With EMMA_INSTRUMENT_FRAMEWORK=true the Core libraries depend on jacoco.
+ if ctx.Config().IsEnvTrue("EMMA_INSTRUMENT_FRAMEWORK") {
+ artModules = append(artModules, "jacocoagent")
+ }
frameworkModules := android.RemoveListFromList(global.BootJars,
concat(artModules, getJarsFromApexJarPairs(global.UpdatableBootJars)))
diff --git a/java/java.go b/java/java.go
index a48b5a3..bfdc7fc 100644
--- a/java/java.go
+++ b/java/java.go
@@ -447,6 +447,7 @@
ExportedPlugins() (android.Paths, []string)
SrcJarArgs() ([]string, android.Paths)
BaseModuleName() string
+ JacocoReportClassesFile() android.Path
}
type SdkLibraryDependency interface {
@@ -1719,6 +1720,10 @@
return proptools.StringDefault(j.deviceProperties.Stem, j.Name())
}
+func (j *Module) JacocoReportClassesFile() android.Path {
+ return j.jacocoReportClassesFile
+}
+
//
// Java libraries (.jar file)
//
@@ -2295,6 +2300,10 @@
return proptools.StringDefault(j.properties.Stem, j.ModuleBase.Name())
}
+func (a *Import) JacocoReportClassesFile() android.Path {
+ return nil
+}
+
func (j *Import) DepsMutator(ctx android.BottomUpMutatorContext) {
ctx.AddVariationDependencies(nil, libTag, j.properties.Libs...)
}
diff --git a/java/platform_compat_config.go b/java/platform_compat_config.go
index fefd0e6..d5c7579 100644
--- a/java/platform_compat_config.go
+++ b/java/platform_compat_config.go
@@ -19,9 +19,14 @@
)
func init() {
+ android.RegisterSingletonType("platform_compat_config_singleton", platformCompatConfigSingletonFactory)
android.RegisterModuleType("platform_compat_config", platformCompatConfigFactory)
}
+type platformCompatConfigSingleton struct {
+ metadata android.Path
+}
+
type platformCompatConfigProperties struct {
Src *string `android:"path"`
}
@@ -35,6 +40,52 @@
metadataFile android.OutputPath
}
+func (p *platformCompatConfig) compatConfigMetadata() android.OutputPath {
+ return p.metadataFile
+}
+
+type platformCompatConfigIntf interface {
+ compatConfigMetadata() android.OutputPath
+}
+
+var _ platformCompatConfigIntf = (*platformCompatConfig)(nil)
+
+// compat singleton rules
+func (p *platformCompatConfigSingleton) GenerateBuildActions(ctx android.SingletonContext) {
+
+ var compatConfigMetadata android.Paths
+
+ ctx.VisitAllModules(func(module android.Module) {
+ if c, ok := module.(platformCompatConfigIntf); ok {
+ metadata := c.compatConfigMetadata()
+ compatConfigMetadata = append(compatConfigMetadata, metadata)
+ }
+ })
+
+ if compatConfigMetadata == nil {
+ // nothing to do.
+ return
+ }
+
+ rule := android.NewRuleBuilder()
+ outputPath := android.PathForOutput(ctx, "compat_config", "merged_compat_config.xml")
+
+ rule.Command().
+ BuiltTool(ctx, "process-compat-config").
+ FlagForEachInput("--xml ", compatConfigMetadata).
+ FlagWithOutput("--merged-config ", outputPath)
+
+ rule.Build(pctx, ctx, "merged-compat-config", "Merge compat config")
+
+ p.metadata = outputPath
+}
+
+func (p *platformCompatConfigSingleton) MakeVars(ctx android.MakeVarsContext) {
+ if p.metadata != nil {
+ ctx.Strict("INTERNAL_PLATFORM_MERGED_COMPAT_CONFIG", p.metadata.String())
+ }
+}
+
func (p *platformCompatConfig) GenerateAndroidBuildActions(ctx android.ModuleContext) {
rule := android.NewRuleBuilder()
@@ -69,6 +120,10 @@
}}
}
+func platformCompatConfigSingletonFactory() android.Singleton {
+ return &platformCompatConfigSingleton{}
+}
+
func platformCompatConfigFactory() android.Module {
module := &platformCompatConfig{}
module.AddProperties(&module.properties)
diff --git a/java/sdk.go b/java/sdk.go
index 6f0f432..66eb284 100644
--- a/java/sdk.go
+++ b/java/sdk.go
@@ -58,7 +58,7 @@
// Returns a sdk version as a number. For modules targeting an unreleased SDK (meaning it does not yet have a number)
// it returns android.FutureApiLevel (10000).
-func sdkVersionToNumber(ctx android.BaseModuleContext, v string) (int, error) {
+func sdkVersionToNumber(ctx android.EarlyModuleContext, v string) (int, error) {
switch v {
case "", "none", "current", "test_current", "system_current", "core_current", "core_platform":
return ctx.Config().DefaultAppTargetSdkInt(), nil
@@ -72,7 +72,7 @@
}
}
-func sdkVersionToNumberAsString(ctx android.BaseModuleContext, v string) (string, error) {
+func sdkVersionToNumberAsString(ctx android.EarlyModuleContext, v string) (string, error) {
n, err := sdkVersionToNumber(ctx, v)
if err != nil {
return "", err
@@ -80,7 +80,7 @@
return strconv.Itoa(n), nil
}
-func decodeSdkDep(ctx android.BaseModuleContext, sdkContext sdkContext) sdkDep {
+func decodeSdkDep(ctx android.EarlyModuleContext, sdkContext sdkContext) sdkDep {
v := sdkContext.sdkVersion()
// For PDK builds, use the latest SDK version instead of "current"
@@ -127,12 +127,12 @@
}
if !jarPath.Valid() {
- ctx.PropertyErrorf("sdk_version", "invalid sdk version %q, %q does not exist", v, jar)
+ ctx.PropertyErrorf("sdk_version", "invalid sdk version %q, %q does not exist", sdk, jar)
return sdkDep{}
}
if !aidlPath.Valid() {
- ctx.PropertyErrorf("sdk_version", "invalid sdk version %q, %q does not exist", v, aidl)
+ ctx.PropertyErrorf("sdk_version", "invalid sdk version %q, %q does not exist", sdk, aidl)
return sdkDep{}
}
diff --git a/java/sdk_library.go b/java/sdk_library.go
index 4492e3f..9b30e2c 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -388,7 +388,7 @@
}
// Get the sdk version for use when compiling the stubs library.
-func (module *SdkLibrary) sdkVersionForStubsLibrary(mctx android.BaseModuleContext, apiScope apiScope) string {
+func (module *SdkLibrary) sdkVersionForStubsLibrary(mctx android.LoadHookContext, apiScope apiScope) string {
sdkDep := decodeSdkDep(mctx, sdkContext(&module.Library))
if sdkDep.hasStandardLibs() {
// If building against a standard sdk then use the sdk version appropriate for the scope.
@@ -667,7 +667,11 @@
jar := filepath.Join(dir, module.BaseModuleName()+".jar")
jarPath := android.ExistentPathForSource(ctx, jar)
if !jarPath.Valid() {
- ctx.PropertyErrorf("sdk_library", "invalid sdk version %q, %q does not exist", v, jar)
+ if ctx.Config().AllowMissingDependencies() {
+ return android.Paths{android.PathForSource(ctx, jar)}
+ } else {
+ ctx.PropertyErrorf("sdk_library", "invalid sdk version %q, %q does not exist", sdkVersion, jar)
+ }
return nil
}
return android.Paths{jarPath.Path()}
diff --git a/java/testing.go b/java/testing.go
index ab3af65..08bae44 100644
--- a/java/testing.go
+++ b/java/testing.go
@@ -205,9 +205,6 @@
systemModules := []string{
"core-current-stubs-system-modules",
"core-platform-api-stubs-system-modules",
- "android_stubs_current_system_modules",
- "android_system_stubs_current_system_modules",
- "android_test_stubs_current_system_modules",
}
for _, extra := range systemModules {
diff --git a/python/androidmk.go b/python/androidmk.go
index aae7ced..8e8e8ef 100644
--- a/python/androidmk.go
+++ b/python/androidmk.go
@@ -76,6 +76,10 @@
p.testConfig.String())
}
}
+
+ if !BoolDefault(p.binaryProperties.Auto_gen_config, true) {
+ fmt.Fprintln(w, "LOCAL_DISABLE_AUTO_GENERATE_TEST_CONFIG := true")
+ }
})
base.subAndroidMk(ret, p.binaryDecorator.pythonInstaller)
}
diff --git a/rust/androidmk.go b/rust/androidmk.go
index 2636d97..0fba739 100644
--- a/rust/androidmk.go
+++ b/rust/androidmk.go
@@ -99,6 +99,9 @@
if test.testConfig != nil {
fmt.Fprintln(w, "LOCAL_FULL_TEST_CONFIG :=", test.testConfig.String())
}
+ if !BoolDefault(test.Properties.Auto_gen_config, true) {
+ fmt.Fprintln(w, "LOCAL_DISABLE_AUTO_GENERATE_TEST_CONFIG := true")
+ }
})
// TODO(chh): add test data with androidMkWriteTestData(test.data, ctx, ret)
}
diff --git a/rust/config/global.go b/rust/config/global.go
index 4d87780..ad8eb3a 100644
--- a/rust/config/global.go
+++ b/rust/config/global.go
@@ -24,7 +24,7 @@
var pctx = android.NewPackageContext("android/soong/rust/config")
var (
- RustDefaultVersion = "1.37.0"
+ RustDefaultVersion = "1.40.0"
RustDefaultBase = "prebuilts/rust/"
DefaultEdition = "2018"
Stdlibs = []string{
diff --git a/ui/build/ninja.go b/ui/build/ninja.go
index 6775ccf..8c6ebb8 100644
--- a/ui/build/ninja.go
+++ b/ui/build/ninja.go
@@ -114,6 +114,8 @@
"TARGET_BUILD_APPS",
"TARGET_BUILD_VARIANT",
"TARGET_PRODUCT",
+ // b/147197813 - used by art-check-debug-apex-gen
+ "EMMA_INSTRUMENT_FRAMEWORK",
// Goma -- gomacc may not need all of these
"GOMA_DIR",