Merge "make ApexProperties defaultable" am: c5c4d18db0
am: 53b46ff2e9
Change-Id: Ib1250269cd7dc829798daee1d3b4c3233e538f72
This commit is contained in:
@@ -115,6 +115,9 @@ func testApexContext(t *testing.T, bp string, handlers ...testCustomizer) (*andr
|
|||||||
ctx.RegisterModuleType("cc_prebuilt_library_static", android.ModuleFactoryAdaptor(cc.PrebuiltStaticLibraryFactory))
|
ctx.RegisterModuleType("cc_prebuilt_library_static", android.ModuleFactoryAdaptor(cc.PrebuiltStaticLibraryFactory))
|
||||||
ctx.RegisterModuleType("cc_binary", android.ModuleFactoryAdaptor(cc.BinaryFactory))
|
ctx.RegisterModuleType("cc_binary", android.ModuleFactoryAdaptor(cc.BinaryFactory))
|
||||||
ctx.RegisterModuleType("cc_object", android.ModuleFactoryAdaptor(cc.ObjectFactory))
|
ctx.RegisterModuleType("cc_object", android.ModuleFactoryAdaptor(cc.ObjectFactory))
|
||||||
|
ctx.RegisterModuleType("cc_defaults", android.ModuleFactoryAdaptor(func() android.Module {
|
||||||
|
return cc.DefaultsFactory()
|
||||||
|
}))
|
||||||
ctx.RegisterModuleType("cc_test", android.ModuleFactoryAdaptor(cc.TestFactory))
|
ctx.RegisterModuleType("cc_test", android.ModuleFactoryAdaptor(cc.TestFactory))
|
||||||
ctx.RegisterModuleType("llndk_library", android.ModuleFactoryAdaptor(cc.LlndkLibraryFactory))
|
ctx.RegisterModuleType("llndk_library", android.ModuleFactoryAdaptor(cc.LlndkLibraryFactory))
|
||||||
ctx.RegisterModuleType("vndk_prebuilt_shared", android.ModuleFactoryAdaptor(cc.VndkPrebuiltSharedFactory))
|
ctx.RegisterModuleType("vndk_prebuilt_shared", android.ModuleFactoryAdaptor(cc.VndkPrebuiltSharedFactory))
|
||||||
@@ -2586,6 +2589,40 @@ func TestApexWithAppImports(t *testing.T) {
|
|||||||
ensureContains(t, copyCmds, "image.apex/priv-app/AppFooPrivPrebuilt/AppFooPrivPrebuilt.apk")
|
ensureContains(t, copyCmds, "image.apex/priv-app/AppFooPrivPrebuilt/AppFooPrivPrebuilt.apk")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestApexPropertiesShouldBeDefaultable(t *testing.T) {
|
||||||
|
// libfoo's apex_available comes from cc_defaults
|
||||||
|
testApexError(t, `"myapex" .*: requires "libfoo" that is not available for the APEX`, `
|
||||||
|
apex {
|
||||||
|
name: "myapex",
|
||||||
|
key: "myapex.key",
|
||||||
|
native_shared_libs: ["libfoo"],
|
||||||
|
}
|
||||||
|
|
||||||
|
apex_key {
|
||||||
|
name: "myapex.key",
|
||||||
|
public_key: "testkey.avbpubkey",
|
||||||
|
private_key: "testkey.pem",
|
||||||
|
}
|
||||||
|
|
||||||
|
apex {
|
||||||
|
name: "otherapex",
|
||||||
|
key: "myapex.key",
|
||||||
|
native_shared_libs: ["libfoo"],
|
||||||
|
}
|
||||||
|
|
||||||
|
cc_defaults {
|
||||||
|
name: "libfoo-defaults",
|
||||||
|
apex_available: ["otherapex"],
|
||||||
|
}
|
||||||
|
|
||||||
|
cc_library {
|
||||||
|
name: "libfoo",
|
||||||
|
defaults: ["libfoo-defaults"],
|
||||||
|
stl: "none",
|
||||||
|
system_shared_libs: [],
|
||||||
|
}`)
|
||||||
|
}
|
||||||
|
|
||||||
func TestApexAvailable(t *testing.T) {
|
func TestApexAvailable(t *testing.T) {
|
||||||
// libfoo is not available to myapex, but only to otherapex
|
// libfoo is not available to myapex, but only to otherapex
|
||||||
testApexError(t, "requires \"libfoo\" that is not available for the APEX", `
|
testApexError(t, "requires \"libfoo\" that is not available for the APEX", `
|
||||||
|
6
cc/cc.go
6
cc/cc.go
@@ -719,11 +719,9 @@ func (c *Module) Init() android.Module {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
android.InitAndroidArchModule(c, c.hod, c.multilib)
|
android.InitAndroidArchModule(c, c.hod, c.multilib)
|
||||||
|
|
||||||
android.InitDefaultableModule(c)
|
|
||||||
|
|
||||||
android.InitApexModule(c)
|
android.InitApexModule(c)
|
||||||
android.InitSdkAwareModule(c)
|
android.InitSdkAwareModule(c)
|
||||||
|
android.InitDefaultableModule(c)
|
||||||
|
|
||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
@@ -2469,10 +2467,10 @@ func DefaultsFactory(props ...interface{}) android.Module {
|
|||||||
&PgoProperties{},
|
&PgoProperties{},
|
||||||
&XomProperties{},
|
&XomProperties{},
|
||||||
&android.ProtoProperties{},
|
&android.ProtoProperties{},
|
||||||
|
&android.ApexProperties{},
|
||||||
)
|
)
|
||||||
|
|
||||||
android.InitDefaultsModule(module)
|
android.InitDefaultsModule(module)
|
||||||
android.InitApexModule(module)
|
|
||||||
|
|
||||||
return module
|
return module
|
||||||
}
|
}
|
||||||
|
12
java/java.go
12
java/java.go
@@ -1684,9 +1684,9 @@ func LibraryFactory() android.Module {
|
|||||||
&module.Module.dexpreoptProperties,
|
&module.Module.dexpreoptProperties,
|
||||||
&module.Module.protoProperties)
|
&module.Module.protoProperties)
|
||||||
|
|
||||||
InitJavaModule(module, android.HostAndDeviceSupported)
|
|
||||||
android.InitApexModule(module)
|
android.InitApexModule(module)
|
||||||
android.InitSdkAwareModule(module)
|
android.InitSdkAwareModule(module)
|
||||||
|
InitJavaModule(module, android.HostAndDeviceSupported)
|
||||||
return module
|
return module
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1708,8 +1708,8 @@ func LibraryHostFactory() android.Module {
|
|||||||
|
|
||||||
module.Module.properties.Installable = proptools.BoolPtr(true)
|
module.Module.properties.Installable = proptools.BoolPtr(true)
|
||||||
|
|
||||||
InitJavaModule(module, android.HostSupported)
|
|
||||||
android.InitApexModule(module)
|
android.InitApexModule(module)
|
||||||
|
InitJavaModule(module, android.HostSupported)
|
||||||
return module
|
return module
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2135,9 +2135,9 @@ func ImportFactory() android.Module {
|
|||||||
module.AddProperties(&module.properties)
|
module.AddProperties(&module.properties)
|
||||||
|
|
||||||
android.InitPrebuiltModule(module, &module.properties.Jars)
|
android.InitPrebuiltModule(module, &module.properties.Jars)
|
||||||
InitJavaModule(module, android.HostAndDeviceSupported)
|
|
||||||
android.InitApexModule(module)
|
android.InitApexModule(module)
|
||||||
android.InitSdkAwareModule(module)
|
android.InitSdkAwareModule(module)
|
||||||
|
InitJavaModule(module, android.HostAndDeviceSupported)
|
||||||
return module
|
return module
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2152,8 +2152,8 @@ func ImportFactoryHost() android.Module {
|
|||||||
module.AddProperties(&module.properties)
|
module.AddProperties(&module.properties)
|
||||||
|
|
||||||
android.InitPrebuiltModule(module, &module.properties.Jars)
|
android.InitPrebuiltModule(module, &module.properties.Jars)
|
||||||
InitJavaModule(module, android.HostSupported)
|
|
||||||
android.InitApexModule(module)
|
android.InitApexModule(module)
|
||||||
|
InitJavaModule(module, android.HostSupported)
|
||||||
return module
|
return module
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2264,8 +2264,8 @@ func DexImportFactory() android.Module {
|
|||||||
module.AddProperties(&module.properties)
|
module.AddProperties(&module.properties)
|
||||||
|
|
||||||
android.InitPrebuiltModule(module, &module.properties.Jars)
|
android.InitPrebuiltModule(module, &module.properties.Jars)
|
||||||
InitJavaModule(module, android.DeviceSupported)
|
|
||||||
android.InitApexModule(module)
|
android.InitApexModule(module)
|
||||||
|
InitJavaModule(module, android.DeviceSupported)
|
||||||
return module
|
return module
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2331,10 +2331,10 @@ func DefaultsFactory(props ...interface{}) android.Module {
|
|||||||
&AARImportProperties{},
|
&AARImportProperties{},
|
||||||
&sdkLibraryProperties{},
|
&sdkLibraryProperties{},
|
||||||
&DexImportProperties{},
|
&DexImportProperties{},
|
||||||
|
&android.ApexProperties{},
|
||||||
)
|
)
|
||||||
|
|
||||||
android.InitDefaultsModule(module)
|
android.InitDefaultsModule(module)
|
||||||
android.InitApexModule(module)
|
|
||||||
return module
|
return module
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user