Merge "Simplify the construction of class loader contexts for system server jars." into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
26cb99941b
47
java/java.go
47
java/java.go
@@ -23,14 +23,12 @@ import (
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/google/blueprint"
|
||||
"github.com/google/blueprint/pathtools"
|
||||
"github.com/google/blueprint/proptools"
|
||||
|
||||
"android/soong/android"
|
||||
"android/soong/dexpreopt"
|
||||
"android/soong/java/config"
|
||||
"android/soong/tradefed"
|
||||
)
|
||||
@@ -54,8 +52,6 @@ func init() {
|
||||
PropertyName: "java_tests",
|
||||
},
|
||||
})
|
||||
|
||||
android.PostDepsMutators(RegisterPostDepsMutators)
|
||||
}
|
||||
|
||||
func RegisterJavaBuildComponents(ctx android.RegistrationContext) {
|
||||
@@ -84,44 +80,6 @@ func RegisterJavaBuildComponents(ctx android.RegistrationContext) {
|
||||
ctx.RegisterSingletonType("kythe_java_extract", kytheExtractJavaFactory)
|
||||
}
|
||||
|
||||
func RegisterPostDepsMutators(ctx android.RegisterMutatorsContext) {
|
||||
ctx.BottomUp("ordered_system_server_jars", systemServerJarsDepsMutator)
|
||||
}
|
||||
|
||||
var (
|
||||
dexpreoptedSystemServerJarsKey = android.NewOnceKey("dexpreoptedSystemServerJars")
|
||||
dexpreoptedSystemServerJarsLock sync.Mutex
|
||||
)
|
||||
|
||||
func DexpreoptedSystemServerJars(config android.Config) *[]string {
|
||||
return config.Once(dexpreoptedSystemServerJarsKey, func() interface{} {
|
||||
return &[]string{}
|
||||
}).(*[]string)
|
||||
}
|
||||
|
||||
// A PostDepsMutator pass that enforces total order on non-updatable system server jars. A total
|
||||
// order is neededed because such jars must be dexpreopted together (each jar on the list must have
|
||||
// all preceding jars in its class loader context). The total order must be compatible with the
|
||||
// partial order imposed by genuine dependencies between system server jars (which is not always
|
||||
// respected by the PRODUCT_SYSTEM_SERVER_JARS variable).
|
||||
//
|
||||
// An earlier mutator pass creates genuine dependencies, and this pass traverses the jars in that
|
||||
// order (which is partial and non-deterministic). This pass adds additional dependencies between
|
||||
// jars, making the order total and deterministic. It also constructs a global ordered list.
|
||||
func systemServerJarsDepsMutator(ctx android.BottomUpMutatorContext) {
|
||||
jars := dexpreopt.NonUpdatableSystemServerJars(ctx, dexpreopt.GetGlobalConfig(ctx))
|
||||
name := ctx.ModuleName()
|
||||
if android.InList(name, jars) {
|
||||
dexpreoptedSystemServerJarsLock.Lock()
|
||||
defer dexpreoptedSystemServerJarsLock.Unlock()
|
||||
jars := DexpreoptedSystemServerJars(ctx.Config())
|
||||
for _, dep := range *jars {
|
||||
ctx.AddDependency(ctx.Module(), dexpreopt.SystemServerDepTag, dep)
|
||||
}
|
||||
*jars = append(*jars, name)
|
||||
}
|
||||
}
|
||||
|
||||
func (j *Module) checkSdkVersion(ctx android.ModuleContext) {
|
||||
if j.SocSpecific() || j.DeviceSpecific() ||
|
||||
(j.ProductSpecific() && ctx.Config().EnforceProductPartitionInterface()) {
|
||||
@@ -705,11 +663,6 @@ func (j *Module) deps(ctx android.BottomUpMutatorContext) {
|
||||
} else if j.shouldInstrumentStatic(ctx) {
|
||||
ctx.AddVariationDependencies(nil, staticLibTag, "jacocoagent")
|
||||
}
|
||||
|
||||
// services depend on com.android.location.provider, but dependency in not registered in a Blueprint file
|
||||
if ctx.ModuleName() == "services" {
|
||||
ctx.AddDependency(ctx.Module(), dexpreopt.SystemServerForcedDepTag, "com.android.location.provider")
|
||||
}
|
||||
}
|
||||
|
||||
func hasSrcExt(srcs []string, ext string) bool {
|
||||
|
Reference in New Issue
Block a user