Merge "Split logtags implementations for cc and java" am: e304cc4575
am: b18d19f9ba
Change-Id: I56c057251d4132915b40a19b5ae7ebbff8e89b59
This commit is contained in:
@@ -224,9 +224,6 @@ func translateAndroidMkModule(ctx SingletonContext, w io.Writer, mod blueprint.M
|
|||||||
fmt.Fprintln(&data.preamble, "LOCAL_MODULE_TARGET_ARCH :=", archStr)
|
fmt.Fprintln(&data.preamble, "LOCAL_MODULE_TARGET_ARCH :=", archStr)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(amod.commonProperties.Logtags) > 0 {
|
|
||||||
fmt.Fprintln(&data.preamble, "LOCAL_LOGTAGS_FILES := ", strings.Join(amod.commonProperties.Logtags, " "))
|
|
||||||
}
|
|
||||||
if len(amod.commonProperties.Init_rc) > 0 {
|
if len(amod.commonProperties.Init_rc) > 0 {
|
||||||
fmt.Fprintln(&data.preamble, "LOCAL_INIT_RC := ", strings.Join(amod.commonProperties.Init_rc, " "))
|
fmt.Fprintln(&data.preamble, "LOCAL_INIT_RC := ", strings.Join(amod.commonProperties.Init_rc, " "))
|
||||||
}
|
}
|
||||||
|
@@ -214,10 +214,6 @@ type commonProperties struct {
|
|||||||
// whether this module is device specific and should be installed into /vendor
|
// whether this module is device specific and should be installed into /vendor
|
||||||
Vendor *bool
|
Vendor *bool
|
||||||
|
|
||||||
// *.logtags files, to combine together in order to generate the /system/etc/event-log-tags
|
|
||||||
// file
|
|
||||||
Logtags []string
|
|
||||||
|
|
||||||
// init.rc files to be installed if this module is installed
|
// init.rc files to be installed if this module is installed
|
||||||
Init_rc []string
|
Init_rc []string
|
||||||
|
|
||||||
|
@@ -49,7 +49,6 @@ var rewriteProperties = map[string](func(variableAssignmentContext) error){
|
|||||||
"LOCAL_MODULE_CLASS": prebuiltClass,
|
"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_SANITIZE": sanitize(""),
|
"LOCAL_SANITIZE": sanitize(""),
|
||||||
"LOCAL_SANITIZE_DIAG": sanitize("diag."),
|
"LOCAL_SANITIZE_DIAG": sanitize("diag."),
|
||||||
"LOCAL_CFLAGS": cflags,
|
"LOCAL_CFLAGS": cflags,
|
||||||
@@ -99,6 +98,7 @@ func init() {
|
|||||||
})
|
})
|
||||||
addStandardProperties(bpparser.ListType,
|
addStandardProperties(bpparser.ListType,
|
||||||
map[string]string{
|
map[string]string{
|
||||||
|
"LOCAL_SRC_FILES": "srcs",
|
||||||
"LOCAL_SRC_FILES_EXCLUDE": "exclude_srcs",
|
"LOCAL_SRC_FILES_EXCLUDE": "exclude_srcs",
|
||||||
"LOCAL_HEADER_LIBRARIES": "header_libs",
|
"LOCAL_HEADER_LIBRARIES": "header_libs",
|
||||||
"LOCAL_SHARED_LIBRARIES": "shared_libs",
|
"LOCAL_SHARED_LIBRARIES": "shared_libs",
|
||||||
@@ -389,50 +389,6 @@ func hostOs(ctx variableAssignmentContext) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func splitSrcsLogtags(value bpparser.Expression) (string, bpparser.Expression, error) {
|
|
||||||
switch v := value.(type) {
|
|
||||||
case *bpparser.Variable:
|
|
||||||
// TODO: attempt to split variables?
|
|
||||||
return "srcs", value, nil
|
|
||||||
case *bpparser.Operator:
|
|
||||||
// TODO: attempt to handle expressions?
|
|
||||||
return "srcs", value, nil
|
|
||||||
case *bpparser.String:
|
|
||||||
if strings.HasSuffix(v.Value, ".logtags") {
|
|
||||||
return "logtags", value, nil
|
|
||||||
}
|
|
||||||
return "srcs", value, nil
|
|
||||||
default:
|
|
||||||
return "", nil, fmt.Errorf("splitSrcsLogtags expected a string, got %s", value.Type())
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func srcFiles(ctx variableAssignmentContext) error {
|
|
||||||
val, err := makeVariableToBlueprint(ctx.file, ctx.mkvalue, bpparser.ListType)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
lists, err := splitBpList(val, splitSrcsLogtags)
|
|
||||||
|
|
||||||
if srcs, ok := lists["srcs"]; ok && !emptyList(srcs) {
|
|
||||||
err = setVariable(ctx.file, ctx.append, ctx.prefix, "srcs", srcs, true)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if logtags, ok := lists["logtags"]; ok && !emptyList(logtags) {
|
|
||||||
err = setVariable(ctx.file, true, ctx.prefix, "logtags", logtags, true)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func sanitize(sub string) func(ctx variableAssignmentContext) error {
|
func sanitize(sub string) func(ctx variableAssignmentContext) error {
|
||||||
return func(ctx variableAssignmentContext) error {
|
return func(ctx variableAssignmentContext) error {
|
||||||
val, err := makeVariableToBlueprint(ctx.file, ctx.mkvalue, bpparser.ListType)
|
val, err := makeVariableToBlueprint(ctx.file, ctx.mkvalue, bpparser.ListType)
|
||||||
|
@@ -210,35 +210,6 @@ cc_library_shared {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
`,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
desc: "*.logtags in LOCAL_SRC_FILES",
|
|
||||||
in: `
|
|
||||||
include $(CLEAR_VARS)
|
|
||||||
LOCAL_SRC_FILES := events.logtags
|
|
||||||
LOCAL_SRC_FILES += a.c events2.logtags
|
|
||||||
include $(BUILD_SHARED_LIBRARY)
|
|
||||||
`,
|
|
||||||
expected: `
|
|
||||||
cc_library_shared {
|
|
||||||
logtags: ["events.logtags"] + ["events2.logtags"],
|
|
||||||
srcs: ["a.c"],
|
|
||||||
}
|
|
||||||
`,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
desc: "LOCAL_LOGTAGS_FILES and *.logtags in LOCAL_SRC_FILES",
|
|
||||||
in: `
|
|
||||||
include $(CLEAR_VARS)
|
|
||||||
LOCAL_LOGTAGS_FILES := events.logtags
|
|
||||||
LOCAL_SRC_FILES := events2.logtags
|
|
||||||
include $(BUILD_SHARED_LIBRARY)
|
|
||||||
`,
|
|
||||||
expected: `
|
|
||||||
cc_library_shared {
|
|
||||||
logtags: ["events.logtags"] + ["events2.logtags"],
|
|
||||||
}
|
|
||||||
`,
|
`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@@ -60,6 +60,9 @@ func (c *Module) AndroidMk() android.AndroidMkData {
|
|||||||
OutputFile: c.outputFile,
|
OutputFile: c.outputFile,
|
||||||
Extra: []android.AndroidMkExtraFunc{
|
Extra: []android.AndroidMkExtraFunc{
|
||||||
func(w io.Writer, outputFile android.Path) {
|
func(w io.Writer, outputFile android.Path) {
|
||||||
|
if len(c.Properties.Logtags) > 0 {
|
||||||
|
fmt.Fprintln(w, "LOCAL_LOGTAGS_FILES :=", strings.Join(c.Properties.Logtags, " "))
|
||||||
|
}
|
||||||
fmt.Fprintln(w, "LOCAL_SANITIZE := never")
|
fmt.Fprintln(w, "LOCAL_SANITIZE := never")
|
||||||
if len(c.Properties.AndroidMkSharedLibs) > 0 {
|
if len(c.Properties.AndroidMkSharedLibs) > 0 {
|
||||||
fmt.Fprintln(w, "LOCAL_SHARED_LIBRARIES := "+strings.Join(c.Properties.AndroidMkSharedLibs, " "))
|
fmt.Fprintln(w, "LOCAL_SHARED_LIBRARIES := "+strings.Join(c.Properties.AndroidMkSharedLibs, " "))
|
||||||
|
4
cc/cc.go
4
cc/cc.go
@@ -164,6 +164,10 @@ type BaseProperties struct {
|
|||||||
PreventInstall bool `blueprint:"mutated"`
|
PreventInstall bool `blueprint:"mutated"`
|
||||||
|
|
||||||
UseVndk bool `blueprint:"mutated"`
|
UseVndk bool `blueprint:"mutated"`
|
||||||
|
|
||||||
|
// *.logtags files, to combine together in order to generate the /system/etc/event-log-tags
|
||||||
|
// file
|
||||||
|
Logtags []string
|
||||||
}
|
}
|
||||||
|
|
||||||
type VendorProperties struct {
|
type VendorProperties struct {
|
||||||
|
@@ -31,6 +31,14 @@ func (library *Library) AndroidMk() android.AndroidMkData {
|
|||||||
Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk",
|
Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk",
|
||||||
Extra: []android.AndroidMkExtraFunc{
|
Extra: []android.AndroidMkExtraFunc{
|
||||||
func(w io.Writer, outputFile android.Path) {
|
func(w io.Writer, outputFile android.Path) {
|
||||||
|
if len(library.logtagsSrcs) > 0 {
|
||||||
|
var logtags []string
|
||||||
|
for _, l := range library.logtagsSrcs {
|
||||||
|
logtags = append(logtags, l.Rel())
|
||||||
|
}
|
||||||
|
fmt.Fprintln(w, "LOCAL_LOGTAGS_FILES :=", strings.Join(logtags, " "))
|
||||||
|
}
|
||||||
|
|
||||||
if library.properties.Installable != nil && *library.properties.Installable == false {
|
if library.properties.Installable != nil && *library.properties.Installable == false {
|
||||||
fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE := true")
|
fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE := true")
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user