Merge "Apply "excludes" for OutputFileProducer"
This commit is contained in:
@@ -380,6 +380,18 @@ func (e missingDependencyError) Error() string {
|
||||
}
|
||||
|
||||
func expandOneSrcPath(ctx ModuleContext, s string, expandedExcludes []string) (Paths, error) {
|
||||
excludePaths := func(paths Paths) Paths {
|
||||
if len(expandedExcludes) == 0 {
|
||||
return paths
|
||||
}
|
||||
remainder := make(Paths, 0, len(paths))
|
||||
for _, p := range paths {
|
||||
if !InList(p.String(), expandedExcludes) {
|
||||
remainder = append(remainder, p)
|
||||
}
|
||||
}
|
||||
return remainder
|
||||
}
|
||||
if m, t := SrcIsModuleWithTag(s); m != "" {
|
||||
module := ctx.GetDirectDepWithTag(m, sourceOrOutputDepTag(t))
|
||||
if module == nil {
|
||||
@@ -390,20 +402,11 @@ func expandOneSrcPath(ctx ModuleContext, s string, expandedExcludes []string) (P
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("path dependency %q: %s", s, err)
|
||||
}
|
||||
return outputFiles, nil
|
||||
return excludePaths(outputFiles), nil
|
||||
} else if t != "" {
|
||||
return nil, fmt.Errorf("path dependency %q is not an output file producing module", s)
|
||||
} else if srcProducer, ok := module.(SourceFileProducer); ok {
|
||||
moduleSrcs := srcProducer.Srcs()
|
||||
for _, e := range expandedExcludes {
|
||||
for j := 0; j < len(moduleSrcs); j++ {
|
||||
if moduleSrcs[j].String() == e {
|
||||
moduleSrcs = append(moduleSrcs[:j], moduleSrcs[j+1:]...)
|
||||
j--
|
||||
}
|
||||
}
|
||||
}
|
||||
return moduleSrcs, nil
|
||||
return excludePaths(srcProducer.Srcs()), nil
|
||||
} else {
|
||||
return nil, fmt.Errorf("path dependency %q is not a source file producing module", s)
|
||||
}
|
||||
@@ -418,8 +421,7 @@ func expandOneSrcPath(ctx ModuleContext, s string, expandedExcludes []string) (P
|
||||
reportPathErrorf(ctx, "module source path %q does not exist", p)
|
||||
}
|
||||
|
||||
j := findStringInSlice(p.String(), expandedExcludes)
|
||||
if j >= 0 {
|
||||
if InList(p.String(), expandedExcludes) {
|
||||
return nil, nil
|
||||
}
|
||||
return Paths{p}, nil
|
||||
|
Reference in New Issue
Block a user