Package dexpreopt artifacts for libcore jars in the ART apex.
This patch adds dexpreopt files for the libore part of the
bootclasspath to the ART apex.
Since this is specific to the ART apex and makes not sense for other
apexes, the patch does not add a new module property, but only a
boolean flag denoting that this is an ART apex.
Dexpreopt artifacts packaged into the ART apex differ from those that
are packaged in the system image: it inludes only the libcore part of
bootclasspath jars, but not the framework part. When the boot image
extension is implementd, dexpreopt artifacts for the libcore jars will
be removed from the system image (but for now they are both in the
apex and in the system image).
Build rules for the new set of dexpreopt artifacts are created using
a new variant of the global boot image config. Previously we had two
variants: "default" (for the system image) and "apex" (for the
JIT-zygote experiment). This patch adds the third "libcore" variant.
Test: m
Test: m com.android.art deapexer \
&& find $ANDROID_BUILD_TOP -type f -name 'com.android.art.*.apex \
| xargs deapexer | grep boot \
Expect to find dexpreopt/$ARCH/boot-art*.{art,oat,vdex} files.
Test: m art/build/apex/runtests.sh
Change-Id: I353ef90304bc5e18c3055ea379b3b223e5c38948
diff --git a/apex/apex.go b/apex/apex.go
index 629cbbf..28935f2 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -613,6 +613,7 @@
testApex bool
vndkApex bool
+ artApex bool
// intermediate path for apex_manifest.json
manifestOut android.WritablePath
@@ -1213,6 +1214,19 @@
return false
})
+ // Specific to the ART apex: dexpreopt artifacts for libcore Java libraries.
+ // Build rules are generated by the dexpreopt singleton, and here we access build artifacts
+ // via the global boot image config.
+ if a.artApex {
+ for arch, files := range java.DexpreoptedArtApexJars(ctx) {
+ dirInApex := filepath.Join("dexpreopt", arch.String())
+ for _, f := range files {
+ localModule := "dexpreopt_" + arch.String() + "_" + filepath.Base(f.String())
+ filesInfo = append(filesInfo, apexFile{f, localModule, dirInApex, etc, nil, nil})
+ }
+ }
+ }
+
if a.private_key_file == nil {
ctx.PropertyErrorf("key", "private_key for %q could not be found", String(a.properties.Key))
return
@@ -1811,9 +1825,10 @@
return module
}
-func ApexBundleFactory(testApex bool) android.Module {
+func ApexBundleFactory(testApex bool, artApex bool) android.Module {
bundle := newApexBundle()
bundle.testApex = testApex
+ bundle.artApex = artApex
return bundle
}