Merge "Add vintf_fragments."
diff --git a/cmd/pom2mk/pom2mk.go b/cmd/pom2mk/pom2mk.go
index 4fc484c..b4659f7 100644
--- a/cmd/pom2mk/pom2mk.go
+++ b/cmd/pom2mk/pom2mk.go
@@ -89,6 +89,16 @@
var useVersion string
var staticDeps bool
+func InList(s string, list []string) bool {
+ for _, l := range list {
+ if l == s {
+ return true
+ }
+ }
+
+ return false
+}
+
type Dependency struct {
XMLName xml.Name `xml:"dependency"`
@@ -139,19 +149,19 @@
}
func (p Pom) MkJarDeps() []string {
- return p.MkDeps("jar", "compile")
+ return p.MkDeps("jar", []string{"compile", "runtime"})
}
func (p Pom) MkAarDeps() []string {
- return p.MkDeps("aar", "compile")
+ return p.MkDeps("aar", []string{"compile", "runtime"})
}
// MkDeps obtains dependencies filtered by type and scope. The results of this
// method are formatted as Make targets, e.g. run through MavenToMk rules.
-func (p Pom) MkDeps(typeExt string, scope string) []string {
+func (p Pom) MkDeps(typeExt string, scopes []string) []string {
var ret []string
for _, d := range p.Dependencies {
- if d.Type != typeExt || d.Scope != scope {
+ if d.Type != typeExt || !InList(d.Scope, scopes) {
continue
}
name := rewriteNames.MavenToMk(d.GroupId, d.ArtifactId)
@@ -350,6 +360,7 @@
poms := []*Pom{}
modules := make(map[string]*Pom)
+ duplicate := false
for _, filename := range filenames {
pom, err := parse(filename)
if err != nil {
@@ -363,12 +374,15 @@
if old, ok := modules[key]; ok {
fmt.Fprintln(os.Stderr, "Module", key, "defined twice:", old.PomFile, pom.PomFile)
- os.Exit(1)
+ duplicate = true
}
modules[key] = pom
}
}
+ if duplicate {
+ os.Exit(1)
+ }
for _, pom := range poms {
pom.FixDeps(modules)