diff options
author | Colin Cross <ccross@android.com> | 2017-12-07 15:28:59 -0800 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2017-12-07 15:32:30 -0800 |
commit | 5beccee92cfa5e13fbebb3d670f0dc65b7ba802c (patch) | |
tree | 353c0cb2871600f3aba7ac26dffb60ef9aca3b26 /androidmk/cmd | |
parent | 4b9bb14dd2b6b606078187f555ceffce9c6c8a41 (diff) | |
download | build_soong-5beccee92cfa5e13fbebb3d670f0dc65b7ba802c.tar.gz build_soong-5beccee92cfa5e13fbebb3d670f0dc65b7ba802c.tar.bz2 build_soong-5beccee92cfa5e13fbebb3d670f0dc65b7ba802c.zip |
Split logtags implementations for cc and java
Logtags files in cc and java are treated fundamentally differently.
In cc, they are not used for compiling at all, but need to be passed
to Make to be combined into the global logtags list, and logtag files
are listed in a logtags property. In java they are listed in srcs
and produce generated code that is compiled in, and so shouldn't
also need to be listed in a logtags property.
Move the logtags property to cc and export it to Make from there,
and have java extract logtags files from srcs to be exported to
Make.
Test: m checkbuild
Change-Id: I31d49289efe72db60d2f33566df771b4a3ebc8a0
Diffstat (limited to 'androidmk/cmd')
-rw-r--r-- | androidmk/cmd/androidmk/android.go | 46 | ||||
-rw-r--r-- | androidmk/cmd/androidmk/androidmk_test.go | 29 |
2 files changed, 1 insertions, 74 deletions
diff --git a/androidmk/cmd/androidmk/android.go b/androidmk/cmd/androidmk/android.go index bb9d140f..4022a5e3 100644 --- a/androidmk/cmd/androidmk/android.go +++ b/androidmk/cmd/androidmk/android.go @@ -49,7 +49,6 @@ var rewriteProperties = map[string](func(variableAssignmentContext) error){ "LOCAL_MODULE_CLASS": prebuiltClass, "LOCAL_MODULE_STEM": stem, "LOCAL_MODULE_HOST_OS": hostOs, - "LOCAL_SRC_FILES": srcFiles, "LOCAL_SANITIZE": sanitize(""), "LOCAL_SANITIZE_DIAG": sanitize("diag."), "LOCAL_CFLAGS": cflags, @@ -99,6 +98,7 @@ func init() { }) addStandardProperties(bpparser.ListType, map[string]string{ + "LOCAL_SRC_FILES": "srcs", "LOCAL_SRC_FILES_EXCLUDE": "exclude_srcs", "LOCAL_HEADER_LIBRARIES": "header_libs", "LOCAL_SHARED_LIBRARIES": "shared_libs", @@ -389,50 +389,6 @@ func hostOs(ctx variableAssignmentContext) error { 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 { return func(ctx variableAssignmentContext) error { val, err := makeVariableToBlueprint(ctx.file, ctx.mkvalue, bpparser.ListType) diff --git a/androidmk/cmd/androidmk/androidmk_test.go b/androidmk/cmd/androidmk/androidmk_test.go index 9986889c..22a52d46 100644 --- a/androidmk/cmd/androidmk/androidmk_test.go +++ b/androidmk/cmd/androidmk/androidmk_test.go @@ -213,35 +213,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"], -} -`, - }, - { desc: "_<OS> suffixes", in: ` include $(CLEAR_VARS) |