Export cc module types and mutators needed for JNI testing

JNI testing will need to create basic native shared library
modules, export the minimum mutators and module types for
the required dependencies of a native shared library.

Bug: 80095087
Test: cc_test.go
Change-Id: Ibe7bc88b69cb0851291cb09a4c0c6cdb421b8651
This commit is contained in:
Colin Cross 2018-10-02 22:25:58 -07:00
parent ee0bc3b290
commit e40b4eaeb0
6 changed files with 13 additions and 13 deletions

View file

@ -35,11 +35,11 @@ func init() {
android.PreDepsMutators(func(ctx android.RegisterMutatorsContext) {
ctx.BottomUp("image", imageMutator).Parallel()
ctx.BottomUp("link", linkageMutator).Parallel()
ctx.BottomUp("link", LinkageMutator).Parallel()
ctx.BottomUp("vndk", vndkMutator).Parallel()
ctx.BottomUp("ndk_api", ndkApiMutator).Parallel()
ctx.BottomUp("test_per_src", testPerSrcMutator).Parallel()
ctx.BottomUp("begin", beginMutator).Parallel()
ctx.BottomUp("begin", BeginMutator).Parallel()
})
android.PostDepsMutators(func(ctx android.RegisterMutatorsContext) {
@ -1093,7 +1093,7 @@ func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) {
}
}
func beginMutator(ctx android.BottomUpMutatorContext) {
func BeginMutator(ctx android.BottomUpMutatorContext) {
if c, ok := ctx.Module().(*Module); ok && c.Enabled() {
c.beginMutator(ctx)
}

View file

@ -56,17 +56,17 @@ func createTestContext(t *testing.T, config android.Config, bp string) *android.
ctx.RegisterModuleType("cc_library", android.ModuleFactoryAdaptor(LibraryFactory))
ctx.RegisterModuleType("cc_library_shared", android.ModuleFactoryAdaptor(LibrarySharedFactory))
ctx.RegisterModuleType("cc_library_headers", android.ModuleFactoryAdaptor(LibraryHeaderFactory))
ctx.RegisterModuleType("toolchain_library", android.ModuleFactoryAdaptor(toolchainLibraryFactory))
ctx.RegisterModuleType("toolchain_library", android.ModuleFactoryAdaptor(ToolchainLibraryFactory))
ctx.RegisterModuleType("llndk_library", android.ModuleFactoryAdaptor(llndkLibraryFactory))
ctx.RegisterModuleType("llndk_headers", android.ModuleFactoryAdaptor(llndkHeadersFactory))
ctx.RegisterModuleType("vendor_public_library", android.ModuleFactoryAdaptor(vendorPublicLibraryFactory))
ctx.RegisterModuleType("cc_object", android.ModuleFactoryAdaptor(objectFactory))
ctx.RegisterModuleType("cc_object", android.ModuleFactoryAdaptor(ObjectFactory))
ctx.RegisterModuleType("filegroup", android.ModuleFactoryAdaptor(android.FileGroupFactory))
ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) {
ctx.BottomUp("image", imageMutator).Parallel()
ctx.BottomUp("link", linkageMutator).Parallel()
ctx.BottomUp("link", LinkageMutator).Parallel()
ctx.BottomUp("vndk", vndkMutator).Parallel()
ctx.BottomUp("begin", beginMutator).Parallel()
ctx.BottomUp("begin", BeginMutator).Parallel()
})
ctx.Register()

View file

@ -821,7 +821,7 @@ func reuseStaticLibrary(mctx android.BottomUpMutatorContext, static, shared *Mod
}
}
func linkageMutator(mctx android.BottomUpMutatorContext) {
func LinkageMutator(mctx android.BottomUpMutatorContext) {
if m, ok := mctx.Module().(*Module); ok && m.linker != nil {
if library, ok := m.linker.(libraryInterface); ok {
var modules []blueprint.Module

View file

@ -61,7 +61,7 @@ var (
// These libraries have migrated over to the new ndk_library, which is added
// as a variation dependency via depsMutator.
ndkMigratedLibs = []string{}
ndkMigratedLibsLock sync.Mutex // protects ndkMigratedLibs writes during parallel beginMutator
ndkMigratedLibsLock sync.Mutex // protects ndkMigratedLibs writes during parallel BeginMutator
)
// Creates a stub shared library based on the provided version file.

View file

@ -25,7 +25,7 @@ import (
//
func init() {
android.RegisterModuleType("cc_object", objectFactory)
android.RegisterModuleType("cc_object", ObjectFactory)
}
type objectLinker struct {
@ -33,7 +33,7 @@ type objectLinker struct {
Properties ObjectLinkerProperties
}
func objectFactory() android.Module {
func ObjectFactory() android.Module {
module := newBaseModule(android.HostAndDeviceSupported, android.MultilibBoth)
module.linker = &objectLinker{
baseLinker: NewBaseLinker(nil),

View file

@ -23,7 +23,7 @@ import (
//
func init() {
android.RegisterModuleType("toolchain_library", toolchainLibraryFactory)
android.RegisterModuleType("toolchain_library", ToolchainLibraryFactory)
}
type toolchainLibraryProperties struct {
@ -48,7 +48,7 @@ func (library *toolchainLibraryDecorator) linkerProps() []interface{} {
return append(props, &library.Properties)
}
func toolchainLibraryFactory() android.Module {
func ToolchainLibraryFactory() android.Module {
module, library := NewLibrary(android.HostAndDeviceSupported)
library.BuildOnlyStatic()
toolchainLibrary := &toolchainLibraryDecorator{