summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Colin Cross <ccross@android.com> 2017-08-10 17:00:19 -0700
committer Colin Cross <ccross@android.com> 2017-08-11 15:24:11 -0700
commita18e9cfa29d22949d2c005fe2b51c5ffa2bf6379 (patch)
treefd4733237ef52794c6a0d2e5b63e617b93613b06
parent91825d2279fb9066ec6ffd4ce2070eb070ce38cf (diff)
Remove error from AndroidMkDataProvider.AndroidMk
It's never anything except nil, and it unnecessarily complicates the implementations. Test: m -j checkbuild Change-Id: I3e3b7251f32ffa84dbdfd0448faf248c306ca808
-rw-r--r--android/androidmk.go2
-rw-r--r--cc/androidmk.go47
-rw-r--r--java/androidmk.go34
-rw-r--r--phony/phony.go17
-rw-r--r--python/androidmk.go6
5 files changed, 60 insertions, 46 deletions
diff --git a/android/androidmk.go b/android/androidmk.go
index fd745075e..2732c82e4 100644
--- a/android/androidmk.go
+++ b/android/androidmk.go
@@ -33,7 +33,7 @@ func init() {
}
type AndroidMkDataProvider interface {
- AndroidMk() (AndroidMkData, error)
+ AndroidMk() AndroidMkData
BaseModuleName() string
}
diff --git a/cc/androidmk.go b/cc/androidmk.go
index 561a0a316..4421b1c45 100644
--- a/cc/androidmk.go
+++ b/cc/androidmk.go
@@ -49,29 +49,34 @@ func (c *Module) subAndroidMk(data *android.AndroidMkData, obj interface{}) {
}
}
-func (c *Module) AndroidMk() (ret android.AndroidMkData, err error) {
+func (c *Module) AndroidMk() android.AndroidMkData {
if c.Properties.HideFromMake {
- ret.Disabled = true
- return ret, nil
+ return android.AndroidMkData{
+ Disabled: true,
+ }
}
- ret.OutputFile = c.outputFile
- 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, " "))
- }
- if c.Target().Os == android.Android && c.Properties.Sdk_version != "" && !c.vndk() {
- fmt.Fprintln(w, "LOCAL_SDK_VERSION := "+c.Properties.Sdk_version)
- fmt.Fprintln(w, "LOCAL_NDK_STL_VARIANT := none")
- } else {
- // These are already included in LOCAL_SHARED_LIBRARIES
- fmt.Fprintln(w, "LOCAL_CXX_STL := none")
- }
- if c.vndk() {
- fmt.Fprintln(w, "LOCAL_USE_VNDK := true")
- }
- })
+ ret := android.AndroidMkData{
+ OutputFile: c.outputFile,
+ Extra: []android.AndroidMkExtraFunc{
+ 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, " "))
+ }
+ if c.Target().Os == android.Android && c.Properties.Sdk_version != "" && !c.vndk() {
+ fmt.Fprintln(w, "LOCAL_SDK_VERSION := "+c.Properties.Sdk_version)
+ fmt.Fprintln(w, "LOCAL_NDK_STL_VARIANT := none")
+ } else {
+ // These are already included in LOCAL_SHARED_LIBRARIES
+ fmt.Fprintln(w, "LOCAL_CXX_STL := none")
+ }
+ if c.vndk() {
+ fmt.Fprintln(w, "LOCAL_USE_VNDK := true")
+ }
+ },
+ },
+ }
for _, feature := range c.features {
c.subAndroidMk(&ret, feature)
@@ -90,7 +95,7 @@ func (c *Module) AndroidMk() (ret android.AndroidMkData, err error) {
ret.SubName += vendorSuffix
}
- return ret, nil
+ return ret
}
func androidMkWriteTestData(data android.Paths, ctx AndroidMkContext, ret *android.AndroidMkData) {
diff --git a/java/androidmk.go b/java/androidmk.go
index fd967cb5b..193992496 100644
--- a/java/androidmk.go
+++ b/java/androidmk.go
@@ -21,20 +21,26 @@ import (
"android/soong/android"
)
-func (library *Library) AndroidMk() (ret android.AndroidMkData, err error) {
- ret.Class = "JAVA_LIBRARIES"
- ret.OutputFile = android.OptionalPathForPath(library.outputFile)
- ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
- fmt.Fprintln(w, "LOCAL_MODULE_SUFFIX := .jar")
- })
- return
+func (library *Library) AndroidMk() android.AndroidMkData {
+ return android.AndroidMkData{
+ Class: "JAVA_LIBRARIES",
+ OutputFile: android.OptionalPathForPath(library.outputFile),
+ Extra: []android.AndroidMkExtraFunc{
+ func(w io.Writer, outputFile android.Path) {
+ fmt.Fprintln(w, "LOCAL_MODULE_SUFFIX := .jar")
+ },
+ },
+ }
}
-func (prebuilt *Import) AndroidMk() (ret android.AndroidMkData, err error) {
- ret.Class = "JAVA_LIBRARIES"
- ret.OutputFile = android.OptionalPathForPath(prebuilt.combinedClasspathFile)
- ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
- fmt.Fprintln(w, "LOCAL_MODULE_SUFFIX := .jar")
- })
- return
+func (prebuilt *Import) AndroidMk() android.AndroidMkData {
+ return android.AndroidMkData{
+ Class: "JAVA_LIBRARIES",
+ OutputFile: android.OptionalPathForPath(prebuilt.combinedClasspathFile),
+ Extra: []android.AndroidMkExtraFunc{
+ func(w io.Writer, outputFile android.Path) {
+ fmt.Fprintln(w, "LOCAL_MODULE_SUFFIX := .jar")
+ },
+ },
+ }
}
diff --git a/phony/phony.go b/phony/phony.go
index 053ed5606..5f0187f92 100644
--- a/phony/phony.go
+++ b/phony/phony.go
@@ -48,13 +48,14 @@ 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) {
- 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)")
+func (p *phony) AndroidMk() android.AndroidMkData {
+ return android.AndroidMkData{
+ 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
}
diff --git a/python/androidmk.go b/python/androidmk.go
index 386eeeed1..ab24e9932 100644
--- a/python/androidmk.go
+++ b/python/androidmk.go
@@ -38,10 +38,12 @@ func (p *pythonBaseModule) subAndroidMk(data *android.AndroidMkData, obj interfa
}
}
-func (p *pythonBaseModule) AndroidMk() (ret android.AndroidMkData, err error) {
+func (p *pythonBaseModule) AndroidMk() android.AndroidMkData {
+ ret := android.AndroidMkData{}
+
p.subAndroidMk(&ret, p.installer)
- return ret, nil
+ return ret
}
func (p *pythonBinaryHostDecorator) AndroidMk(base *pythonBaseModule, ret *android.AndroidMkData) {