java_sdk_library_import - Allow it to replace java_sdk_library

Previously a java_sdk_library_import module did not replace the
corresponding java_sdk_library module, even when it was marked as
prefer=true. That is because the java_sdk_library_import had an empty
set of sources.	However, the stubs modules that are created by the
java_sdk_library_import did override the stubs modules created by the
corresponding java_sdk_library module.

That created inconsistent behavior between the cases where only the
prebuilt is available and both source and prebuilt are available and
the prebuilt is preferred. e.g. assume a java_sdk_library/import module
called SDKLIB.

When both prebuilt and source modules are available for SDKLIB then
even if the prebuilt is preferred then any dependencies on the
SDKLIB module would use the source module.

This change fixes that inconsisteny by making the array of sources
non-empty.

Bug: 148080325
Test: m droid && TARGET_BUILD_APPS=Camera2 m
Change-Id: I25395e020393921735ada20c5492f27f1260f6c5
This commit is contained in:
Paul Duffin
2020-02-06 15:24:57 +00:00
parent 3b531e3c85
commit 0bdcb27970

View File

@@ -899,7 +899,7 @@ func sdkLibraryImportFactory() android.Module {
module.AddProperties(&module.properties)
android.InitPrebuiltModule(module, &[]string{})
android.InitPrebuiltModule(module, &[]string{""})
InitJavaModule(module, android.HostAndDeviceSupported)
android.AddLoadHook(module, func(mctx android.LoadHookContext) { module.createInternalModules(mctx) })