diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2018-04-23 18:57:17 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2018-04-23 18:57:17 +0000 |
commit | c86f03385e85e98a7ff2c8649a85e3ede33f2279 (patch) | |
tree | 1765b2faed44538a287646d0c9d5699cdf4fb9fe /cmd | |
parent | 74d547d13c7fd167e78fa059d1eec9a4e5dadea0 (diff) | |
parent | 15a7f831046d5c277ad8159f4452210ad9f0caa5 (diff) | |
download | build_soong-c86f03385e85e98a7ff2c8649a85e3ede33f2279.tar.gz build_soong-c86f03385e85e98a7ff2c8649a85e3ede33f2279.tar.bz2 build_soong-c86f03385e85e98a7ff2c8649a85e3ede33f2279.zip |
Merge "Have pom2mk include runtime deps too" into pi-dev
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/pom2mk/pom2mk.go | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/cmd/pom2mk/pom2mk.go b/cmd/pom2mk/pom2mk.go index bf478961..d45067fc 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,19 @@ 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 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) @@ -363,7 +373,6 @@ 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) } modules[key] = pom |