aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/syntax
Commit message (Collapse)AuthorAge
* Set default value of incompatible_load_argument_is_label to true.Gravatar laurentlb2017-12-04
| | | | | | | RELNOTES: First argument of 'load' must be a label. Path syntax is removed. (label should start with '//' or ':'). PiperOrigin-RevId: 177802628
* Fix missing print statements in output functionsGravatar vladmos2017-12-02
| | | | PiperOrigin-RevId: 177708823
* Do not filter debug messagesGravatar vladmos2017-11-30
| | | | | | | Debug messages (generated with Skylark's `print` function) used to be filtered out by the output filter: if such messages are generated during the analysis phase in a package different to the target package (e.g. if a user builds //foo:foo and the message is generated in a dependency //bar:bar), the message are not shown by default, which makes an erroneous impression that the code for //bar:bar hasn't been executed at all and interferes with debugging. Now the output filter doesn't affect debug messages at all. RELNOTES: Debug messages generated by `print()` are not being filtered out by --output_filter anymore, it's recommended not to use them in production code. PiperOrigin-RevId: 177431255
* Remove the deprecated set constructor from SkylarkGravatar vladmos2017-11-21
| | | | | | | | | | | | The `set` constructor used to be deprecated, but it was still possible to use it by providing --incompatible_disallow_set_constructor=false. It's still allowed to have `set` in parts of the code that are not executed, this will be deprecated later. You can check if your code is compatible with this future change by using the flag --incompatible_disallow_uncalled_set_constructor (currently the default is "false"). RELNOTES[INC]: The flag --incompatible_disallow_set_constructor is no longer available, the deprecated `set` constructor is not available anymore. PiperOrigin-RevId: 176491641
* Remove the deprecated set constructor from SkylarkGravatar vladmos2017-11-20
| | | | | | | | | | | | | The `set` constructor used to be deprecated, but it was still possible to use it by providing --incompatible_disallow_set_constructor=false. It's still allowed to have `set` in parts of the code that are not executed, this will be deprecated later. RELNOTES[INC]: The deprecated `set` constructor is removed, along with the migration flag --incompatible_disallow_set_constructor. It is still temporarily allowed to refer to `set` from within unexecuted code. PiperOrigin-RevId: 176375859
* Replace all usages of Blaze's Preconditions class with guava.Gravatar tomlu2017-11-09
| | | | | | | | Blaze had its own class to avoid GC from varargs array creation for the precondition happy path. Guava now (mostly) implements these, making it unnecessary to maintain our own. This change was almost entirely automated by search-and-replace. A few BUILD files needed fixing up since I removed an export of preconditions from lib:util, which was all done by add_deps. There was one incorrect usage of Preconditions that was caught by error prone (which checks Guava's version of Preconditions) that I had to change manually. PiperOrigin-RevId: 175033526
* Break dependency on vfs from the interface of syntax and cmdline.Gravatar tomlu2017-11-06
| | | | | | | | These libs are exposed externally, implying that the vfs is also exposed externally. We break out PathFragment from vfs to still use this in their interface. This class is a much smaller dependency than the entire vfs. PiperOrigin-RevId: 174729373
* Expose late-bound-attributes to Skylark.Gravatar cparsons2017-11-06
| | | | | RELNOTES: Late-bound attributes are exposed to skylark. This is a new API (`configuration_field()`) to depend on certain configuration-defined targets from skylark rules. PiperOrigin-RevId: 174534104
* Fix SelectorList.isListType to properly consider all classes that can be ↵Gravatar jcater2017-10-27
| | | | | | assigned to java.util.List, not just ArrayList. PiperOrigin-RevId: 173577936
* Clarify sanity check error messageGravatar brandjon2017-10-25
| | | | | RELNOTES: None PiperOrigin-RevId: 173302354
* Parser: fix incorrect end location for statement suites.Gravatar fzaiser2017-10-24
| | | | | | | This used to be annoying for Skylint. RELNOTES: none PiperOrigin-RevId: 173249428
* Remove unnecessary EvalException from UserDefinedFunction contructorGravatar michajlo2017-10-24
| | | | | RELNOTES: None PiperOrigin-RevId: 173156016
* Optimize recursive call detectionGravatar michajlo2017-10-24
| | | | | | | No need to contruct a list for each function call RELNOTES: None PiperOrigin-RevId: 173144689
* Preserve `pass` statements in the Skylark AST.Gravatar fzaiser2017-10-23
| | | | | RELNOTES: none PiperOrigin-RevId: 173125138
* Automated rollback of commit 1b98de65873054b148ced772cfa827a7bfb5ad9a.Gravatar dslomov2017-10-23
| | | | | | | | | | | | | | | | | | | *** Reason for rollback *** If the 'set' function was used in a .bzl file but not called, --incompatible_disallow_set_constructor=True would allow the load of that .bzl file without error, but this change removes the 'set' function so loading that bzl file is an error. Example failure: https://ci.bazel.io/blue/organizations/jenkins/Global%2FTensorFlow/detail/TensorFlow/245/pipeline/ *** Original change description *** Remove the deprecated set constructor from Skylark The `set` constructor used to be deprecated, but it was still possible to use it by providing --incompatible_disallow_set_constructor=false. RELNOTES[INC]: The flag --incompatible_disallow_set_constructor is no longer available, the deprecated `set` constructor is not available anymore. PiperOrigin-RevId: 173115983
* Micro-optimize mutablelist concatenationGravatar michajlo2017-10-23
| | | | | | | | Avoid ArrayList.addAll(Collection) winds up converting the collection to an array, which is wasteful on such a potentially hot code path. RELNOTES: None PiperOrigin-RevId: 172941634
* Don't set globals in environments that aren't readGravatar brandjon2017-10-23
| | | | | | | There are two Environments involved in running an implementation callback for rules/aspects/repository-rules: (1) The static environment of the function's definition, and (2) the caller's dynamic environment. The function will only consult (1), so trying to set anything on (2) is misleading. RELNOTES: None PiperOrigin-RevId: 172929301
* Require semantics field for Environment.BuilderGravatar brandjon2017-10-23
| | | | | | | Follow-up of unknown commit. RELNOTES: None PiperOrigin-RevId: 172922507
* Be explicit about semantics of Skylark environmentsGravatar brandjon2017-10-23
| | | | | | | | | All callers that do not use Environment.Builder#setSemantics should call #useDefaultSemantics. A follow-up CL will enforce this requirement. Motivation: It's more important that we are strict about semantics than about the other builder args. It's too easy for a mistake in semantics to go unnoticed. RELNOTES: None PiperOrigin-RevId: 172912829
* Allow ClassObjects to throw EvalExceptions.Gravatar dslomov2017-10-23
| | | | | | | Preparations to fix https://github.com/bazelbuild/bazel/issues/3826. RELNOTES: None. PiperOrigin-RevId: 172876802
* Add useDefaultSemantics() to Enviornment.BuilderGravatar brandjon2017-10-20
| | | | | RELNOTES: None PiperOrigin-RevId: 172801656
* Add memory profiler.Gravatar tomlu2017-10-18
| | | | | | | | | | | This adds two dump command, bazel dump --rules and bazel dump --skylark_memory. dump --rules outputs a summary of the count, action count, and memory consumption of each rule and aspect class. dump --skylark_memory outputs a pprof-compatible file with all Skylark analysis allocations. Users can then use pprof as per normal to analyse their builds. RELNOTES: Add memory profiler. PiperOrigin-RevId: 172558600
* Optimize trusted MutableList constructionGravatar michajlo2017-10-18
| | | | | | | | | | | | Cuts back a lot of unnecessary copying. All construction is funneled through copyOf and wrapUnsafe. copyOf is the traditional construction mechanism, taking defensive copies of the input and determining if GlobList information needs to be retained. wrapUnsafe takes full ownership of the supplied ArrayList, allowing us to skip a lot of copies in trusted situations. This is particularly useful for common built in functions which return a list, range() being one common example. RELNOTES: None PiperOrigin-RevId: 172361367
* Flip the --incompatible_list_plus_equals_inplace flag by defaultGravatar vladmos2017-10-16
| | | | | | | | | RELNOTES[INC]: += on lists now mutates them. `list1 += list2` is now equivalent to `list1.extend(list2)` and not equivalent to `list1 = list1 + list2` anymore. Fixes #2350. PiperOrigin-RevId: 172111899
* Remove the deprecated set constructor from SkylarkGravatar vladmos2017-10-13
| | | | | | | | | | The `set` constructor used to be deprecated, but it was still possible to use it by providing --incompatible_disallow_set_constructor=false. RELNOTES[INC]: The flag --incompatible_disallow_set_constructor is no longer available, the deprecated `set` constructor is not available anymore. PiperOrigin-RevId: 171962361
* Remove deprecated legacy string representations of Skylark objectsGravatar vladmos2017-10-13
| | | | | | | | RELNOTES[INC]: The flag --incompatible_descriptive_string_representations is no longer available, old style string representations of objects are not supported anymore. PiperOrigin-RevId: 171952621
* Fix the location of load statements in Skylark.Gravatar fzaiser2017-10-10
| | | | | | | Previously, the closing parenthesis was not included in the location. RELNOTES: none PiperOrigin-RevId: 171527078
* Reduce iterator usage on hot code pathsGravatar michajlo2017-10-07
| | | | | | | | Micro-optimize a few hot code paths which have a habit of iterating over short O(1)-access lists. RELNOTES: None PiperOrigin-RevId: 171347524
* Move SkylarkSemanticsOptions to the packages/ directory, alongside ↵Gravatar brandjon2017-10-07
| | | | | | | | | SkylarkSemanticsCodec Note that the syntax package and its test package still depend indirectly on the options parser via other Bazel-specific packages. RELNOTES: None PiperOrigin-RevId: 171342823
* Pass SkylarkSemantics through Skyframe instead of the options classGravatar brandjon2017-10-06
| | | | | | | Also remove the use of the @UsesOnlyCoreTypes annotation on SkylarkSemanticsOptions. It was only there to help mark that the options class was safe to put in Skyframe. RELNOTES: None PiperOrigin-RevId: 171248504
* Migrate from deprecated MutableList constructor to copyOf, fixing bug in latterGravatar michajlo2017-10-06
| | | | PiperOrigin-RevId: 171176871
* Use SkylarkSemantics in place of options class in the interpreterGravatar brandjon2017-10-06
| | | | | | | Mainly this just means using getters instead of fields to access option values. RELNOTES: None PiperOrigin-RevId: 171101597
* Skylark Documentation: sort methods by method signatureGravatar dmarting2017-10-06
| | | | | | | getMethods ordering is not guaranteed and actually change depending on minor difference in the class path. PiperOrigin-RevId: 171093246
* Split off SkylarkSemanticsOptions into an immutable classGravatar brandjon2017-10-06
| | | | | | | | | | | This is a first step toward making the core Skylark interpreter (the syntax/ directory) not depend on the options parser. Subsequent CLs will replace uses of SkylarkSemanticsOptions within the interpreter with uses of SkylarkSemantics, and move SkylarkSemanticsOptions to the packages/ directory alongside SkylarkSemanticsCodec. SkylarkSemantics will also replace SkylarkSemanticsOptions as the value that gets passed through Skyframe. This is nice because SkylarkSemantics is strictly immutable, whereas options classes are only kinda-sorta-immutable. The downside is significantly more redundancy when defining new options. But some of the work is saved by using AutoValue, and there are tests that protect us from dumb mechanical errors. The details are outlined in the javadoc for SkylarkSemanticsOptions and SkylarkSemanticsConsistencyTest. RELNOTES: None PiperOrigin-RevId: 171060034
* Skylark parser: make the end position of location ranges inclusive.Gravatar fzaiser2017-10-06
| | | | | | | | | Previously, the end line and column of a location were the position past the actual end of a location. This makes sense for the end offset, because one can use `input.substring(startOffset, endOffset)` to get the string belonging to an ASTNode. However the line and column (as opposed to the offset) aren't used for that. Therefore I made the change that the end line and column now point to the last character in the location. This is also they way every compiler I know does it. RELNOTES: none PiperOrigin-RevId: 170723732
* New depset() APIGravatar dslomov2017-09-29
| | | | | | | | | | | | | `depset` constructor has new arguments, `direct` and `transitive`. `items` argument is deprecated and after its removal `direct` will become a sole positional argument. If `transitive` and `items` are specified, `items` must be a list of direct elements. In the absence of `transitive` the value of `items` can also be a depset, but that behavior is deprecated. RELNOTES: New depset API PiperOrigin-RevId: 170346194
* Clarify Mutability invariants, refactor some testsGravatar brandjon2017-09-29
| | | | | RELNOTES: None PiperOrigin-RevId: 170343759
* Removed unsafe public API methods for mutable types (list/dict)Gravatar brandjon2017-09-28
| | | | | | | Instead of this escape hatch, we'll encourage outside code to construct and use a legitimate Mutability object. RELNOTES: None PiperOrigin-RevId: 170210739
* Fix end offset of expressions in Skylark parserGravatar fzaiser2017-09-26
| | | | | | | | | | | | | This CL doesn't fix all of the problems. The end location of blocks after an if, elif, else and for is still wrong. (I added TODOs for them) The latter is not easy to fix: One might think that one could just set the end location of a block to the end location of the last statement. However, if the last statement is a "pass" statement, this is not preserved in the AST, in particular, there's no location for it. In the future, we probably want to preserve "pass" statements. RELNOTES: none PiperOrigin-RevId: 170028466
* Don't generate the mutability annotation until necessary.Gravatar shreyax2017-09-26
| | | | PiperOrigin-RevId: 169969136
* Check parameter types for methods when multiple types are allowed.Gravatar Dmitry Lomov2017-09-25
| | | | | | | | | | | | | | | Relanding https://github.com/bazelbuild/bazel/commit/17214ac78ffaec369d5d5bafe62a39730473cfaa with fixes to 'repository_ctx.download()' and 'repository_ctx.download_and_extract()'. I reviewed other usages of @ParamType annotation - I do not think there are more issues. Fixes #3714. Change-Id: I17087ef3fc2d28ab99224740a2164675a49847d3 PiperOrigin-RevId: 169896223
* Cleanups for Skylark tracebacksGravatar brandjon2017-09-25
| | | | | | | | | | | In Skylark.java, fix line numbers to start at 1 instead of 2. In Eval.java, go through maybeTransformException for consistency with expressions, even though no statement nodes use this feature. In EvalExceptionWithStackTrace, fix style violation (non-consecutive overloads) and add TODO explaining an open issue. RELNOTES: None PiperOrigin-RevId: 169769928
* Remove wasteful function.toString() call in evalArgs. Also remove functions ↵Gravatar shreyax2017-09-25
| | | | | | that were public because of skylark compilation. PiperOrigin-RevId: 169739373
* Automated rollback of commit 17214ac78ffaec369d5d5bafe62a39730473cfaa.Gravatar dslomov2017-09-22
| | | | | | | | | | | | | | | | | | *** Reason for rollback *** Rolled back commit enforces stricter parameter checks. Will fix and roll forward This creates several failures on the nightly build of Bazel: ERROR: /home/ci/workspace/Global/rules_closure-node=linux-x86_64/closure/protobuf/test/BUILD:23:1: no such package '@com_google_protobuf_protoc//': Cannot convert parameter 'url' to type string or sequence of strings, in method download_and_extract(List, string, string, string, string) of 'repository_ctx' and referenced by '//closure/protobuf/test:example_proto_gen'. ERROR: Analysis of target '//closure/protobuf/test:example_lib' failed; build aborted: no such package '@com_google_protobuf_protoc//': Cannot convert parameter 'url' to type string or sequence of strings, in method download_and_extract(List, string, string, string, string) of 'repository_ctx'. *** Original change description *** Check parameter types for methods when multiple types are allowed. Fixes #3714 RELNOTES: None. PiperOrigin-RevId: 169669802
* Check parameter types for methods when multiple types are allowed.Gravatar dslomov2017-09-20
| | | | | | Fixes #3714 RELNOTES: None. PiperOrigin-RevId: 169382686
* use toList.contains for depset containsKey instead of toSetGravatar cparsons2017-09-19
| | | | | | | This should be a slight performance improvement on the previous implementation, as NestedSet.toSet() calls toList() and then throws the contents into a set RELNOTES: None. PiperOrigin-RevId: 169150743
* blaze: g3doc: fix closing HTML tagGravatar mpn2017-09-15
| | | | | RELNOTES: Tiny all() and any() documentation fix. PiperOrigin-RevId: 168767065
* Avoid wasting cpu/garbage formatting preconditions stringGravatar michajlo2017-09-14
| | | | | RELNOTES: None PiperOrigin-RevId: 168691489
* --incompatible_comprehension_variables_do_not_leak defaults to trueGravatar laurentlb2017-09-08
| | | | | | | | RELNOTES[INC]: --incompatible_comprehension_variables_do_not_leak defaults to "true." Iteration variable becomes inaccessible after a list/dict comprehension. PiperOrigin-RevId: 167876119
* Forbid duplicate keys in dictionary literalsGravatar laurentlb2017-09-07
| | | | | | | RELNOTES: When using the dictionary literal syntax, it is now an error to have duplicated keys (e.g. {'ab': 3, 'ab': 5}). PiperOrigin-RevId: 167750614