Remove error from AndroidMkData.Extra
It's never anything except nil, and it unnecessarily complicates
the implementations.
Test: m -j checkbuild
Change-Id: I8a117a86aa39aeb07d9d8d0686ef869c52784f19
diff --git a/cc/androidmk.go b/cc/androidmk.go
index 940e7c7..f68ddbb 100644
--- a/cc/androidmk.go
+++ b/cc/androidmk.go
@@ -56,7 +56,7 @@
}
ret.OutputFile = c.outputFile
- ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) (err error) {
+ ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
fmt.Fprintln(w, "LOCAL_SANITIZE := never")
if len(c.Properties.AndroidMkSharedLibs) > 0 {
fmt.Fprintln(w, "LOCAL_SHARED_LIBRARIES := "+strings.Join(c.Properties.AndroidMkSharedLibs, " "))
@@ -71,7 +71,6 @@
if c.vndk() {
fmt.Fprintln(w, "LOCAL_USE_VNDK := true")
}
- return nil
})
for _, feature := range c.features {
@@ -106,9 +105,8 @@
testFiles = append(testFiles, path+":"+rel)
}
if len(testFiles) > 0 {
- ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) error {
+ ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
fmt.Fprintln(w, "LOCAL_TEST_DATA := "+strings.Join(testFiles, " "))
- return nil
})
}
}
@@ -167,7 +165,7 @@
return
}
- ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) error {
+ ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
library.androidMkWriteExportedFlags(w)
fmt.Fprintln(w, "LOCAL_ADDITIONAL_DEPENDENCIES := ")
if library.sAbiOutputFile.Valid() {
@@ -185,8 +183,6 @@
if library.coverageOutputFile.Valid() {
fmt.Fprintln(w, "LOCAL_PREBUILT_COVERAGE_ARCHIVE :=", library.coverageOutputFile.String())
}
-
- return nil
})
if library.shared() {
@@ -210,7 +206,7 @@
ctx.subAndroidMk(ret, &binary.stripper)
ret.Class = "EXECUTABLES"
- ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) error {
+ ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
fmt.Fprintln(w, "LOCAL_SYSTEM_SHARED_LIBRARIES :=")
if Bool(binary.Properties.Static_executable) {
fmt.Fprintln(w, "LOCAL_FORCE_STATIC_EXECUTABLE := true")
@@ -223,19 +219,17 @@
if binary.coverageOutputFile.Valid() {
fmt.Fprintln(w, "LOCAL_PREBUILT_COVERAGE_ARCHIVE :=", binary.coverageOutputFile.String())
}
- return nil
})
}
func (benchmark *benchmarkDecorator) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) {
ctx.subAndroidMk(ret, benchmark.binaryDecorator)
ret.Class = "NATIVE_TESTS"
- ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) error {
+ ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
if len(benchmark.Properties.Test_suites) > 0 {
fmt.Fprintln(w, "LOCAL_COMPATIBILITY_SUITE :=",
strings.Join(benchmark.Properties.Test_suites, " "))
}
- return nil
})
androidMkWriteTestData(benchmark.data, ctx, ret)
@@ -248,12 +242,11 @@
ret.SubName = "_" + test.binaryDecorator.Properties.Stem
}
- ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) error {
+ ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
if len(test.Properties.Test_suites) > 0 {
fmt.Fprintln(w, "LOCAL_COMPATIBILITY_SUITE :=",
strings.Join(test.Properties.Test_suites, " "))
}
- return nil
})
androidMkWriteTestData(test.data, ctx, ret)
@@ -265,11 +258,9 @@
func (library *toolchainLibraryDecorator) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) {
ret.Class = "STATIC_LIBRARIES"
- ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) error {
+ ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
fmt.Fprintln(w, "LOCAL_MODULE_SUFFIX := "+outputFile.Ext())
fmt.Fprintln(w, "LOCAL_SYSTEM_SHARED_LIBRARIES :=")
-
- return nil
})
}
@@ -279,7 +270,7 @@
return
}
- ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) error {
+ ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
if stripper.StripProperties.Strip.None {
fmt.Fprintln(w, "LOCAL_STRIP_MODULE := false")
} else if stripper.StripProperties.Strip.Keep_symbols {
@@ -287,17 +278,14 @@
} else {
fmt.Fprintln(w, "LOCAL_STRIP_MODULE := mini-debug-info")
}
-
- return nil
})
}
func (packer *relocationPacker) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) {
- ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) error {
+ ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
if packer.Properties.PackingRelocations {
fmt.Fprintln(w, "LOCAL_PACK_MODULE_RELOCATIONS := true")
}
- return nil
})
}
@@ -308,14 +296,13 @@
ret.OutputFile = android.OptionalPathForPath(installer.path)
}
- ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) error {
+ ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
path := installer.path.RelPathString()
dir, file := filepath.Split(path)
stem := strings.TrimSuffix(file, filepath.Ext(file))
fmt.Fprintln(w, "LOCAL_MODULE_SUFFIX := "+filepath.Ext(file))
fmt.Fprintln(w, "LOCAL_MODULE_PATH := $(OUT_DIR)/"+filepath.Clean(dir))
fmt.Fprintln(w, "LOCAL_MODULE_STEM := "+stem)
- return nil
})
}
@@ -323,7 +310,7 @@
ret.SubName = ndkLibrarySuffix + "." + c.properties.ApiLevel
ret.Class = "SHARED_LIBRARIES"
- ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) error {
+ ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
path, file := filepath.Split(c.installPath)
stem := strings.TrimSuffix(file, filepath.Ext(file))
fmt.Fprintln(w, "LOCAL_SYSTEM_SHARED_LIBRARIES :=")
@@ -336,7 +323,6 @@
// dozens of libraries with the same name, they'll clobber each other
// and the real versions of the libraries from the platform).
fmt.Fprintln(w, "LOCAL_COPY_TO_INTERMEDIATE_LIBRARIES := false")
- return nil
})
}
@@ -344,7 +330,7 @@
ret.Class = "SHARED_LIBRARIES"
ret.SubName = ".vendor"
- ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) error {
+ ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
c.libraryDecorator.androidMkWriteExportedFlags(w)
fmt.Fprintln(w, "LOCAL_BUILT_MODULE_STEM := $(LOCAL_MODULE)"+outputFile.Ext())
@@ -353,7 +339,5 @@
fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE := true")
fmt.Fprintln(w, "LOCAL_NO_NOTICE_FILE := true")
fmt.Fprintln(w, "LOCAL_USE_VNDK := true")
-
- return nil
})
}