Merge "Write out module owner for prebuilt_etc"
This commit is contained in:
@@ -145,6 +145,9 @@ func (p *PrebuiltEtc) AndroidMk() AndroidMkData {
|
|||||||
fmt.Fprintln(w, "LOCAL_PATH :=", moduleDir)
|
fmt.Fprintln(w, "LOCAL_PATH :=", moduleDir)
|
||||||
fmt.Fprintln(w, "LOCAL_MODULE :=", name+nameSuffix)
|
fmt.Fprintln(w, "LOCAL_MODULE :=", name+nameSuffix)
|
||||||
fmt.Fprintln(w, "LOCAL_MODULE_CLASS := ETC")
|
fmt.Fprintln(w, "LOCAL_MODULE_CLASS := ETC")
|
||||||
|
if p.commonProperties.Owner != nil {
|
||||||
|
fmt.Fprintln(w, "LOCAL_MODULE_OWNER :=", *p.commonProperties.Owner)
|
||||||
|
}
|
||||||
fmt.Fprintln(w, "LOCAL_MODULE_TAGS := optional")
|
fmt.Fprintln(w, "LOCAL_MODULE_TAGS := optional")
|
||||||
fmt.Fprintln(w, "LOCAL_PREBUILT_MODULE_FILE :=", p.outputFilePath.String())
|
fmt.Fprintln(w, "LOCAL_PREBUILT_MODULE_FILE :=", p.outputFilePath.String())
|
||||||
fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", "$(OUT_DIR)/"+p.installDirPath.RelPathString())
|
fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", "$(OUT_DIR)/"+p.installDirPath.RelPathString())
|
||||||
|
@@ -15,8 +15,11 @@
|
|||||||
package android
|
package android
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bufio"
|
||||||
|
"bytes"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -130,3 +133,47 @@ func TestPrebuiltEtcGlob(t *testing.T) {
|
|||||||
t.Errorf("expected bar.conf, got %q", p.outputFilePath.Base())
|
t.Errorf("expected bar.conf, got %q", p.outputFilePath.Base())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestPrebuiltEtcAndroidMk(t *testing.T) {
|
||||||
|
ctx := testPrebuiltEtc(t, `
|
||||||
|
prebuilt_etc {
|
||||||
|
name: "foo",
|
||||||
|
src: "foo.conf",
|
||||||
|
owner: "abc",
|
||||||
|
filename_from_src: true,
|
||||||
|
}
|
||||||
|
`)
|
||||||
|
|
||||||
|
data := AndroidMkData{}
|
||||||
|
data.Required = append(data.Required, "modA", "moduleB")
|
||||||
|
|
||||||
|
expected := map[string]string{
|
||||||
|
"LOCAL_MODULE": "foo",
|
||||||
|
"LOCAL_MODULE_CLASS": "ETC",
|
||||||
|
"LOCAL_MODULE_OWNER": "abc",
|
||||||
|
"LOCAL_INSTALLED_MODULE_STEM": "foo.conf",
|
||||||
|
"LOCAL_REQUIRED_MODULES": "modA moduleB",
|
||||||
|
}
|
||||||
|
|
||||||
|
mod := ctx.ModuleForTests("foo", "android_arm64_armv8-a_core").Module().(*PrebuiltEtc)
|
||||||
|
buf := &bytes.Buffer{}
|
||||||
|
mod.AndroidMk().Custom(buf, "foo", "", "", data)
|
||||||
|
for k, expected := range expected {
|
||||||
|
found := false
|
||||||
|
scanner := bufio.NewScanner(bytes.NewReader(buf.Bytes()))
|
||||||
|
for scanner.Scan() {
|
||||||
|
line := scanner.Text()
|
||||||
|
tok := strings.Split(line, " := ")
|
||||||
|
if tok[0] == k {
|
||||||
|
found = true
|
||||||
|
if tok[1] != expected {
|
||||||
|
t.Errorf("Incorrect %s '%s', expected '%s'", k, tok[1], expected)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if !found {
|
||||||
|
t.Errorf("No %s defined, saw %s", k, buf.String())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user