Merge changes from topic "uses-libs-24"

* changes:
  Fail the build if dexpreopt cannot find path to a <uses-library>.
  Add dependency on implementation <uses-library> for modules that depend on component libraries.
This commit is contained in:
Ulyana Trafimovich
2020-10-07 09:18:02 +00:00
committed by Gerrit Code Review
4 changed files with 37 additions and 35 deletions

View File

@@ -2754,19 +2754,6 @@ func TestUsesLibraries(t *testing.T) {
android_app {
name: "app",
srcs: ["a.java"],
libs: ["qux", "quuz"],
static_libs: ["static-runtime-helper"],
uses_libs: ["foo"],
sdk_version: "current",
optional_uses_libs: [
"bar",
"baz",
],
}
android_app {
name: "app_with_stub_deps",
srcs: ["a.java"],
libs: ["qux", "quuz.stubs"],
static_libs: ["static-runtime-helper"],
uses_libs: ["foo"],
@@ -2797,7 +2784,6 @@ func TestUsesLibraries(t *testing.T) {
run(t, ctx, config)
app := ctx.ModuleForTests("app", "android_common")
appWithStubDeps := ctx.ModuleForTests("app_with_stub_deps", "android_common")
prebuilt := ctx.ModuleForTests("prebuilt", "android_common")
// Test that implicit dependencies on java_sdk_library instances are passed to the manifest.
@@ -2828,7 +2814,7 @@ func TestUsesLibraries(t *testing.T) {
t.Errorf("wanted %q in %q", w, cmd)
}
// Test that all present libraries are preopted, including implicit SDK dependencies
// Test that all present libraries are preopted, including implicit SDK dependencies, possibly stubs
cmd = app.Rule("dexpreopt").RuleParams.Command
w := `--target-classpath-for-sdk any` +
` /system/framework/foo.jar` +
@@ -2840,11 +2826,6 @@ func TestUsesLibraries(t *testing.T) {
t.Errorf("wanted %q in %q", w, cmd)
}
// TODO(skvadrik) fix dexpreopt for stub libraries for which the implementation is present
if appWithStubDeps.MaybeRule("dexpreopt").RuleParams.Command != "" {
t.Errorf("dexpreopt should be disabled for apps with dependencies on stub libraries")
}
cmd = prebuilt.Rule("dexpreopt").RuleParams.Command
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)