Support cc_test_host
Support cc_test_host for gtest tests compiled for the host. Change-Id: I632d2c211075ba9391d934609f1bf368459397e1
This commit is contained in:
@@ -13,6 +13,7 @@ const (
|
|||||||
build_executable = "cc_binary"
|
build_executable = "cc_binary"
|
||||||
build_host_executable = "cc_binary_host"
|
build_host_executable = "cc_binary_host"
|
||||||
build_native_test = "cc_test"
|
build_native_test = "cc_test"
|
||||||
|
build_host_native_test = "cc_test_host"
|
||||||
build_prebuilt = "prebuilt"
|
build_prebuilt = "prebuilt"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -105,6 +106,7 @@ func androidScope() parser.Scope {
|
|||||||
globalScope.Set("BUILD_HOST_STATIC_LIBRARY", build_host_static_library)
|
globalScope.Set("BUILD_HOST_STATIC_LIBRARY", build_host_static_library)
|
||||||
globalScope.Set("BUILD_HOST_SHARED_LIBRARY", build_host_shared_library)
|
globalScope.Set("BUILD_HOST_SHARED_LIBRARY", build_host_shared_library)
|
||||||
globalScope.Set("BUILD_NATIVE_TEST", build_native_test)
|
globalScope.Set("BUILD_NATIVE_TEST", build_native_test)
|
||||||
|
globalScope.Set("BUILD_HOST_NATIVE_TEST", build_host_native_test)
|
||||||
globalScope.Set("BUILD_EXECUTABLE", build_executable)
|
globalScope.Set("BUILD_EXECUTABLE", build_executable)
|
||||||
globalScope.Set("BUILD_PREBUILT", build_prebuilt)
|
globalScope.Set("BUILD_PREBUILT", build_prebuilt)
|
||||||
globalScope.SetFunc("my-dir", mydir)
|
globalScope.SetFunc("my-dir", mydir)
|
||||||
|
@@ -111,7 +111,8 @@ func main() {
|
|||||||
case build_shared_library, build_static_library,
|
case build_shared_library, build_static_library,
|
||||||
build_executable, build_host_executable,
|
build_executable, build_host_executable,
|
||||||
build_prebuilt, build_host_static_library,
|
build_prebuilt, build_host_static_library,
|
||||||
build_host_shared_library, build_native_test:
|
build_host_shared_library, build_native_test,
|
||||||
|
build_host_native_test:
|
||||||
|
|
||||||
handleModuleConditionals(file, directive, cond)
|
handleModuleConditionals(file, directive, cond)
|
||||||
makeModule(file, val)
|
makeModule(file, val)
|
||||||
|
21
cc/cc.go
21
cc/cc.go
@@ -1214,10 +1214,11 @@ func (c *CCBinary) DepNames(ctx common.AndroidBaseContext, depNames CCDeps) CCDe
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewCCBinary(binary *CCBinary, module CCModuleType,
|
func NewCCBinary(binary *CCBinary, module CCModuleType,
|
||||||
hod common.HostOrDeviceSupported) (blueprint.Module, []interface{}) {
|
hod common.HostOrDeviceSupported, props ...interface{}) (blueprint.Module, []interface{}) {
|
||||||
|
|
||||||
return newCCDynamic(&binary.ccLinked, module, hod, common.MultilibFirst,
|
props = append(props, &binary.BinaryProperties)
|
||||||
&binary.BinaryProperties)
|
|
||||||
|
return newCCDynamic(&binary.ccLinked, module, hod, common.MultilibFirst, props...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func CCBinaryFactory() (blueprint.Module, []interface{}) {
|
func CCBinaryFactory() (blueprint.Module, []interface{}) {
|
||||||
@@ -1334,8 +1335,8 @@ func (c *ccTest) installModule(ctx common.AndroidModuleContext, flags CCFlags) {
|
|||||||
|
|
||||||
func CCTestFactory() (blueprint.Module, []interface{}) {
|
func CCTestFactory() (blueprint.Module, []interface{}) {
|
||||||
module := &ccTest{}
|
module := &ccTest{}
|
||||||
return newCCDynamic(&module.ccLinked, module, common.HostAndDeviceSupported,
|
return NewCCBinary(&module.CCBinary, module, common.HostAndDeviceSupported,
|
||||||
common.MultilibFirst, &module.BinaryProperties, &module.testProperties)
|
&module.testProperties)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPerSrcMutator(mctx blueprint.EarlyMutatorContext) {
|
func TestPerSrcMutator(mctx blueprint.EarlyMutatorContext) {
|
||||||
@@ -1408,6 +1409,16 @@ func CCBinaryHostFactory() (blueprint.Module, []interface{}) {
|
|||||||
return NewCCBinary(module, module, common.HostSupported)
|
return NewCCBinary(module, module, common.HostSupported)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Host Tests
|
||||||
|
//
|
||||||
|
|
||||||
|
func CCTestHostFactory() (blueprint.Module, []interface{}) {
|
||||||
|
module := &ccTest{}
|
||||||
|
return NewCCBinary(&module.CCBinary, module, common.HostSupported,
|
||||||
|
&module.testProperties)
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Device libraries shipped with gcc
|
// Device libraries shipped with gcc
|
||||||
//
|
//
|
||||||
|
@@ -54,6 +54,7 @@ func main() {
|
|||||||
ctx.RegisterModuleType("cc_library_host_static", cc.CCLibraryHostStaticFactory)
|
ctx.RegisterModuleType("cc_library_host_static", cc.CCLibraryHostStaticFactory)
|
||||||
ctx.RegisterModuleType("cc_library_host_shared", cc.CCLibraryHostSharedFactory)
|
ctx.RegisterModuleType("cc_library_host_shared", cc.CCLibraryHostSharedFactory)
|
||||||
ctx.RegisterModuleType("cc_binary_host", cc.CCBinaryHostFactory)
|
ctx.RegisterModuleType("cc_binary_host", cc.CCBinaryHostFactory)
|
||||||
|
ctx.RegisterModuleType("cc_test_host", cc.CCTestHostFactory)
|
||||||
|
|
||||||
ctx.RegisterModuleType("gensrcs", genrule.GenSrcsFactory)
|
ctx.RegisterModuleType("gensrcs", genrule.GenSrcsFactory)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user