Merge "Propagate stub_only_libs to the invocation generating stub sources" am: 663e060c64

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2309271

Change-Id: Ia739ae43736eb5ceffd53bf7dcf36c87b4c48567
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Nikita Ioffe 2022-11-21 23:29:52 +00:00 committed by Automerger Merge Worker
commit d497e25c63
2 changed files with 27 additions and 0 deletions

View file

@ -1648,6 +1648,7 @@ func (module *SdkLibrary) createStubsSourcesAndApi(mctx android.DefaultableHookC
// shared libs and static libs. So we need to add both of these libs to Libs property.
props.Libs = module.properties.Libs
props.Libs = append(props.Libs, module.properties.Static_libs...)
props.Libs = append(props.Libs, module.sdkLibraryProperties.Stub_only_libs...)
props.Aidl.Include_dirs = module.deviceProperties.Aidl.Include_dirs
props.Aidl.Local_include_dirs = module.deviceProperties.Aidl.Local_include_dirs
props.Java_version = module.properties.Java_version

View file

@ -1385,3 +1385,29 @@ func TestSdkLibrary_CheckMinSdkVersion(t *testing.T) {
}
`)
}
func TestJavaSdkLibrary_StubOnlyLibs_PassedToDroidstubs(t *testing.T) {
result := android.GroupFixturePreparers(
prepareForJavaTest,
PrepareForTestWithJavaSdkLibraryFiles,
FixtureWithLastReleaseApis("foo"),
).RunTestWithBp(t, `
java_sdk_library {
name: "foo",
srcs: ["a.java"],
public: {
enabled: true,
},
stub_only_libs: ["bar-lib"],
}
java_library {
name: "bar-lib",
srcs: ["b.java"],
}
`)
// The foo.stubs.source should depend on bar-lib
fooStubsSources := result.ModuleForTests("foo.stubs.source", "android_common").Module().(*Droidstubs)
android.AssertStringListContains(t, "foo stubs should depend on bar-lib", fooStubsSources.Javadoc.properties.Libs, "bar-lib")
}