aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2018-04-24 07:21:16 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2018-04-24 07:21:16 +0000
commit7653693afd643cea02d50b6bf01e6bc3dd86bd54 (patch)
tree66b3629cb180c7aac4aa4d2a5ee17b92f25c4b8e
parentaab3e62e8eeb7822813f9cf8c34714ab0c390d1e (diff)
parent2cc7d9fc783eabbf9ba4bf939a8cdf8569a59254 (diff)
downloadbuild_soong-7653693afd643cea02d50b6bf01e6bc3dd86bd54.tar.gz
build_soong-7653693afd643cea02d50b6bf01e6bc3dd86bd54.tar.bz2
build_soong-7653693afd643cea02d50b6bf01e6bc3dd86bd54.zip
Snap for 4739962 from 2cc7d9fc783eabbf9ba4bf939a8cdf8569a59254 to pi-release
Change-Id: I137fb360d77f235fe68a43c2a2692a6e66e27469
-rw-r--r--cmd/pom2mk/pom2mk.go28
1 files changed, 23 insertions, 5 deletions
diff --git a/cmd/pom2mk/pom2mk.go b/cmd/pom2mk/pom2mk.go
index bf478961..a609860a 100644
--- a/cmd/pom2mk/pom2mk.go
+++ b/cmd/pom2mk/pom2mk.go
@@ -89,6 +89,16 @@ var sdkVersion string
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,23 @@ func (p Pom) MkName() string {
}
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
+ if typeExt == "jar" {
+ // all top-level extra deps are assumed to be of type "jar" until we add syntax to specify other types
+ ret = append(ret, extraDeps[p.MkName()]...)
+ }
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 +364,7 @@ The makefile is written to stdout, to be put in the current directory (often as
poms := []*Pom{}
modules := make(map[string]*Pom)
+ duplicate := false
for _, filename := range filenames {
pom, err := parse(filename)
if err != nil {
@@ -363,12 +378,15 @@ The makefile is written to stdout, to be put in the current directory (often as
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)