Merge changes from topic "uses-libs-5"

* changes:
  Rewrite construct_context.sh in Python.
  Refactor class loader context generation.
This commit is contained in:
Ulyana Trafimovich
2020-07-02 09:06:27 +00:00
committed by Gerrit Code Review
9 changed files with 259 additions and 134 deletions

View File

@@ -1865,9 +1865,8 @@ func (u *usesLibrary) deps(ctx android.BottomUpMutatorContext, hasFrameworkLibs
// creating a cyclic dependency:
// e.g. framework-res -> org.apache.http.legacy -> ... -> framework-res.
if hasFrameworkLibs {
// dexpreopt/dexpreopt.go needs the paths to the dex jars of these libraries in case construct_context.sh needs
// to pass them to dex2oat. Add them as a dependency so we can determine the path to the dex jar of each
// library to dexpreopt.
// Dexpreopt needs paths to the dex jars of these libraries in order to construct
// class loader context for dex2oat. Add them as a dependency with a special tag.
ctx.AddVariationDependencies(nil, usesLibTag,
"org.apache.http.legacy",
"android.hidl.base-V1.0-java",

View File

@@ -2590,13 +2590,13 @@ func TestUsesLibraries(t *testing.T) {
// Test that only present libraries are preopted
cmd = app.Rule("dexpreopt").RuleParams.Command
if w := `dex_preopt_target_libraries="/system/framework/foo.jar /system/framework/bar.jar"`; !strings.Contains(cmd, w) {
if w := `--target-classpath-for-sdk any /system/framework/foo.jar:/system/framework/bar.jar`; !strings.Contains(cmd, w) {
t.Errorf("wanted %q in %q", w, cmd)
}
cmd = prebuilt.Rule("dexpreopt").RuleParams.Command
if w := `dex_preopt_target_libraries="/system/framework/foo.jar /system/framework/bar.jar"`; !strings.Contains(cmd, w) {
if w := `--target-classpath-for-sdk any /system/framework/foo.jar:/system/framework/bar.jar`; !strings.Contains(cmd, w) {
t.Errorf("wanted %q in %q", w, cmd)
}
}