Merge "Propagate transitive <uses-library> dependencies through static libraries."
This commit is contained in:
@@ -399,6 +399,9 @@ func aaptLibs(ctx android.ModuleContext, sdkContext sdkContext) (transitiveStati
|
||||
sharedLibs = append(sharedLibs, exportPackage)
|
||||
}
|
||||
case staticLibTag:
|
||||
if dep, ok := module.(Dependency); ok {
|
||||
sdkLibraries.AddLibraryPaths(dep.ExportedSdkLibs())
|
||||
}
|
||||
if exportPackage != nil {
|
||||
transitiveStaticLibs = append(transitiveStaticLibs, aarDep.ExportedStaticPackages()...)
|
||||
transitiveStaticLibs = append(transitiveStaticLibs, exportPackage)
|
||||
|
@@ -2526,10 +2526,24 @@ func TestUsesLibraries(t *testing.T) {
|
||||
sdk_version: "current",
|
||||
}
|
||||
|
||||
java_sdk_library {
|
||||
name: "runtime-library",
|
||||
srcs: ["a.java"],
|
||||
sdk_version: "current",
|
||||
}
|
||||
|
||||
java_library {
|
||||
name: "static-runtime-helper",
|
||||
srcs: ["a.java"],
|
||||
libs: ["runtime-library"],
|
||||
sdk_version: "current",
|
||||
}
|
||||
|
||||
android_app {
|
||||
name: "app",
|
||||
srcs: ["a.java"],
|
||||
libs: ["qux", "quuz.stubs"],
|
||||
static_libs: ["static-runtime-helper"],
|
||||
uses_libs: ["foo"],
|
||||
sdk_version: "current",
|
||||
optional_uses_libs: [
|
||||
@@ -2562,11 +2576,10 @@ func TestUsesLibraries(t *testing.T) {
|
||||
|
||||
// Test that implicit dependencies on java_sdk_library instances are passed to the manifest.
|
||||
manifestFixerArgs := app.Output("manifest_fixer/AndroidManifest.xml").Args["args"]
|
||||
if w := "--uses-library qux"; !strings.Contains(manifestFixerArgs, w) {
|
||||
t.Errorf("unexpected manifest_fixer args: wanted %q in %q", w, manifestFixerArgs)
|
||||
}
|
||||
if w := "--uses-library quuz"; !strings.Contains(manifestFixerArgs, w) {
|
||||
t.Errorf("unexpected manifest_fixer args: wanted %q in %q", w, manifestFixerArgs)
|
||||
for _, w := range []string{"qux", "quuz", "runtime-library"} {
|
||||
if !strings.Contains(manifestFixerArgs, "--uses-library "+w) {
|
||||
t.Errorf("unexpected manifest_fixer args: wanted %q in %q", w, manifestFixerArgs)
|
||||
}
|
||||
}
|
||||
|
||||
// Test that all libraries are verified
|
||||
|
Reference in New Issue
Block a user