Convert java.Dependency to JavaInfo provider
Export information about java dependencies through a Provider instead of accessing the module directly. Test: java_test.go Test: no changes to build.ninja Change-Id: Ifc5d566bf6f6ebc0ad399e948effaa1ef6a22876
This commit is contained in:
@@ -1949,3 +1949,28 @@ type DataPath struct {
|
||||
// The install path of the data file, relative to the install root.
|
||||
RelativeInstallPath string
|
||||
}
|
||||
|
||||
// PathsIfNonNil returns a Paths containing only the non-nil input arguments.
|
||||
func PathsIfNonNil(paths ...Path) Paths {
|
||||
if len(paths) == 0 {
|
||||
// Fast path for empty argument list
|
||||
return nil
|
||||
} else if len(paths) == 1 {
|
||||
// Fast path for a single argument
|
||||
if paths[0] != nil {
|
||||
return paths
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
ret := make(Paths, 0, len(paths))
|
||||
for _, path := range paths {
|
||||
if path != nil {
|
||||
ret = append(ret, path)
|
||||
}
|
||||
}
|
||||
if len(ret) == 0 {
|
||||
return nil
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
Reference in New Issue
Block a user