aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/SkylarkRuleClassFunctions.java
Commit message (Collapse)AuthorAge
* Enable Aspects to specify their configuration fragment dependencies.Gravatar Michael Staib2016-01-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Note: This specification currently does not have any effect, but soon... In the default mode, when an aspect does not call any of the configuration fragment methods on its AspectDefinition.Builder, the old behavior will persist; aspects can only access fragments their associated rule has access to, and have no guarantee as to what those fragments are. This mode will become deprecated with a future CL. If an aspect does call a configuration fragment method, it will have a configuration fragment policy. In a future CL, this will mean it will be restricted to accessing only those fragments, but will be understood as requiring access to them for the purposes of dynamic configuration, even if the rule it is attached to or created by does not otherwise require them. Eventually, all aspects will be required to declare their configuration fragments this way. Skylark aspects may also declare configuration fragments as of this CL. Two new parameters are added to the aspect() function, fragments and host_fragments, mirroring the similar parameters for rules. If both of these parameters are empty or unspecified, the default mode is used, as with normal aspects. Also in this CL: * Minor javadoc fixes for AspectDefinition. * Additional tests for AspectDefinition. -- MOS_MIGRATED_REVID=112271713
* ConfigurationFragmentPolicy: assume Skylark names, allow merging.Gravatar Michael Staib2016-01-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In preparation for allowing aspects to have their own configuration fragments specified, allow ConfigurationFragmentPolicy.Builder to merge with built policies more easily, setting up SetMultimaps in place of maps of sets. This changes how named (Skylark) fragments are declared in the RuleContext builder, hopefully to be a bit easier to write. In order to do this, make SkylarkModuleNameResolver the only name resolver in use (because it is the only name resolver which exists) so as to not worry about collisions of different name resolvers. This also changes isLegalConfigurationFragment's one-argument form to mean "legal in ANY configuration" rather than "legal in the target (NONE) configuration", as that is how it's used by TransitiveTargetFunction. Uses of it to mean the latter have been revised to be more explicit. Also in this CL: * refactor ConfigurationFragmentPolicy to enforce its contracts about which ConfigurationTransitions are legal * use containsEntry or containsValue rather than looking in get(key) or values() for the configuration fragment multimaps * add tests for ConfigurationFragmentPolicy * make SkylarkModuleNameResolver a static method -- MOS_MIGRATED_REVID=112191439
* For native rule classes, (de)serialize only explicit attrsGravatar Mark Schaller2016-01-14
| | | | | | | | | | | Native rule classes can provide default values for rules after they're deserialized, so there isn't a need to serialize those default values. This doesn't apply yet to rules with Skylark-defined rule classes, due to the non-serializablity of Skylark rule classes. -- MOS_MIGRATED_REVID=112066930
* Expose output groups to Skylark.Gravatar Dmitry Lomov2015-12-28
| | | | | -- MOS_MIGRATED_REVID=110834841
* Document Skylark aspects.Gravatar Dmitry Lomov2015-12-22
| | | | | | | RELNOTES: Added ability to declare and use aspects in Skylark. -- MOS_MIGRATED_REVID=110763176
* 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 aspect attributes and expose them to aspect implementation function.Gravatar Dmitry Lomov2015-12-16
| | | | | -- MOS_MIGRATED_REVID=110356954
* Use Bazel Preconditions variant which avoids varargs array creationGravatar Mark Schaller2015-12-10
| | | | | | | Reduces garbage. -- MOS_MIGRATED_REVID=109914243
* Support skylark aspects in serialization/deserialization.Gravatar Dmitry Lomov2015-11-30
| | | | | -- MOS_MIGRATED_REVID=108964575
* Implements 'extra_deps' for Skylark aspects.Gravatar Dmitry Lomov2015-11-26
| | | | | -- MOS_MIGRATED_REVID=108779139
* 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
* Use Labels, rather than PathFragments, to represent Skylark loads ↵Gravatar John Field2015-11-13
| | | | | | | | | | | | | | | | | | | | | internally. The load location for a Skylark Aspect is specified via a PathFragment, for consistency with current non-Aspect Skylark loads. This should be a semantics-preserving change for users. In a subsequent CL, I'll change the Skylark syntax to allow load statements to use labels as well as paths, with the goal of eventually deprecating the latter. Also: - Removed the hack for handling relative loads in the prelude file. - Refactored some redundant functionality in PackageFunction and SkylarkImportLookupFunction for handling loads. - Removed the ability to put the BUILD file for the package containing a Skylark file under a different package root than the Skylark file itself. This functionality isn't currently used and is inconsistent with Blaze's handling of the package path elsewhere. - Added BUILD files to a number of tests that load Skylark files; this is consistent with the requirement that all Skylark files need to be part of some package. - Changed the constants used to set the location of the prelude file from paths to labels. -- MOS_MIGRATED_REVID=107741568
* Parametrize aspect definition with AspectParameters.Gravatar Dmitry Lomov2015-11-02
| | | | | -- MOS_MIGRATED_REVID=106848269
* Implement propagation along dependencies for Skylark aspects.Gravatar Dmitry Lomov2015-11-02
| | | | | -- MOS_MIGRATED_REVID=106694515
* 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
* Implement aspect(...) Skylark function.Gravatar Dmitry Lomov2015-10-20
| | | | | -- MOS_MIGRATED_REVID=105844221
* Rollback of commit ac7195025b073948785db8c6975a53fc305c5087.Gravatar Peter Schmitt2015-10-20
| | | | | | | | | | | | | *** Reason for rollback *** Uses tests that don't run on Bazel *** Original change description *** Implement aspect(...) Skylark function. -- MOS_MIGRATED_REVID=105808850
* Implement aspect(...) Skylark function.Gravatar Dmitry Lomov2015-10-16
| | | | | -- MOS_MIGRATED_REVID=105596479
* Add a Constants.TOOLS_PREFIX constant that will serve to redirect the Bazel ↵Gravatar Lukacs Berki2015-10-05
| | | | | | | | | | | tools repository. This is a no-op refactoring CL. The actual switch will be made once everything passes with the new setup. As a side cleanup, change the awkward realAndroidSdk() / realAndroidCrosstoolTop() mechanism to a converter. -- MOS_MIGRATED_REVID=104649067
* 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
* Skylark rules can no longer overwrite built-in attributes.Gravatar Florian Weikert2015-09-25
| | | | | -- MOS_MIGRATED_REVID=103931317
* Doc: Clarify when to use output_to_genfiles.Gravatar Laurent Le Brun2015-09-24
| | | | | -- MOS_MIGRATED_REVID=103741408
* Open source some skylark tests.Gravatar Han-Wen Nienhuys2015-09-22
| | | | | -- MOS_MIGRATED_REVID=103652672
* 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
* Parse the label syntax "@//a:b" so that eventually we can make that the ↵Gravatar Lukacs Berki2015-09-15
| | | | | | | | | syntax that means "refer to the main repository". There isn't an overarching plan for what we are going to do with the cmdline package, which seems to be separated from the .syntax one in all sorts of awkward ways. -- MOS_MIGRATED_REVID=103088960
* 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
* Skylark: configuration fragments for host configuration can now be accessed ↵Gravatar Florian Weikert2015-09-08
| | | | | | | via ctx.host_fragments. -- MOS_MIGRATED_REVID=102490502
* Rollback of commit 5a94e59f02833f9142bad9203acd72626b089535.Gravatar Janak Ramakrishnan2015-09-08
| | | | | | | | | *** Reason for rollback *** Breaks serialization of SkyValues. -- MOS_MIGRATED_REVID=102457225
* Refactor Skylark Environment-sGravatar Francois-Rene Rideau2015-09-08
| | | | | | | | | | | | | | | | | 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 creates it, so no Environment is left open for modification after being created and exported; exceptions for tests, the shell and initialization contexts. Unify Environment, SkylarkEnvironment and EvaluationContext into Environment. Have a notion of Frame for the bindings + parent + mutability. Replace the updateAndPropagate mechanism by a dynamicFrame. Simplify ValidationEnvironment, that is now always deduced from the Environment. -- MOS_MIGRATED_REVID=102363438
* When a Skylark macro creates a native rule, it also sets the following rule ↵Gravatar Florian Weikert2015-09-02
| | | | | | | attributes: generator_{function, name, location} -- MOS_MIGRATED_REVID=102139196
* Move global objects to RuntimeGravatar Francois-Rene Rideau2015-08-31
| | | | | | | | Move away global constants and global namespaces out of Environment and into a new file Runtime. -- MOS_MIGRATED_REVID=101940218
* Skylark: All executable rules now have an attribute 'args'.Gravatar Florian Weikert2015-08-31
| | | | | -- MOS_MIGRATED_REVID=101932897
* Roll back "When a Skylark macro creates a native rule, it also..."Gravatar Michajlo Matijkiw2015-08-31
| | | | | -- MOS_MIGRATED_REVID=101798931
* When a Skylark macro creates a native rule, it also sets the following rule ↵Gravatar Florian Weikert2015-08-28
| | | | | | | attributes: generator_{function, name, location} -- MOS_MIGRATED_REVID=101774632
* Add a isLoadingPhase flag to EnvironmentGravatar Francois-Rene Rideau2015-08-27
| | | | | | | | | Have loadingPhase-only methods check that flag. It's no use removing the initial bindings to these methods when they may have been copied anyway. -- MOS_MIGRATED_REVID=101624770
* Rules created by Skylark macros now have values for the attributes ↵Gravatar Florian Weikert2015-08-26
| | | | | | | | | generator_name and generator_function. Additionally, both Skylark macros and build extensions set the attribute generator_location in order to store the name of the file where generator_function was defined. -- MOS_MIGRATED_REVID=101458757
* Remove onlyLoadingPhase on objects.Gravatar Laurent Le Brun2015-08-24
| | | | | | | | | | The mechanism was easy to workaround (store the object in a different variable) and a source of bugs. This affected only 'rule', 'native' and 'attr' objects. It turns out the blacklisting was not useful (native and attr are already filtered, rule is not a problem). -- MOS_MIGRATED_REVID=101359277
* Rollback of commit 0218320f1316b4d25e35abaaa80206237468824d.Gravatar Han-Wen Nienhuys2015-08-20
| | | | | | | | | | *** Reason for rollback *** Breaks skylark macros that call skylark rules that declare an 'args' attribute. -- MOS_MIGRATED_REVID=101118137
* Skylark rules can no longer overwrite built-in attributes.Gravatar Florian Weikert2015-08-20
| | | | | -- MOS_MIGRATED_REVID=101015647
* Split Skylark Library into multiple pages, one per module. Add collapsibleGravatar David Chen2015-08-18
| | | | | | | | submenus to sidebar, and expand and highlight the link for the current page. Collapse sidebar on mobile and expose button for toggling sidebar. -- MOS_MIGRATED_REVID=100836792
* Skylark rules can now declare their required configuration fragmentsGravatar Florian Weikert2015-08-10
| | | | | -- MOS_MIGRATED_REVID=100163482
* Fix the documentation for how skylark rule outputs substitution works.Gravatar Brian Silverman2015-08-04
| | | | | | | -- Change-Id: I46ad9d609af088e473ec478729a0b1c79cdf72f3 Reviewed-on: https://bazel-review.googlesource.com/#/c/1761 MOS_MIGRATED_REVID=99707451
* Skylark documentation fixesGravatar Laurent Le Brun2015-07-29
| | | | | -- MOS_MIGRATED_REVID=99283744
* Provide placeholder rule class for deserialized Skylark rulesGravatar Mark Schaller2015-07-10
| | | | | | | | | | | | At this time, Skylark-defined rule classes don't get serialized, and aren't available at package deserialization time. To allow packages with Skylark-defined rule classes to deserialize, we provide a placeholder rule class implementation for deserialized Skylark rules. Resubmitting after previous rollback. -- MOS_MIGRATED_REVID=97972209
* Rollback of commit 4dbd628dc1384e5dce8c036e2b6bf93dd974bf04.Gravatar Mark Schaller2015-07-08
| | | | | | | | | | | | | | | | | | []*** Reason for rollback *** Large number of newly broken targets found by [] *** Original change description *** Provide placeholder rule class for deserialized Skylark rules At this time, Skylark-defined rule classes don't get serialized, and aren't available at package deserialization time. To allow packages with Skylark-defined rule classes to deserialize, we provide a placeholder rule class implementation for deserialized Skylark rules. -- MOS_MIGRATED_REVID=97716849
* Tell the Unused analyzer about SkylarkSignature.Gravatar Francois-Rene Rideau2015-07-08
| | | | | | | Remove some unused field warnings. -- MOS_MIGRATED_REVID=97693607
* Provide placeholder rule class for deserialized Skylark rulesGravatar Mark Schaller2015-07-08
| | | | | | | | | | At this time, Skylark-defined rule classes don't get serialized, and aren't available at package deserialization time. To allow packages with Skylark-defined rule classes to deserialize, we provide a placeholder rule class implementation for deserialized Skylark rules. -- MOS_MIGRATED_REVID=97679963
* Allow Skylark rules to be private.Gravatar Laurent Le Brun2015-07-07
| | | | | -- MOS_MIGRATED_REVID=97662036