diff options
author | Laurent Le Brun <laurentlb@google.com> | 2016-07-12 12:47:53 +0000 |
---|---|---|
committer | Kristina Chodorow <kchodorow@google.com> | 2016-07-13 11:15:26 +0000 |
commit | 68ac6be904ea57dd50fd1d1df946660d55bbf8a2 (patch) | |
tree | 13348399890ac79f609db5c00a138ec5ca39a931 /src/main | |
parent | 56b16e75ab84007772db78c694729696c4f7cf05 (diff) |
Glob arguments 'exclude' and 'exclude_directories' must be named
Unamed arguments are confusing, e.g.
glob(["*.java"], ["testing/*.java"])
The second list is actually excluded.
RELNOTES: Glob arguments 'exclude' and 'exclude_directories' must be named
--
MOS_MIGRATED_REVID=127190991
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/packages/PackageFactory.java | 63 |
1 files changed, 45 insertions, 18 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/packages/PackageFactory.java b/src/main/java/com/google/devtools/build/lib/packages/PackageFactory.java index f242aebb1a..c05e178b35 100644 --- a/src/main/java/com/google/devtools/build/lib/packages/PackageFactory.java +++ b/src/main/java/com/google/devtools/build/lib/packages/PackageFactory.java @@ -477,35 +477,62 @@ public final class PackageFactory { return packageArguments.build(); } - /**************************************************************************** - * Environment function factories. + /** + * ************************************************************************** Environment function + * factories. */ /** * Returns a function-value implementing "glob" in the specified package context. * - * @param async if true, start globs in the background but don't block on their completion. - * Only use this for heuristic preloading. + * @param async if true, start globs in the background but don't block on their completion. Only + * use this for heuristic preloading. */ - @SkylarkSignature(name = "glob", objectType = Object.class, returnType = SkylarkList.class, - doc = "Returns a list of files that match glob search pattern", - parameters = { - @Param(name = "include", type = SkylarkList.class, generic1 = String.class, - doc = "a list of strings specifying patterns of files to include."), - @Param(name = "exclude", type = SkylarkList.class, generic1 = String.class, - defaultValue = "[]", - doc = "a list of strings specifying patterns of files to exclude."), - // TODO(bazel-team): migrate all existing code to use boolean instead? - @Param(name = "exclude_directories", type = Integer.class, defaultValue = "1", - doc = "a integer that if non-zero indicates directories should not be matched.")}, - documented = false, useAst = true, useEnvironment = true) + @SkylarkSignature( + name = "glob", + objectType = Object.class, + returnType = SkylarkList.class, + doc = "Returns a list of files that match glob search pattern", + parameters = { + @Param( + name = "include", + type = SkylarkList.class, + generic1 = String.class, + doc = "a list of strings specifying patterns of files to include." + ), + @Param( + name = "exclude", + type = SkylarkList.class, + generic1 = String.class, + defaultValue = "[]", + positional = false, + named = true, + doc = "a list of strings specifying patterns of files to exclude." + ), + // TODO(bazel-team): migrate all existing code to use boolean instead? + @Param( + name = "exclude_directories", + type = Integer.class, + defaultValue = "1", + positional = false, + named = true, + doc = "a integer that if non-zero indicates directories should not be matched." + ) + }, + documented = false, + useAst = true, + useEnvironment = true + ) private static final BuiltinFunction.Factory newGlobFunction = new BuiltinFunction.Factory("glob") { public BuiltinFunction create(final PackageContext originalContext, final boolean async) { return new BuiltinFunction("glob", this) { public SkylarkList invoke( - SkylarkList include, SkylarkList exclude, Integer excludeDirectories, - FuncallExpression ast, Environment env) + SkylarkList include, + SkylarkList exclude, + Integer excludeDirectories, + FuncallExpression ast, + Environment env) throws EvalException, ConversionException, InterruptedException { return callGlob( originalContext, async, include, exclude, excludeDirectories != 0, ast, env); |