From 91825d2279fb9066ec6ffd4ce2070eb070ce38cf Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Thu, 10 Aug 2017 16:59:47 -0700 Subject: [PATCH] Remove error from AndroidMkData.Custom It's never anything except nil, and it unnecessarily complicates the implementations. Test: m -j checkbuild Change-Id: I021c7971ede3e11bbe08cf1601f4690ed4d1a036 --- android/androidmk.go | 15 +++++++-------- cc/androidmk.go | 8 ++------ phony/phony.go | 4 +--- 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/android/androidmk.go b/android/androidmk.go index d5ee045b7..fd745075e 100644 --- a/android/androidmk.go +++ b/android/androidmk.go @@ -43,7 +43,7 @@ type AndroidMkData struct { OutputFile OptionalPath Disabled bool - Custom func(w io.Writer, name, prefix, moduleDir string) error + Custom func(w io.Writer, name, prefix, moduleDir string) Extra []AndroidMkExtraFunc } @@ -159,10 +159,7 @@ func translateAndroidMkModule(ctx blueprint.SingletonContext, w io.Writer, mod b return nil } - data, err := provider.AndroidMk() - if err != nil { - return err - } + data := provider.AndroidMk() // Make does not understand LinuxBionic if amod.Os() == LinuxBionic { @@ -192,7 +189,9 @@ func translateAndroidMkModule(ctx blueprint.SingletonContext, w io.Writer, mod b } } - return data.Custom(w, name, prefix, filepath.Dir(ctx.BlueprintFile(mod))) + data.Custom(w, name, prefix, filepath.Dir(ctx.BlueprintFile(mod))) + + return nil } if data.Disabled { @@ -200,7 +199,7 @@ func translateAndroidMkModule(ctx blueprint.SingletonContext, w io.Writer, mod b } if !data.OutputFile.Valid() { - return err + return nil } fmt.Fprintln(w, "\ninclude $(CLEAR_VARS)") @@ -262,5 +261,5 @@ func translateAndroidMkModule(ctx blueprint.SingletonContext, w io.Writer, mod b fmt.Fprintln(w, "include $(BUILD_PREBUILT)") - return err + return nil } diff --git a/cc/androidmk.go b/cc/androidmk.go index f68ddbb9e..561a0a316 100644 --- a/cc/androidmk.go +++ b/cc/androidmk.go @@ -131,7 +131,7 @@ func (library *libraryDecorator) AndroidMk(ctx AndroidMkContext, ret *android.An ret.Class = "SHARED_LIBRARIES" } else if library.header() { - ret.Custom = func(w io.Writer, name, prefix, moduleDir string) error { + ret.Custom = func(w io.Writer, name, prefix, moduleDir string) { fmt.Fprintln(w, "\ninclude $(CLEAR_VARS)") fmt.Fprintln(w, "LOCAL_PATH :=", moduleDir) fmt.Fprintln(w, "LOCAL_MODULE :=", name) @@ -158,8 +158,6 @@ func (library *libraryDecorator) AndroidMk(ctx AndroidMkContext, ret *android.An library.androidMkWriteExportedFlags(w) fmt.Fprintln(w, "include $(BUILD_HEADER_LIBRARY)") - - return nil } return @@ -191,13 +189,11 @@ func (library *libraryDecorator) AndroidMk(ctx AndroidMkContext, ret *android.An } func (object *objectLinker) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) { - ret.Custom = func(w io.Writer, name, prefix, moduleDir string) error { + ret.Custom = func(w io.Writer, name, prefix, moduleDir string) { out := ret.OutputFile.Path() fmt.Fprintln(w, "\n$("+prefix+"OUT_INTERMEDIATE_LIBRARIES)/"+name+objectExtension+":", out.String()) fmt.Fprintln(w, "\t$(copy-file-to-target)") - - return nil } } diff --git a/phony/phony.go b/phony/phony.go index 79f3a1ba8..053ed5606 100644 --- a/phony/phony.go +++ b/phony/phony.go @@ -49,14 +49,12 @@ func (p *phony) GenerateAndroidBuildActions(ctx android.ModuleContext) { } func (p *phony) AndroidMk() (ret android.AndroidMkData, err error) { - ret.Custom = func(w io.Writer, name, prefix, moduleDir string) error { + ret.Custom = func(w io.Writer, name, prefix, moduleDir string) { fmt.Fprintln(w, "\ninclude $(CLEAR_VARS)") fmt.Fprintln(w, "LOCAL_PATH :=", moduleDir) fmt.Fprintln(w, "LOCAL_MODULE :=", name) fmt.Fprintln(w, "LOCAL_REQUIRED_MODULES := "+strings.Join(p.requiredModuleNames, " ")) fmt.Fprintln(w, "include $(BUILD_PHONY_PACKAGE)") - - return nil } return }