aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/SkylarkAttr.java
Commit message (Collapse)AuthorAge
* Add ability to specify required aspect providers for aspects.Gravatar Dmitry Lomov2017-01-17
| | | | | | | | It is just a specification yet, it does nothing. -- PiperOrigin-RevId: 144687428 MOS_MIGRATED_REVID=144687428
* Mandatory cfg parameter for labels if executable=1 is providedGravatar Vladimir Moskva2017-01-13
| | | | | | | | RELNOTES[INC]: All executable labels must also have a cfg parameter specified. -- PiperOrigin-RevId: 144332992 MOS_MIGRATED_REVID=144332992
* Deprecated and removed HOST_CFG and DATA_CFG global variables.Gravatar Vladimir Moskva2017-01-10
| | | | | | | | RELNOTES[INC]: Deprecated globals HOST_CFG and DATA_CFG are removed. Use strings "host" and "data" instead. -- PiperOrigin-RevId: 144069794 MOS_MIGRATED_REVID=144069794
* Manually add periods to documentation strings where needed.Gravatar John Cater2017-01-03
| | | | | | | | -- Change-Id: I9ec3209a69ba5a51943b334f278ba93d67d4f9f4 Reviewed-on: https://cr.bazel.build/8090 PiperOrigin-RevId: 143470915 MOS_MIGRATED_REVID=143470915
* Exposes the Android split transition configuration to Skylark.Gravatar Alex Humesky2016-12-22
| | | | | | -- PiperOrigin-RevId: 142709934 MOS_MIGRATED_REVID=142709934
* Make SkylarkAttr.Descriptor thread-safe.Gravatar Dmitry Lomov2016-11-24
| | | | | | | Also fixes thread-unsafety in AttributeBuilder.build. -- MOS_MIGRATED_REVID=140118866
* Implement cfg="target" parameter for labelsGravatar Vladimir Moskva2016-11-23
| | | | | -- MOS_MIGRATED_REVID=140051032
* "File" is capitalized in doc filenameGravatar Googler2016-11-17
| | | | | -- MOS_MIGRATED_REVID=139364083
* Improve cfg-related warning messages by including a link to the relevant ↵Gravatar Florian Weikert2016-11-07
| | | | | | | | | documentation. Fixes #1877. -- MOS_MIGRATED_REVID=138199724
* Change allowedRuleClasses/mandatoryProviders semantics to "either-or" ↵Gravatar Dmitry Lomov2016-10-07
| | | | | | | | | | instead of "and". Also allow native rules to require declared providers on their dependencies. -- MOS_MIGRATED_REVID=135454750
* Deprecation warnings for deprecated syntaxGravatar Vladimir Moskva2016-09-16
| | | | | | | | | RELNOTES: Global varaiables HOST_CFG and DATA_CFG are deprecated in favor of strings "host" and "data. Argument `cfg = "host"` or `cfg = "data"` is mandatory if `executable = True` is provided for a label. -- MOS_MIGRATED_REVID=133285197
* Add support for aspects to attr.label() attributesGravatar Jon Brandvein2016-09-16
| | | | | | | | | Fixes #1739 RELNOTES: Add support for aspects to attr.label() attributes -- MOS_MIGRATED_REVID=133275712
* Rollback of commit 4381a1d6e8f711957f430aac0c301acec6dfa0eb.Gravatar Damien Martin-Guillerez2016-09-14
| | | | | | | | | | | | | *** Reason for rollback *** Breaks all projects using Bazel, see https://ci.bazel.io *** Original change description *** Deprecated and removed HOST_CFG and DATA_CFG global variables. -- MOS_MIGRATED_REVID=133005398
* Global cleanup change.Gravatar Vladimir Moskva2016-09-13
| | | | | -- MOS_MIGRATED_REVID=132976702
* Skylark no longer crashes when the default value of an attribute is a label ↵Gravatar Florian Weikert2016-09-06
| | | | | | | | | string that points to a remote repository. Fixes #1442. -- MOS_MIGRATED_REVID=132320130
* Roll forward of commit 19db71413329da3f5d22b5fc7681471f3d971d88 (Skylark: ↵Gravatar Florian Weikert2016-09-06
| | | | | | | | | | | | | Replaced late bound attributes with computed default attributes) with two bug fixes: 1. Unlike SkylarkComputedDefault, SkylarkComputedDefaultTemplate did not sort the names of its attribute dependencies. Consequently, lookup operations failed when callback functions in bzl files specified the names of their required attributes in a non-alphabetical order since the order of the key tuples was different (e.g. [1, 2] vs [2, 1]). It would be less error prone to always sort the dependencies in createDependencyAssignmentTuple(), but this would impact performance. 2. SkylarkCallbackFunction ignores the legacy "cfg" parameter in callback functions. This special case should be deleted once all cfg parameters have been removed from the depot. -- MOS_MIGRATED_REVID=132235927
* Rollback of commit 19db71413329da3f5d22b5fc7681471f3d971d88.Gravatar Tobias Werth2016-09-06
| | | | | -- MOS_MIGRATED_REVID=132058819
* Skylark: Replaced late bound attributes with computed default attributesGravatar Mark Schaller2016-09-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Motivation: Compared to computed default attributes, late bound attributes are evaluated in a later phase (analysis instead of loading phase). While both mechanisms provide access to other attributes of a rule, only late bound attributes additionally provide access to the build configuration. However, late bound attributes could be used to return new labels that have not been loaded before. Since this happens in the analysis phase, it can break one of Blaze's underlying principles, thus introducing a serious correctness bug. We decided to replace late bound attributes in Skylark with computed default attributes since this moves the evaluation of values into the loading phase, thus fixing this bug. Moreover, none of the existing users of this mechanism required access to the build configuration, which means that the user impact of this change is minimal. Implementation details: Unlike attributes of non-Skylark rules, however, Skylark computed defaults need to be able to depend on more than two configurable attributes since all attributes of Skylark rules are configurable by default. This has two implications: 1. Unlike "normal" Skylark attributes, Skylark computed defaults need to know about the existence of other attributes in order to declare a dependency on them. This CL takes advantage of work previously done to require parameter names to be the names of attributes used by the computed default function. 2. Since Bazel computes the combinations of all possible attribute values, a Skylark rule with a computed default that depends on a lot of configurable attributes could crash Bazel. Consequently, this CL also introduces an upper bound (64) for the number of valid combinations. Caveats: 1. Getting the depended-on attributes' names from function paramters is mildly surprising. Alternatives: The best solution would be to keep SkylarkLateBound, but restrict it in a way that it can only return already loaded labels. This is not possible right now. -- MOS_MIGRATED_REVID=131967238
* Fix the description of allow_empty arg on string_list.Gravatar Dmitry Shevchenko2016-08-01
| | | | | | | * Previously the doc stated that the argument is deprecated and to use itself. -- MOS_MIGRATED_REVID=128822795
* Prohibit duplicate addition of aspect to an attribute and improve diagnostics.Gravatar Dmitry Lomov2016-07-19
| | | | | -- MOS_MIGRATED_REVID=127808009
* Make sure that aspects are only added once to Skylark attribute defintion.Gravatar Dmitry Lomov2016-07-18
| | | | | -- MOS_MIGRATED_REVID=127701838
* For Skylark attribute creation, non_empty is deprecated; introduce allow_emptyGravatar Laurent Le Brun2016-07-07
| | | | | | | #1433 -- MOS_MIGRATED_REVID=126693120
* Attr doc: fix typo, add linkGravatar Laurent Le Brun2016-07-07
| | | | | -- MOS_MIGRATED_REVID=126691559
* Add allow_single_file in attr.label, deprecate single_file.Gravatar Laurent Le Brun2016-07-05
| | | | | -- MOS_MIGRATED_REVID=126620866
* Deprecate DATA_CFG and HOST_CFG, use string 'data' and 'host' instead.Gravatar Laurent Le Brun2016-07-04
| | | | | -- MOS_MIGRATED_REVID=126572660
* Reorganize Skylark Reference documentation.Gravatar Dmitry Lomov2016-06-29
| | | | | -- MOS_MIGRATED_REVID=126081020
* Use only one list of parameters for SkylarkSignatureGravatar Damien Martin-Guillerez2016-06-14
| | | | | | | | | | | | | Optional and named parameters are now specified using `defaultValue` and `named` (and `positional`). The new structure allow for parameters that are both named and positional (which was forbidden before). This new structure will be used to give the @SkylarkCallable annotation the possibility to provide named and default arguments. It should be a functional no-op for Bazel users. -- MOS_MIGRATED_REVID=124821455
* Have SkylarkAttr expose whether a skylark rule class attribute type is ↵Gravatar Nathan Harmata2016-06-10
| | | | | | | configurable or not. -- MOS_MIGRATED_REVID=124565334
* Extract the @Param annotation from @SkylarkSignatureGravatar Damien Martin-Guillerez2016-06-10
| | | | | | | | The @SkylarkCallable annotation is very limited and to extend it it is best to share a similar API than the @SkylarkSignature annotation. -- MOS_MIGRATED_REVID=124473056
* Use setLoadingOrWorkspacePhase instead of setLoadingPhase where relevant,Gravatar Damien Martin-Guillerez2016-05-23
| | | | | | | | | | | commit 3fedf9e618cbce3dbdd00559b2de0bb8e2d43171 introduced the distinction between the loading phase and the workspace phase. This check broke the use of native.existing_rule(s) in skylark remote repository, added a regression test for it. Fixes #1277 -- MOS_MIGRATED_REVID=122988569
* Skylark: allow_files can now accept a string list argumentGravatar Laurent Le Brun2016-05-12
| | | | | -- MOS_MIGRATED_REVID=122052644
* Expose parameterized aspects to Skylark.Gravatar Googler2016-05-09
| | | | | | | | | | | | | | | There are no syntactic changes within Skylark; the only difference is that aspects may have non-implicit attributes, so long as they have type 'string' and use the 'values' restriction. Such aspects may only be requested by rules which have attributes with types and names matching the non-implicit, non-defaulted attributes of the aspect. This is not yet a complete match for native AspectParameters functionality since implicit attributes cannot yet be affected by attribute values, but that will be added later. Implicit aspects are still required to have default values. Non-implicit aspect attributes are considered "required" unless they have a default value. An error will occur if they are applied to a rule that does not "cover" all required attributes by having attributes of matching name and type. While non-implicit aspect attributes with a default are not required, they will still take on the value of a rule attribute with the same name and type if it is present. Aspects with non-implicit, non-defaulted ("required") attributes cannot be requested on the command line, only by a rule. RELNOTES: Expose parameterized aspects to Skylark. -- MOS_MIGRATED_REVID=121711715
* Fixed indentation problem: 8 spaces -> 4 spacesGravatar Yun Peng2016-03-21
| | | | | -- MOS_MIGRATED_REVID=117583615
* Clean up attribute documentation hoping to make it clearer. Specifically ↵Gravatar Dave MacLachlan2016-03-02
| | | | | | | | | that labels and label_lists are actually of type Target, and adding more cross linking to various documentation to make it easier to peruse. Tested all of the links to make sure they work. -- MOS_MIGRATED_REVID=116076080
* Support "mandatoryProvidersList" in Skylark and added necessary testsGravatar Yun Peng2016-02-23
| | | | | | | | The type of attribute "providers" now is a list of lists of string. But a list of string is still supported. -- MOS_MIGRATED_REVID=115357326
* Reinstate mutable maps, again.Gravatar Francois-Rene Rideau2016-02-17
| | | | | -- MOS_MIGRATED_REVID=114860576
* Make Skylark "license"-type attributes non-configurable.Gravatar Greg Estren2016-02-05
| | | | | | | | | Bazel has custom loading-phase logic checking "licenses" attributes. Without this change, that logic fails with a "licenses is potentially configurable" error. -- MOS_MIGRATED_REVID=113890489
* Rollback of commit f941d56acfad5f8c819c81b494f806ea74ea7fd8.Gravatar Carmi Grushko2016-02-02
| | | | | | | | | | | | | | | | | | *** Reason for rollback *** Breaks many targets, see [] *** Original change description *** Reinstate mutable SkylarkDict Add <String, Object> annotation to optionMap invocation in SkylarkAttr, to make JDK 1.7 happy. Give the visible name "aspect" to class SkylarkAspect. -- MOS_MIGRATED_REVID=113543873
* Reinstate mutable SkylarkDictGravatar Francois-Rene Rideau2016-02-01
| | | | | | | | | | Add <String, Object> annotation to optionMap invocation in SkylarkAttr, to make JDK 1.7 happy. Give the visible name "aspect" to class SkylarkAspect. -- MOS_MIGRATED_REVID=113394826
* Rollback of commit c0a8c58b9230a1f5d76269eb7dc6b11e18f19686.Gravatar Damien Martin-Guillerez2016-01-29
| | | | | | | | | | | | | | | | | | | | | | | *** Reason for rollback *** Break Java 1.7 builds of Bazel. See http://ci.bazel.io/job/Bazel/JAVA_VERSION=1.7,PLATFORM_NAME=linux-x86_64/327/console Test: git clone ... && git revert c0a8c58 && export JAVA_VERSION=1.7 && export BAZEL_COMPILE_TARGET=compile && bash -c "source scripts/ci/build.sh; bazel_build" *** Original change description *** Make Skylark dicts mutable Represent Skylark dict using a new subclass SkylarkDict<K, V> of Map<K, V>. Back it with a TreeMap to provide a deterministic iteration order. Also make SkylarkList generic in its element type <E>. Have Artifact implement Comparable<Object> so it can be used as TreeMap key. -- MOS_MIGRATED_REVID=113359718
* Make Skylark dicts mutableGravatar Francois-Rene Rideau2016-01-29
| | | | | | | | | | Represent Skylark dict using a new subclass SkylarkDict<K, V> of Map<K, V>. Back it with a TreeMap to provide a deterministic iteration order. Also make SkylarkList generic in its element type <E>. Have Artifact implement Comparable<Object> so it can be used as TreeMap key. -- MOS_MIGRATED_REVID=113277489
* Move annotation classes used for referencing framework Java classes from ↵Gravatar John Field2015-12-16
| | | | | | | | | | | | | | Skylark into their own package. This allows, e.g., classes in the syntax package to access classes in the cmdline package without creating circular dependencies. While we're here: - Removed a couple of unused BUILD deps flagged in []. - Updated SkylarkRuleImplementationFunctionsTest to remove non-ASCII characters and clarify the intent of the test. -- MOS_MIGRATED_REVID=110360763
* Implement Skylark aspects originating from Skylark rules.Gravatar Dmitry Lomov2015-11-26
| | | | | -- MOS_MIGRATED_REVID=108777120
* Refactor Skylark rules and attributes in preparation to Skylark aspects.Gravatar Dmitry Lomov2015-11-26
| | | | | | | | | | | 1. attr.<type> functions return a wrapper object instead of Attribute.Builder dierctly. 2. RuleClass is created once per the life-time of RuleFunction, during export 3. Attributes are added to the RuleClass at exporting. -- MOS_MIGRATED_REVID=108774581
* Add Skylark support for string_list_dictGravatar Francois-Rene Rideau2015-10-30
| | | | | | | Convert to Skylark values when destructuring a sequence or map. -- MOS_MIGRATED_REVID=106591523
* Unify Skylark and BUILD listsGravatar Francois-Rene Rideau2015-10-20
| | | | | | | | Use SkylarkList everywhere rather than either List or GlobList. Keep a GlobList underneath a MutableList, where applicable. -- MOS_MIGRATED_REVID=105864035
* Rationalize copyright headersGravatar Damien Martin-Guillerez2015-09-25
| | | | | | | | | | | The headers were modified with `find . -type f -exec 'sed' '-Ei' 's|Copyright 201([45]) Google|Copyright 201\1 The Bazel Authors|' '{}' ';'` And manual edit for not Google owned copyright. Because of the nature of ijar, I did not modified the header of file owned by Alan Donovan. The list of authors were extracted from the git log. It is missing older Google contributors that can be added on-demand. -- MOS_MIGRATED_REVID=103938715
* Move Label from the lib.syntax to the lib.cmdline package so that:Gravatar Lukacs Berki2015-09-21
| | | | | | | | | | - Label parsing can be simplified - lib.syntax is only contains the code for Skylark and is reasonably independent from the problem domain of building things This change is mostly only changes to imports declarations. The rest is reversing the dependency between :cmdline and :syntax and moving a tiny amount of code between Printer and FilesetEntry and the addition of SkylarkPrintableValue that I couldn't be bothered to separate out into its own change. -- MOS_MIGRATED_REVID=103527877
* Separate build-specific types and types inherent to Skylark.Gravatar Lukacs Berki2015-09-21
| | | | | -- MOS_MIGRATED_REVID=103374106
* Refactor Skylark Environment-sGravatar Francois-Rene Rideau2015-09-11
| | | | | | | | | | | | | | | | | | | | Make Environment-s freezable: Introduce a class Mutability as a revokable capability to mutate objects in an Environment. For now, only Environment-s carry this capability. Make sure that every Mutability is revoked in the same function that create... This reinstates a change that previously rolled-back because it broke the serializability of SkylarkLookupValue. Bad news: serializing it succeeds for the wrong reason, because a SkylarkEnvironment was stored as a result (now an Environment.Extension) that was Serializable but inherited its bindings from an Environment (now an Environment.BaseExtension) which wasn't Serializable. Apparently, Java doesn't try to serialize the bindings then (or at least doesn't error out when it fails), because these bindings map variable names to pretty arbitrary objects, and a lot of those we find in practice aren't Serializable. Thus the current code passes the same tests as the previous code, but obviously the serialization is just as ineffective as it used to be. -- MOS_MIGRATED_REVID=102776694