aboutsummaryrefslogtreecommitdiffstats
path: root/cc/androidmk.go
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2017-08-10 16:32:23 -0700
committerColin Cross <ccross@android.com>2017-08-11 15:24:11 -0700
commit27a4b05441a30a26de0d19cd3495a3d1229a2e57 (patch)
tree2bee8414340eeb2547cf014a29260bf94a87291a /cc/androidmk.go
parent6416271a1f6ec76e5dfac4573eec78bbd4f3ba3b (diff)
downloadbuild_soong-27a4b05441a30a26de0d19cd3495a3d1229a2e57.tar.gz
build_soong-27a4b05441a30a26de0d19cd3495a3d1229a2e57.tar.bz2
build_soong-27a4b05441a30a26de0d19cd3495a3d1229a2e57.zip
Remove error from AndroidMkData.Extra
It's never anything except nil, and it unnecessarily complicates the implementations. Test: m -j checkbuild Change-Id: I8a117a86aa39aeb07d9d8d0686ef869c52784f19
Diffstat (limited to 'cc/androidmk.go')
-rw-r--r--cc/androidmk.go40
1 files changed, 12 insertions, 28 deletions
diff --git a/cc/androidmk.go b/cc/androidmk.go
index 940e7c77..f68ddbb9 100644
--- a/cc/androidmk.go
+++ b/cc/androidmk.go
@@ -56,7 +56,7 @@ func (c *Module) AndroidMk() (ret android.AndroidMkData, err error) {
}
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 @@ func (c *Module) AndroidMk() (ret android.AndroidMkData, err error) {
if c.vndk() {
fmt.Fprintln(w, "LOCAL_USE_VNDK := true")
}
- return nil
})
for _, feature := range c.features {
@@ -106,9 +105,8 @@ func androidMkWriteTestData(data android.Paths, ctx AndroidMkContext, ret *andro
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 @@ func (library *libraryDecorator) AndroidMk(ctx AndroidMkContext, ret *android.An
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 @@ func (library *libraryDecorator) AndroidMk(ctx AndroidMkContext, ret *android.An
if library.coverageOutputFile.Valid() {
fmt.Fprintln(w, "LOCAL_PREBUILT_COVERAGE_ARCHIVE :=", library.coverageOutputFile.String())
}
-
- return nil
})
if library.shared() {
@@ -210,7 +206,7 @@ func (binary *binaryDecorator) AndroidMk(ctx AndroidMkContext, ret *android.Andr
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 @@ func (binary *binaryDecorator) AndroidMk(ctx AndroidMkContext, ret *android.Andr
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 @@ func (test *testBinary) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkDa
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 (test *testLibrary) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkD
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 @@ func (stripper *stripper) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMk
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 @@ func (stripper *stripper) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMk
} 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 @@ func (installer *baseInstaller) AndroidMk(ctx AndroidMkContext, ret *android.And
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 @@ func (c *stubDecorator) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkDa
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 @@ func (c *stubDecorator) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkDa
// 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 @@ func (c *llndkStubDecorator) AndroidMk(ctx AndroidMkContext, ret *android.Androi
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 @@ func (c *llndkStubDecorator) AndroidMk(ctx AndroidMkContext, ret *android.Androi
fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE := true")
fmt.Fprintln(w, "LOCAL_NO_NOTICE_FILE := true")
fmt.Fprintln(w, "LOCAL_USE_VNDK := true")
-
- return nil
})
}