Merge "Default droiddoc to disting the api txt if there is one" into rvc-dev
diff --git a/android/module.go b/android/module.go
index fd3fec3..665a30f 100644
--- a/android/module.go
+++ b/android/module.go
@@ -1281,7 +1281,7 @@
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)
+ b.bp.OtherModuleErrorf(m, fmt, args...)
}
func (b *baseModuleContext) OtherModuleDependencyTag(m blueprint.Module) blueprint.DependencyTag {
return b.bp.OtherModuleDependencyTag(m)
diff --git a/cc/config/global.go b/cc/config/global.go
index d01dd84..29020ab 100644
--- a/cc/config/global.go
+++ b/cc/config/global.go
@@ -127,8 +127,8 @@
// prebuilts/clang default settings.
ClangDefaultBase = "prebuilts/clang/host"
- ClangDefaultVersion = "clang-r377782b"
- ClangDefaultShortVersion = "10.0.4"
+ ClangDefaultVersion = "clang-r377782c"
+ ClangDefaultShortVersion = "10.0.5"
// Directories with warnings from Android.bp files.
WarningAllowedProjects = []string{
diff --git a/dexpreopt/dexpreopt.go b/dexpreopt/dexpreopt.go
index 6cb9873..02e54b3 100644
--- a/dexpreopt/dexpreopt.go
+++ b/dexpreopt/dexpreopt.go
@@ -41,21 +41,12 @@
"android/soong/android"
- "github.com/google/blueprint"
"github.com/google/blueprint/pathtools"
)
const SystemPartition = "/system/"
const SystemOtherPartition = "/system_other/"
-type dependencyTag struct {
- blueprint.BaseDependencyTag
- name string
-}
-
-var SystemServerDepTag = dependencyTag{name: "system-server-dep"}
-var SystemServerForcedDepTag = dependencyTag{name: "system-server-forced-dep"}
-
// GenerateDexpreoptRule generates a set of commands that will preopt a module based on a GlobalConfig and a
// ModuleConfig. The produced files and their install locations will be available through rule.Installs().
func GenerateDexpreoptRule(ctx android.PathContext, globalSoong *GlobalSoongConfig,
@@ -116,13 +107,6 @@
}
}
- // Don't preopt system server jars that are not Soong modules.
- if android.InList(module.Name, NonUpdatableSystemServerJars(ctx, global)) {
- if _, ok := ctx.(android.ModuleContext); !ok {
- return true
- }
- }
-
// If OnlyPreoptBootImageAndSystemServer=true and module is not in boot class path skip
// Also preopt system server jars since selinux prevents system server from loading anything from
// /data. If we don't do this they will need to be extracted which is not favorable for RAM usage
@@ -239,6 +223,8 @@
invocationPath := odexPath.ReplaceExtension(ctx, "invocation")
+ systemServerJars := NonUpdatableSystemServerJars(ctx, global)
+
// The class loader context using paths in the build
var classLoaderContextHost android.Paths
@@ -253,8 +239,8 @@
var conditionalClassLoaderContextHost29 android.Paths
var conditionalClassLoaderContextTarget29 []string
- var classLoaderContextHostString, classLoaderContextDeviceString string
- var classLoaderDeps android.Paths
+ // A flag indicating if the '&' class loader context is used.
+ unknownClassLoaderContext := false
if module.EnforceUsesLibraries {
usesLibs := append(copyOf(module.UsesLibraries), module.PresentOptionalUsesLibraries...)
@@ -298,49 +284,38 @@
pathForLibrary(module, hidlBase))
conditionalClassLoaderContextTarget29 = append(conditionalClassLoaderContextTarget29,
filepath.Join("/system/framework", hidlBase+".jar"))
-
- classLoaderContextHostString = strings.Join(classLoaderContextHost.Strings(), ":")
- } else if android.InList(module.Name, NonUpdatableSystemServerJars(ctx, global)) {
- // We expect that all dexpreopted system server jars are Soong modules.
- mctx, isModule := ctx.(android.ModuleContext)
- if !isModule {
- panic("Cannot dexpreopt system server jar that is not a soong module.")
+ } else if jarIndex := android.IndexList(module.Name, systemServerJars); jarIndex >= 0 {
+ // System server jars should be dexpreopted together: class loader context of each jar
+ // should include all preceding jars on the system server classpath.
+ for _, otherJar := range systemServerJars[:jarIndex] {
+ classLoaderContextHost = append(classLoaderContextHost, SystemServerDexJarHostPath(ctx, otherJar))
+ classLoaderContextTarget = append(classLoaderContextTarget, "/system/framework/"+otherJar+".jar")
}
- // System server jars should be dexpreopted together: class loader context of each jar
- // should include preceding jars (which can be found as dependencies of the current jar
- // with a special tag).
- var jarsOnHost android.Paths
- var jarsOnDevice []string
- mctx.VisitDirectDepsWithTag(SystemServerDepTag, func(dep android.Module) {
- depName := mctx.OtherModuleName(dep)
- if jar, ok := dep.(interface{ DexJar() android.Path }); ok {
- jarsOnHost = append(jarsOnHost, jar.DexJar())
- jarsOnDevice = append(jarsOnDevice, "/system/framework/"+depName+".jar")
- } else {
- mctx.ModuleErrorf("module \"%s\" is not a jar", depName)
- }
- })
- classLoaderContextHostString = strings.Join(jarsOnHost.Strings(), ":")
- classLoaderContextDeviceString = strings.Join(jarsOnDevice, ":")
- classLoaderDeps = jarsOnHost
+ // Copy the system server jar to a predefined location where dex2oat will find it.
+ dexPathHost := SystemServerDexJarHostPath(ctx, module.Name)
+ rule.Command().Text("mkdir -p").Flag(filepath.Dir(dexPathHost.String()))
+ rule.Command().Text("cp -f").Input(module.DexPath).Output(dexPathHost)
} else {
// Pass special class loader context to skip the classpath and collision check.
// This will get removed once LOCAL_USES_LIBRARIES is enforced.
// Right now LOCAL_USES_LIBRARIES is opt in, for the case where it's not specified we still default
// to the &.
- classLoaderContextHostString = `\&`
+ unknownClassLoaderContext = true
}
rule.Command().FlagWithArg("mkdir -p ", filepath.Dir(odexPath.String()))
rule.Command().FlagWithOutput("rm -f ", odexPath)
// Set values in the environment of the rule. These may be modified by construct_context.sh.
- if classLoaderContextHostString == `\&` {
- rule.Command().Text(`class_loader_context_arg=--class-loader-context=\&`)
- rule.Command().Text(`stored_class_loader_context_arg=""`)
+ if unknownClassLoaderContext {
+ rule.Command().
+ Text(`class_loader_context_arg=--class-loader-context=\&`).
+ Text(`stored_class_loader_context_arg=""`)
} else {
- rule.Command().Text("class_loader_context_arg=--class-loader-context=PCL[" + classLoaderContextHostString + "]")
- rule.Command().Text("stored_class_loader_context_arg=--stored-class-loader-context=PCL[" + classLoaderContextDeviceString + "]")
+ rule.Command().
+ Text("class_loader_context_arg=--class-loader-context=PCL[" + strings.Join(classLoaderContextHost.Strings(), ":") + "]").
+ Implicits(classLoaderContextHost).
+ Text("stored_class_loader_context_arg=--stored-class-loader-context=PCL[" + strings.Join(classLoaderContextTarget, ":") + "]")
}
if module.EnforceUsesLibraries {
@@ -395,7 +370,7 @@
Flag("--runtime-arg").FlagWithInputList("-Xbootclasspath:", module.PreoptBootClassPathDexFiles, ":").
Flag("--runtime-arg").FlagWithList("-Xbootclasspath-locations:", module.PreoptBootClassPathDexLocations, ":").
Flag("${class_loader_context_arg}").
- Flag("${stored_class_loader_context_arg}").Implicits(classLoaderDeps).
+ Flag("${stored_class_loader_context_arg}").
FlagWithArg("--boot-image=", strings.Join(module.DexPreoptImageLocations, ":")).Implicits(module.DexPreoptImagesDeps[archIdx].Paths()).
FlagWithInput("--dex-file=", module.DexPath).
FlagWithArg("--dex-location=", dexLocationArg).
@@ -609,6 +584,14 @@
}).([]string)
}
+// A predefined location for the system server dex jars. This is needed in order to generate
+// class loader context for dex2oat, as the path to the jar in the Soong module may be unknown
+// at that time (Soong processes the jars in dependency order, which may be different from the
+// the system server classpath order).
+func SystemServerDexJarHostPath(ctx android.PathContext, jar string) android.OutputPath {
+ return android.PathForOutput(ctx, ctx.Config().BuildDir(), "system_server_dexjars", jar+".jar")
+}
+
func contains(l []string, s string) bool {
for _, e := range l {
if e == s {
diff --git a/java/dexpreopt_config.go b/java/dexpreopt_config.go
index 28f56d2..5d74b21 100644
--- a/java/dexpreopt_config.go
+++ b/java/dexpreopt_config.go
@@ -30,9 +30,9 @@
return ctx.Config().OnceStringSlice(systemServerClasspathKey, func() []string {
global := dexpreopt.GetGlobalConfig(ctx)
var systemServerClasspathLocations []string
- var dexpreoptJars = *DexpreoptedSystemServerJars(ctx.Config())
- // 1) The jars that are dexpreopted.
- for _, m := range dexpreoptJars {
+ nonUpdatable := dexpreopt.NonUpdatableSystemServerJars(ctx, global)
+ // 1) Non-updatable jars.
+ for _, m := range nonUpdatable {
systemServerClasspathLocations = append(systemServerClasspathLocations,
filepath.Join("/system/framework", m+".jar"))
}
@@ -41,13 +41,6 @@
systemServerClasspathLocations = append(systemServerClasspathLocations,
dexpreopt.GetJarLocationFromApexJarPair(m))
}
- // 3) The jars from make (which are not updatable, not preopted).
- for _, m := range dexpreopt.NonUpdatableSystemServerJars(ctx, global) {
- if !android.InList(m, dexpreoptJars) {
- systemServerClasspathLocations = append(systemServerClasspathLocations,
- filepath.Join("/system/framework", m+".jar"))
- }
- }
if len(systemServerClasspathLocations) != len(global.SystemServerJars)+len(global.UpdatableSystemServerJars) {
panic(fmt.Errorf("Wrong number of system server jars, got %d, expected %d",
len(systemServerClasspathLocations),
diff --git a/java/droiddoc.go b/java/droiddoc.go
index fd4b90d..70d997a 100644
--- a/java/droiddoc.go
+++ b/java/droiddoc.go
@@ -1344,6 +1344,7 @@
cmd.FlagWithArg("--doc-stubs ", stubsDir.String())
} else {
cmd.FlagWithArg("--stubs ", stubsDir.String())
+ cmd.Flag("--exclude-documentation-from-stubs")
}
}
diff --git a/java/hiddenapi.go b/java/hiddenapi.go
index 8f34714..884a757 100644
--- a/java/hiddenapi.go
+++ b/java/hiddenapi.go
@@ -28,9 +28,10 @@
}, "outFlag", "stubAPIFlags")
type hiddenAPI struct {
- flagsCSVPath android.Path
- metadataCSVPath android.Path
bootDexJarPath android.Path
+ flagsCSVPath android.Path
+ indexCSVPath android.Path
+ metadataCSVPath android.Path
}
func (h *hiddenAPI) flagsCSV() android.Path {
@@ -45,17 +46,21 @@
return h.bootDexJarPath
}
+func (h *hiddenAPI) indexCSV() android.Path {
+ return h.indexCSVPath
+}
+
type hiddenAPIIntf interface {
- flagsCSV() android.Path
- metadataCSV() android.Path
bootDexJar() android.Path
+ flagsCSV() android.Path
+ indexCSV() android.Path
+ metadataCSV() android.Path
}
var _ hiddenAPIIntf = (*hiddenAPI)(nil)
-func (h *hiddenAPI) hiddenAPI(ctx android.ModuleContext, dexJar android.ModuleOutPath, implementationJar android.Path,
- uncompressDex bool) android.ModuleOutPath {
-
+func (h *hiddenAPI) hiddenAPI(ctx android.ModuleContext, dexJar android.ModuleOutPath,
+ implementationJar android.Path, uncompressDex bool) android.ModuleOutPath {
if !ctx.Config().IsEnvTrue("UNSAFE_DISABLE_HIDDENAPI_FLAGS") {
name := ctx.ModuleName()
@@ -77,9 +82,8 @@
// Derive the greylist from classes jar.
flagsCSV := android.PathForModuleOut(ctx, "hiddenapi", "flags.csv")
metadataCSV := android.PathForModuleOut(ctx, "hiddenapi", "metadata.csv")
- hiddenAPIGenerateCSV(ctx, flagsCSV, metadataCSV, implementationJar)
- h.flagsCSVPath = flagsCSV
- h.metadataCSVPath = metadataCSV
+ indexCSV := android.PathForModuleOut(ctx, "hiddenapi", "index.csv")
+ h.hiddenAPIGenerateCSV(ctx, flagsCSV, metadataCSV, indexCSV, implementationJar)
// If this module is actually on the boot jars list and not providing
// hiddenapi information for a module on the boot jars list then encode
@@ -96,9 +100,7 @@
return dexJar
}
-func hiddenAPIGenerateCSV(ctx android.ModuleContext, flagsCSV, metadataCSV android.WritablePath,
- classesJar android.Path) {
-
+func (h *hiddenAPI) hiddenAPIGenerateCSV(ctx android.ModuleContext, flagsCSV, metadataCSV, indexCSV android.WritablePath, classesJar android.Path) {
stubFlagsCSV := hiddenAPISingletonPaths(ctx).stubFlags
ctx.Build(pctx, android.BuildParams{
@@ -112,6 +114,7 @@
"stubAPIFlags": stubFlagsCSV.String(),
},
})
+ h.flagsCSVPath = flagsCSV
ctx.Build(pctx, android.BuildParams{
Rule: hiddenAPIGenerateCSVRule,
@@ -124,18 +127,26 @@
"stubAPIFlags": stubFlagsCSV.String(),
},
})
+ h.metadataCSVPath = metadataCSV
+ rule := android.NewRuleBuilder()
+ rule.Command().
+ BuiltTool(ctx, "merge_csv").
+ FlagWithInput("--zip_input=", classesJar).
+ FlagWithOutput("--output=", indexCSV)
+ rule.Build(pctx, ctx, "merged-hiddenapi-index", "Merged Hidden API index")
+ h.indexCSVPath = indexCSV
}
var hiddenAPIEncodeDexRule = pctx.AndroidStaticRule("hiddenAPIEncodeDex", blueprint.RuleParams{
- Command: `rm -rf $tmpDir && mkdir -p $tmpDir && mkdir $tmpDir/dex-input && mkdir $tmpDir/dex-output && ` +
- `unzip -o -q $in 'classes*.dex' -d $tmpDir/dex-input && ` +
- `for INPUT_DEX in $$(find $tmpDir/dex-input -maxdepth 1 -name 'classes*.dex' | sort); do ` +
- ` echo "--input-dex=$${INPUT_DEX}"; ` +
- ` echo "--output-dex=$tmpDir/dex-output/$$(basename $${INPUT_DEX})"; ` +
- `done | xargs ${config.HiddenAPI} encode --api-flags=$flagsCsv $hiddenapiFlags && ` +
- `${config.SoongZipCmd} $soongZipFlags -o $tmpDir/dex.jar -C $tmpDir/dex-output -f "$tmpDir/dex-output/classes*.dex" && ` +
- `${config.MergeZipsCmd} -D -zipToNotStrip $tmpDir/dex.jar -stripFile "classes*.dex" $out $tmpDir/dex.jar $in`,
+ Command: `rm -rf $tmpDir && mkdir -p $tmpDir && mkdir $tmpDir/dex-input && mkdir $tmpDir/dex-output &&
+ unzip -o -q $in 'classes*.dex' -d $tmpDir/dex-input &&
+ for INPUT_DEX in $$(find $tmpDir/dex-input -maxdepth 1 -name 'classes*.dex' | sort); do
+ echo "--input-dex=$${INPUT_DEX}";
+ echo "--output-dex=$tmpDir/dex-output/$$(basename $${INPUT_DEX})";
+ done | xargs ${config.HiddenAPI} encode --api-flags=$flagsCsv $hiddenapiFlags &&
+ ${config.SoongZipCmd} $soongZipFlags -o $tmpDir/dex.jar -C $tmpDir/dex-output -f "$tmpDir/dex-output/classes*.dex" &&
+ ${config.MergeZipsCmd} -D -zipToNotStrip $tmpDir/dex.jar -stripFile "classes*.dex" -stripFile "**/*.uau" $out $tmpDir/dex.jar $in`,
CommandDeps: []string{
"${config.HiddenAPI}",
"${config.SoongZipCmd}",
diff --git a/java/hiddenapi_singleton.go b/java/hiddenapi_singleton.go
index 7850193..7e7e955 100644
--- a/java/hiddenapi_singleton.go
+++ b/java/hiddenapi_singleton.go
@@ -22,13 +22,15 @@
func init() {
android.RegisterSingletonType("hiddenapi", hiddenAPISingletonFactory)
+ android.RegisterSingletonType("hiddenapi_index", hiddenAPIIndexSingletonFactory)
android.RegisterModuleType("hiddenapi_flags", hiddenAPIFlagsFactory)
}
type hiddenAPISingletonPathsStruct struct {
- stubFlags android.OutputPath
flags android.OutputPath
+ index android.OutputPath
metadata android.OutputPath
+ stubFlags android.OutputPath
}
var hiddenAPISingletonPathsKey = android.NewOnceKey("hiddenAPISingletonPathsKey")
@@ -39,9 +41,10 @@
func hiddenAPISingletonPaths(ctx android.PathContext) hiddenAPISingletonPathsStruct {
return ctx.Config().Once(hiddenAPISingletonPathsKey, func() interface{} {
return hiddenAPISingletonPathsStruct{
- stubFlags: android.PathForOutput(ctx, "hiddenapi", "hiddenapi-stub-flags.txt"),
flags: android.PathForOutput(ctx, "hiddenapi", "hiddenapi-flags.csv"),
+ index: android.PathForOutput(ctx, "hiddenapi", "hiddenapi-index.csv"),
metadata: android.PathForOutput(ctx, "hiddenapi", "hiddenapi-greylist.csv"),
+ stubFlags: android.PathForOutput(ctx, "hiddenapi", "hiddenapi-stub-flags.txt"),
}
}).(hiddenAPISingletonPathsStruct)
}
@@ -364,3 +367,45 @@
android.InitAndroidArchModule(module, android.HostAndDeviceSupported, android.MultilibCommon)
return module
}
+
+func hiddenAPIIndexSingletonFactory() android.Singleton {
+ return &hiddenAPIIndexSingleton{}
+}
+
+type hiddenAPIIndexSingleton struct {
+ index android.Path
+}
+
+func (h *hiddenAPIIndexSingleton) GenerateBuildActions(ctx android.SingletonContext) {
+ // Don't run any hiddenapi rules if UNSAFE_DISABLE_HIDDENAPI_FLAGS=true
+ if ctx.Config().IsEnvTrue("UNSAFE_DISABLE_HIDDENAPI_FLAGS") {
+ return
+ }
+
+ indexes := android.Paths{}
+ ctx.VisitAllModules(func(module android.Module) {
+ if h, ok := module.(hiddenAPIIntf); ok {
+ if h.indexCSV() != nil {
+ indexes = append(indexes, h.indexCSV())
+ }
+ }
+ })
+
+ rule := android.NewRuleBuilder()
+ rule.Command().
+ BuiltTool(ctx, "merge_csv").
+ FlagWithArg("--header=", "signature,file,startline,startcol,endline,endcol,properties").
+ FlagWithOutput("--output=", hiddenAPISingletonPaths(ctx).index).
+ Inputs(indexes)
+ rule.Build(pctx, ctx, "singleton-merged-hiddenapi-index", "Singleton merged Hidden API index")
+
+ h.index = hiddenAPISingletonPaths(ctx).index
+}
+
+func (h *hiddenAPIIndexSingleton) MakeVars(ctx android.MakeVarsContext) {
+ if ctx.Config().IsEnvTrue("UNSAFE_DISABLE_HIDDENAPI_FLAGS") {
+ return
+ }
+
+ ctx.Strict("INTERNAL_PLATFORM_HIDDENAPI_INDEX", h.index.String())
+}
diff --git a/java/java.go b/java/java.go
index c73efa4..46adedc 100644
--- a/java/java.go
+++ b/java/java.go
@@ -23,14 +23,12 @@
"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 @@
PropertyName: "java_tests",
},
})
-
- android.PostDepsMutators(RegisterPostDepsMutators)
}
func RegisterJavaBuildComponents(ctx android.RegistrationContext) {
@@ -84,44 +80,6 @@
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 @@
} 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 {
diff --git a/ui/build/cleanbuild.go b/ui/build/cleanbuild.go
index 36d4f04..95d049a 100644
--- a/ui/build/cleanbuild.go
+++ b/ui/build/cleanbuild.go
@@ -111,6 +111,9 @@
productOut("obj/PACKAGING"),
productOut("ramdisk"),
productOut("debug_ramdisk"),
+ productOut("vendor-ramdisk"),
+ productOut("vendor-ramdisk-debug.cpio.gz"),
+ productOut("vendor_debug_ramdisk"),
productOut("test_harness_ramdisk"),
productOut("recovery"),
productOut("root"),