Merge "AndroidMk for the hostdex library has separate AndroidMkEntries"
diff --git a/cc/androidmk.go b/cc/androidmk.go
index ff181d8..c1225bc 100644
--- a/cc/androidmk.go
+++ b/cc/androidmk.go
@@ -317,6 +317,11 @@
filepath.Dir(fuzz.corpusIntermediateDir.String())+":corpus/"+d.Base())
}
+ for _, d := range fuzz.data {
+ fuzzFiles = append(fuzzFiles,
+ filepath.Dir(fuzz.dataIntermediateDir.String())+":data/"+d.Rel())
+ }
+
if fuzz.dictionary != nil {
fuzzFiles = append(fuzzFiles,
filepath.Dir(fuzz.dictionary.String())+":"+fuzz.dictionary.Base())
diff --git a/cc/fuzz.go b/cc/fuzz.go
index c2b0ff4..0d3cc74 100644
--- a/cc/fuzz.go
+++ b/cc/fuzz.go
@@ -49,6 +49,9 @@
// Optional list of seed files to be installed to the fuzz target's output
// directory.
Corpus []string `android:"path"`
+ // Optional list of data files to be installed to the fuzz target's output
+ // directory. Directory structure relative to the module is preserved.
+ Data []string `android:"path"`
// Optional dictionary to be installed to the fuzz target's output directory.
Dictionary *string `android:"path"`
// Config for running the target on fuzzing infrastructure.
@@ -81,6 +84,8 @@
corpus android.Paths
corpusIntermediateDir android.Path
config android.Path
+ data android.Paths
+ dataIntermediateDir android.Path
installedSharedDeps []string
}
@@ -210,6 +215,17 @@
builder.Build(pctx, ctx, "copy_corpus", "copy corpus")
fuzz.corpusIntermediateDir = intermediateDir
+ fuzz.data = android.PathsForModuleSrc(ctx, fuzz.Properties.Data)
+ builder = android.NewRuleBuilder()
+ intermediateDir = android.PathForModuleOut(ctx, "data")
+ for _, entry := range fuzz.data {
+ builder.Command().Text("cp").
+ Input(entry).
+ Output(intermediateDir.Join(ctx, entry.Rel()))
+ }
+ builder.Build(pctx, ctx, "copy_data", "copy data")
+ fuzz.dataIntermediateDir = intermediateDir
+
if fuzz.Properties.Dictionary != nil {
fuzz.dictionary = android.PathForModuleSrc(ctx, *fuzz.Properties.Dictionary)
if fuzz.dictionary.Ext() != ".dict" {
@@ -377,6 +393,19 @@
files = append(files, fileToZip{corpusZip, ""})
}
+ // Package the data into a zipfile.
+ if fuzzModule.data != nil {
+ dataZip := archDir.Join(ctx, module.Name()+"_data.zip")
+ command := builder.Command().BuiltTool(ctx, "soong_zip").
+ FlagWithOutput("-o ", dataZip)
+ for _, f := range fuzzModule.data {
+ intermediateDir := strings.TrimSuffix(f.String(), f.Rel())
+ command.FlagWithArg("-C ", intermediateDir)
+ command.FlagWithInput("-f ", f)
+ }
+ files = append(files, fileToZip{dataZip, ""})
+ }
+
// Find and mark all the transiently-dependent shared libraries for
// packaging.
for _, library := range sharedLibraries {
diff --git a/java/dexpreopt_bootjars.go b/java/dexpreopt_bootjars.go
index 88e3bc2..1d363c9 100644
--- a/java/dexpreopt_bootjars.go
+++ b/java/dexpreopt_bootjars.go
@@ -178,6 +178,12 @@
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
@@ -187,7 +193,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) {
+ if skipDexpreoptBootJars(ctx) || skipDexpreoptArtBootJars(ctx) {
return nil
}
return artBootImageConfig(ctx).imagesDeps
@@ -216,8 +222,10 @@
// Always create the default boot image first, to get a unique profile rule for all images.
d.defaultBootImage = buildBootImage(ctx, defaultBootImageConfig(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 !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)))
+ }
if global.GenerateApexImage {
// Create boot images for the JIT-zygote experiment.
d.otherImages = append(d.otherImages, buildBootImage(ctx, apexBootImageConfig(ctx)))
diff --git a/java/dexpreopt_bootjars_test.go b/java/dexpreopt_bootjars_test.go
index 87d5e30..29a5abe 100644
--- a/java/dexpreopt_bootjars_test.go
+++ b/java/dexpreopt_bootjars_test.go
@@ -48,7 +48,7 @@
pathCtx := android.PathContextForTesting(config, nil)
dexpreoptConfig := dexpreopt.GlobalConfigForTests(pathCtx)
- dexpreoptConfig.BootJars = []string{"foo", "bar", "baz"}
+ dexpreoptConfig.ArtApexJars = []string{"foo", "bar", "baz"}
setDexpreoptTestGlobalConfig(config, dexpreoptConfig)
ctx := testContext(bp, nil)
@@ -59,10 +59,9 @@
dexpreoptBootJars := ctx.SingletonForTests("dex_bootjars")
- bootArt := dexpreoptBootJars.Output("boot-foo.art")
+ bootArt := dexpreoptBootJars.Output("boot.art")
expectedInputs := []string{
- "dex_artjars/apex/com.android.art/javalib/arm64/boot.art",
"dex_bootjars_input/foo.jar",
"dex_bootjars_input/bar.jar",
"dex_bootjars_input/baz.jar",
@@ -83,19 +82,19 @@
expectedOutputs := []string{
"dex_bootjars/system/framework/arm64/boot.invocation",
- "dex_bootjars/system/framework/arm64/boot-foo.art",
+ "dex_bootjars/system/framework/arm64/boot.art",
"dex_bootjars/system/framework/arm64/boot-bar.art",
"dex_bootjars/system/framework/arm64/boot-baz.art",
- "dex_bootjars/system/framework/arm64/boot-foo.oat",
+ "dex_bootjars/system/framework/arm64/boot.oat",
"dex_bootjars/system/framework/arm64/boot-bar.oat",
"dex_bootjars/system/framework/arm64/boot-baz.oat",
- "dex_bootjars/system/framework/arm64/boot-foo.vdex",
+ "dex_bootjars/system/framework/arm64/boot.vdex",
"dex_bootjars/system/framework/arm64/boot-bar.vdex",
"dex_bootjars/system/framework/arm64/boot-baz.vdex",
- "dex_bootjars_unstripped/system/framework/arm64/boot-foo.oat",
+ "dex_bootjars_unstripped/system/framework/arm64/boot.oat",
"dex_bootjars_unstripped/system/framework/arm64/boot-bar.oat",
"dex_bootjars_unstripped/system/framework/arm64/boot-baz.oat",
}
diff --git a/java/dexpreopt_config.go b/java/dexpreopt_config.go
index fd1cfd4..91e0dfb 100644
--- a/java/dexpreopt_config.go
+++ b/java/dexpreopt_config.go
@@ -135,10 +135,6 @@
deviceDir := android.PathForOutput(ctx, ctx.Config().DeviceName())
artModules := global.ArtApexJars
- // In coverage builds ART boot class path jars are instrumented and have additional dependencies.
- if ctx.Config().IsEnvTrue("EMMA_INSTRUMENT_FRAMEWORK") {
- artModules = append(artModules, "jacocoagent")
- }
frameworkModules := android.RemoveListFromList(global.BootJars,
concat(artModules, getJarsFromApexJarPairs(global.UpdatableBootJars)))
@@ -166,15 +162,15 @@
}
// Framework config for the boot image extension.
- // It includes framework libraries and depends on the ART config.
+ // It includes both the Core libraries and framework.
frameworkCfg := bootImageConfig{
- extension: true,
+ extension: false,
name: frameworkBootImageName,
stem: "boot",
installSubdir: frameworkSubdir,
- modules: frameworkModules,
- dexLocations: frameworkLocations,
- dexLocationsDeps: append(artLocations, frameworkLocations...),
+ modules: concat(artModules, frameworkModules),
+ dexLocations: concat(artLocations, frameworkLocations),
+ dexLocationsDeps: concat(artLocations, frameworkLocations),
}
// Apex config for the boot image used in the JIT-zygote experiment.
@@ -230,10 +226,6 @@
c.zip = c.dir.Join(ctx, c.name+".zip")
}
- // specific to the framework config
- frameworkCfg.dexPathsDeps = append(artCfg.dexPathsDeps, frameworkCfg.dexPathsDeps...)
- frameworkCfg.imageLocations = append(artCfg.imageLocations, frameworkCfg.imageLocations...)
-
return configs
}).(map[string]*bootImageConfig)
}