Merge "Support prebuilt module types"

This commit is contained in:
Treehugger Robot 2017-03-31 08:55:40 +00:00 committed by Gerrit Code Review
commit 3cfa1f2078

View file

@ -29,6 +29,7 @@ var rewriteProperties = map[string](func(variableAssignmentContext) error){
"LOCAL_C_INCLUDES": localIncludeDirs, "LOCAL_C_INCLUDES": localIncludeDirs,
"LOCAL_EXPORT_C_INCLUDE_DIRS": exportIncludeDirs, "LOCAL_EXPORT_C_INCLUDE_DIRS": exportIncludeDirs,
"LOCAL_LDFLAGS": ldflags, "LOCAL_LDFLAGS": ldflags,
"LOCAL_MODULE_CLASS": prebuiltClass,
"LOCAL_MODULE_STEM": stem, "LOCAL_MODULE_STEM": stem,
"LOCAL_MODULE_HOST_OS": hostOs, "LOCAL_MODULE_HOST_OS": hostOs,
"LOCAL_SRC_FILES": srcFiles, "LOCAL_SRC_FILES": srcFiles,
@ -40,7 +41,9 @@ var rewriteProperties = map[string](func(variableAssignmentContext) error){
// skip functions // skip functions
"LOCAL_ADDITIONAL_DEPENDENCIES": skip, // TODO: check for only .mk files? "LOCAL_ADDITIONAL_DEPENDENCIES": skip, // TODO: check for only .mk files?
"LOCAL_CPP_EXTENSION": skip, "LOCAL_CPP_EXTENSION": skip,
"LOCAL_MODULE_SUFFIX": skip, // TODO
"LOCAL_PATH": skip, // Nothing to do, except maybe avoid the "./" in paths? "LOCAL_PATH": skip, // Nothing to do, except maybe avoid the "./" in paths?
"LOCAL_PRELINK_MODULE": skip, // Already phased out
} }
// adds a group of properties all having the same type // adds a group of properties all having the same type
@ -54,7 +57,6 @@ func init() {
addStandardProperties(bpparser.StringType, addStandardProperties(bpparser.StringType,
map[string]string{ map[string]string{
"LOCAL_MODULE": "name", "LOCAL_MODULE": "name",
"LOCAL_MODULE_CLASS": "class",
"LOCAL_CXX_STL": "stl", "LOCAL_CXX_STL": "stl",
"LOCAL_STRIP_MODULE": "strip", "LOCAL_STRIP_MODULE": "strip",
"LOCAL_MULTILIB": "compile_multilib", "LOCAL_MULTILIB": "compile_multilib",
@ -462,6 +464,17 @@ func sanitize(ctx variableAssignmentContext) error {
return err return err
} }
func prebuiltClass(ctx variableAssignmentContext) error {
class := ctx.mkvalue.Value(nil)
if v, ok := prebuiltTypes[class]; ok {
ctx.file.scope.Set("BUILD_PREBUILT", v)
} else {
// reset to default
ctx.file.scope.Set("BUILD_PREBUILT", "prebuilt")
}
return nil
}
func ldflags(ctx variableAssignmentContext) error { func ldflags(ctx variableAssignmentContext) error {
val, err := makeVariableToBlueprint(ctx.file, ctx.mkvalue, bpparser.ListType) val, err := makeVariableToBlueprint(ctx.file, ctx.mkvalue, bpparser.ListType)
if err != nil { if err != nil {
@ -658,8 +671,13 @@ var moduleTypes = map[string]string{
"BUILD_HOST_JAVA_LIBRARY": "java_library_host", "BUILD_HOST_JAVA_LIBRARY": "java_library_host",
"BUILD_HOST_DALVIK_JAVA_LIBRARY": "java_library_host_dalvik", "BUILD_HOST_DALVIK_JAVA_LIBRARY": "java_library_host_dalvik",
"BUILD_PACKAGE": "android_app", "BUILD_PACKAGE": "android_app",
}
"BUILD_PREBUILT": "prebuilt", var prebuiltTypes = map[string]string{
"SHARED_LIBRARIES": "cc_prebuilt_library_shared",
"STATIC_LIBRARIES": "cc_prebuilt_library_static",
"EXECUTABLES": "cc_prebuilt_binary",
"JAVA_LIBRARIES": "prebuilt_java_library",
} }
var soongModuleTypes = map[string]bool{} var soongModuleTypes = map[string]bool{}
@ -675,6 +693,9 @@ func androidScope() mkparser.Scope {
globalScope.Set(k, v) globalScope.Set(k, v)
soongModuleTypes[v] = true soongModuleTypes[v] = true
} }
for _, v := range prebuiltTypes {
soongModuleTypes[v] = true
}
return globalScope return globalScope
} }