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:
6
cc/cc.go
6
cc/cc.go
@@ -35,11 +35,11 @@ func init() {
|
|||||||
|
|
||||||
android.PreDepsMutators(func(ctx android.RegisterMutatorsContext) {
|
android.PreDepsMutators(func(ctx android.RegisterMutatorsContext) {
|
||||||
ctx.BottomUp("image", imageMutator).Parallel()
|
ctx.BottomUp("image", imageMutator).Parallel()
|
||||||
ctx.BottomUp("link", linkageMutator).Parallel()
|
ctx.BottomUp("link", LinkageMutator).Parallel()
|
||||||
ctx.BottomUp("vndk", vndkMutator).Parallel()
|
ctx.BottomUp("vndk", vndkMutator).Parallel()
|
||||||
ctx.BottomUp("ndk_api", ndkApiMutator).Parallel()
|
ctx.BottomUp("ndk_api", ndkApiMutator).Parallel()
|
||||||
ctx.BottomUp("test_per_src", testPerSrcMutator).Parallel()
|
ctx.BottomUp("test_per_src", testPerSrcMutator).Parallel()
|
||||||
ctx.BottomUp("begin", beginMutator).Parallel()
|
ctx.BottomUp("begin", BeginMutator).Parallel()
|
||||||
})
|
})
|
||||||
|
|
||||||
android.PostDepsMutators(func(ctx android.RegisterMutatorsContext) {
|
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() {
|
if c, ok := ctx.Module().(*Module); ok && c.Enabled() {
|
||||||
c.beginMutator(ctx)
|
c.beginMutator(ctx)
|
||||||
}
|
}
|
||||||
|
@@ -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", android.ModuleFactoryAdaptor(LibraryFactory))
|
||||||
ctx.RegisterModuleType("cc_library_shared", android.ModuleFactoryAdaptor(LibrarySharedFactory))
|
ctx.RegisterModuleType("cc_library_shared", android.ModuleFactoryAdaptor(LibrarySharedFactory))
|
||||||
ctx.RegisterModuleType("cc_library_headers", android.ModuleFactoryAdaptor(LibraryHeaderFactory))
|
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_library", android.ModuleFactoryAdaptor(llndkLibraryFactory))
|
||||||
ctx.RegisterModuleType("llndk_headers", android.ModuleFactoryAdaptor(llndkHeadersFactory))
|
ctx.RegisterModuleType("llndk_headers", android.ModuleFactoryAdaptor(llndkHeadersFactory))
|
||||||
ctx.RegisterModuleType("vendor_public_library", android.ModuleFactoryAdaptor(vendorPublicLibraryFactory))
|
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.RegisterModuleType("filegroup", android.ModuleFactoryAdaptor(android.FileGroupFactory))
|
||||||
ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) {
|
ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) {
|
||||||
ctx.BottomUp("image", imageMutator).Parallel()
|
ctx.BottomUp("image", imageMutator).Parallel()
|
||||||
ctx.BottomUp("link", linkageMutator).Parallel()
|
ctx.BottomUp("link", LinkageMutator).Parallel()
|
||||||
ctx.BottomUp("vndk", vndkMutator).Parallel()
|
ctx.BottomUp("vndk", vndkMutator).Parallel()
|
||||||
ctx.BottomUp("begin", beginMutator).Parallel()
|
ctx.BottomUp("begin", BeginMutator).Parallel()
|
||||||
})
|
})
|
||||||
ctx.Register()
|
ctx.Register()
|
||||||
|
|
||||||
|
@@ -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 m, ok := mctx.Module().(*Module); ok && m.linker != nil {
|
||||||
if library, ok := m.linker.(libraryInterface); ok {
|
if library, ok := m.linker.(libraryInterface); ok {
|
||||||
var modules []blueprint.Module
|
var modules []blueprint.Module
|
||||||
|
@@ -61,7 +61,7 @@ var (
|
|||||||
// These libraries have migrated over to the new ndk_library, which is added
|
// These libraries have migrated over to the new ndk_library, which is added
|
||||||
// as a variation dependency via depsMutator.
|
// as a variation dependency via depsMutator.
|
||||||
ndkMigratedLibs = []string{}
|
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.
|
// Creates a stub shared library based on the provided version file.
|
||||||
|
@@ -25,7 +25,7 @@ import (
|
|||||||
//
|
//
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
android.RegisterModuleType("cc_object", objectFactory)
|
android.RegisterModuleType("cc_object", ObjectFactory)
|
||||||
}
|
}
|
||||||
|
|
||||||
type objectLinker struct {
|
type objectLinker struct {
|
||||||
@@ -33,7 +33,7 @@ type objectLinker struct {
|
|||||||
Properties ObjectLinkerProperties
|
Properties ObjectLinkerProperties
|
||||||
}
|
}
|
||||||
|
|
||||||
func objectFactory() android.Module {
|
func ObjectFactory() android.Module {
|
||||||
module := newBaseModule(android.HostAndDeviceSupported, android.MultilibBoth)
|
module := newBaseModule(android.HostAndDeviceSupported, android.MultilibBoth)
|
||||||
module.linker = &objectLinker{
|
module.linker = &objectLinker{
|
||||||
baseLinker: NewBaseLinker(nil),
|
baseLinker: NewBaseLinker(nil),
|
||||||
|
@@ -23,7 +23,7 @@ import (
|
|||||||
//
|
//
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
android.RegisterModuleType("toolchain_library", toolchainLibraryFactory)
|
android.RegisterModuleType("toolchain_library", ToolchainLibraryFactory)
|
||||||
}
|
}
|
||||||
|
|
||||||
type toolchainLibraryProperties struct {
|
type toolchainLibraryProperties struct {
|
||||||
@@ -48,7 +48,7 @@ func (library *toolchainLibraryDecorator) linkerProps() []interface{} {
|
|||||||
return append(props, &library.Properties)
|
return append(props, &library.Properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
func toolchainLibraryFactory() android.Module {
|
func ToolchainLibraryFactory() android.Module {
|
||||||
module, library := NewLibrary(android.HostAndDeviceSupported)
|
module, library := NewLibrary(android.HostAndDeviceSupported)
|
||||||
library.BuildOnlyStatic()
|
library.BuildOnlyStatic()
|
||||||
toolchainLibrary := &toolchainLibraryDecorator{
|
toolchainLibrary := &toolchainLibraryDecorator{
|
||||||
|
Reference in New Issue
Block a user