Have pom2mk include runtime deps too
It still excludes test deps though Bug: 76692459 Test: ./update_current.py -x <build-id> Change-Id: I55a786e9feab31f99b95b7cebe84869757e46270
This commit is contained in:
@@ -89,6 +89,16 @@ var sdkVersion string
|
|||||||
var useVersion string
|
var useVersion string
|
||||||
var staticDeps bool
|
var staticDeps bool
|
||||||
|
|
||||||
|
func InList(s string, list []string) bool {
|
||||||
|
for _, l := range list {
|
||||||
|
if l == s {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
type Dependency struct {
|
type Dependency struct {
|
||||||
XMLName xml.Name `xml:"dependency"`
|
XMLName xml.Name `xml:"dependency"`
|
||||||
|
|
||||||
@@ -139,19 +149,19 @@ func (p Pom) MkName() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p Pom) MkJarDeps() []string {
|
func (p Pom) MkJarDeps() []string {
|
||||||
return p.MkDeps("jar", "compile")
|
return p.MkDeps("jar", []string{"compile", "runtime"})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p Pom) MkAarDeps() []string {
|
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
|
// MkDeps obtains dependencies filtered by type and scope. The results of this
|
||||||
// method are formatted as Make targets, e.g. run through MavenToMk rules.
|
// 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
|
var ret []string
|
||||||
for _, d := range p.Dependencies {
|
for _, d := range p.Dependencies {
|
||||||
if d.Type != typeExt || d.Scope != scope {
|
if d.Type != typeExt || !InList(d.Scope, scopes) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
name := rewriteNames.MavenToMk(d.GroupId, d.ArtifactId)
|
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 {
|
if old, ok := modules[key]; ok {
|
||||||
fmt.Fprintln(os.Stderr, "Module", key, "defined twice:", old.PomFile, pom.PomFile)
|
fmt.Fprintln(os.Stderr, "Module", key, "defined twice:", old.PomFile, pom.PomFile)
|
||||||
os.Exit(1)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
modules[key] = pom
|
modules[key] = pom
|
||||||
|
Reference in New Issue
Block a user