use of com.google.devtools.build.lib.packages.Globber.BadGlobException in project bazel by bazelbuild.
the class PackageFactory method handleGlob.
/**
* Adds a glob to the package, reporting any errors it finds.
*
* @param includes the list of includes which must be non-null
* @param excludes the list of excludes which must be non-null
* @param context the package context
* @param ast the AST
* @return the list of matches
* @throws EvalException if globbing failed
*/
private static GlobList<String> handleGlob(List<String> includes, List<String> excludes, boolean excludeDirs, PackageContext context, FuncallExpression ast) throws EvalException, InterruptedException {
try {
Globber.Token globToken = context.globber.runAsync(includes, excludes, excludeDirs);
List<String> matches = context.globber.fetch(globToken);
return GlobList.captureResults(includes, excludes, matches);
} catch (IOException expected) {
context.eventHandler.handle(Event.error(ast.getLocation(), "error globbing [" + Joiner.on(", ").join(includes) + "]: " + expected.getMessage()));
context.pkgBuilder.setContainsErrors();
return GlobList.captureResults(includes, excludes, ImmutableList.<String>of());
} catch (BadGlobException e) {
throw new EvalException(ast.getLocation(), e.getMessage());
}
}
Aggregations