Make java_library_static uninstallable by default

Static libraries are not dexed and are not installable on a
device.

Test: m -j checkbuild
Change-Id: Iea01df381e6c8cf2439fdb87200895db6aac99e2
This commit is contained in:
Colin Cross 2017-10-02 18:10:21 -07:00
parent e81315b3b8
commit a60ead85fc
2 changed files with 16 additions and 11 deletions

View File

@ -35,8 +35,8 @@ import (
func init() {
android.RegisterModuleType("java_defaults", defaultsFactory)
android.RegisterModuleType("java_library", LibraryFactory)
android.RegisterModuleType("java_library_static", LibraryFactory)
android.RegisterModuleType("java_library", LibraryFactory(true))
android.RegisterModuleType("java_library_static", LibraryFactory(false))
android.RegisterModuleType("java_library_host", LibraryHostFactory)
android.RegisterModuleType("java_binary", BinaryFactory)
android.RegisterModuleType("java_binary_host", BinaryHostFactory)
@ -605,17 +605,22 @@ func (j *Library) DepsMutator(ctx android.BottomUpMutatorContext) {
j.deps(ctx)
}
func LibraryFactory() android.Module {
module := &Library{}
func LibraryFactory(installable bool) func() android.Module {
return func() android.Module {
module := &Library{}
module.deviceProperties.Dex = true
if !installable {
module.properties.Installable = proptools.BoolPtr(false)
}
module.deviceProperties.Dex = true
module.AddProperties(
&module.Module.properties,
&module.Module.deviceProperties)
module.AddProperties(
&module.Module.properties,
&module.Module.deviceProperties)
InitJavaModule(module, android.HostAndDeviceSupported)
return module
InitJavaModule(module, android.HostAndDeviceSupported)
return module
}
}
func LibraryHostFactory() android.Module {

View File

@ -56,7 +56,7 @@ func testJava(t *testing.T, bp string) *android.TestContext {
ctx := android.NewTestArchContext()
ctx.RegisterModuleType("android_app", android.ModuleFactoryAdaptor(AndroidAppFactory))
ctx.RegisterModuleType("java_library", android.ModuleFactoryAdaptor(LibraryFactory))
ctx.RegisterModuleType("java_library", android.ModuleFactoryAdaptor(LibraryFactory(true)))
ctx.RegisterModuleType("java_library_host", android.ModuleFactoryAdaptor(LibraryHostFactory))
ctx.RegisterModuleType("java_import", android.ModuleFactoryAdaptor(ImportFactory))
ctx.RegisterModuleType("java_defaults", android.ModuleFactoryAdaptor(defaultsFactory))