aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/analysis/skylark
Commit message (Collapse)AuthorAge
* Migrate most of SkylarkRuleClassFunctions to use @SkylarkCallableGravatar cparsons2018-04-17
| | | | | | | The only things that remain are Provider subclasses, as they require special treatment. (Namely, they are referencable at the top level as a Provider and not a function.) RELNOTES: None. PiperOrigin-RevId: 193249523
* Change default value of 'tools' attribute to unbound.Gravatar tomlu2018-04-16
| | | | | | | We do not wish to support the attribute being Noneable forever. RELNOTES: None PiperOrigin-RevId: 193139282
* Create @SkylarkConstructor annotation, to annotate certain global-namespace ↵Gravatar cparsons2018-04-16
| | | | | | | | | | @SkylarkCallable methods as representing constructors of other skylark types. This change also demonstrates the new pattern on the global Label() constructor. As an added bonus, it fixes documentation of that constructor. The old documentation used to read "Label.Label(...)" and the new documentation reads "Label(...)". RELNOTES: None. PiperOrigin-RevId: 193109338
* Update format implementation in ctx.actions.args.Gravatar tomlu2018-04-16
| | | | | | | Since we're only supporting a single %s anyway, make this explicit in the docs, fail in the analysis phase, and use a more efficient format method in the implementation. RELNOTES: None PiperOrigin-RevId: 193099585
* Introduce tools attribute to ctx.actions.run and friends.Gravatar tomlu2018-04-16
| | | | | | | | | This will allow us to stop iterating all inputs in an expensive manner looking for tools so we can add their runfiles. If users specify the 'tools' attribute, it is assumed they know what they are doing and inputs will no longer be scanned for tools. RELNOTES: Introduce 'tools' attribute to ctx.actions.run. PiperOrigin-RevId: 193092258
* Create @SkylarkGlobalLibrary annotation, allowing classes/interfaces with ↵Gravatar cparsons2018-04-16
| | | | | | | | | global skylark functions to use @SkylarkCallable instead of @SkylarkSignature. Also migrate skylark's global "rule" function to @SkylarkCallable, thus demonstrating the new feature. RELNOTES: None. PiperOrigin-RevId: 193085313
* Implement positional overloads for ctx.actions.args.Gravatar tomlu2018-04-16
| | | | | | | | | | | We now support calls like: args = ctx.action.args() args.add("--foo", value) args.add_all("--foo", values) RELNOTES: Support two-arg overloads for ctx.actions.args (eg. args.add("--foo", val)) PiperOrigin-RevId: 193074060
* Introduce `--incompatible_disallow_filetype` to remove the `FileType` function.Gravatar laurentlb2018-04-13
| | | | | | | | RELNOTES: `FileType` is deprecated and will be removed soon. Try the `--incompatible_disallow_filetype` flag to ensure your code is forward-compatible. PiperOrigin-RevId: 192758063
* Document the new ctx.actions.args() APIGravatar brandjon2018-04-12
| | | | | | RELNOTES: Args objects (ctx.actions.args()) have new methods add_all() and add_joined() for building command lines using depsets. RELNOTES[INC]: Added flag --incompatible_disallow_old_style_args_add to help migrate from args.add() to args.add_all() / args.add_joined() where appropriate. PiperOrigin-RevId: 192633763
* Update ctx.action.args() docs.Gravatar tomlu2018-04-11
| | | | | RELNOTES: None PiperOrigin-RevId: 192479130
* Migrate Info's skylark methods to @SkylarkCallableGravatar cparsons2018-04-10
| | | | | RELNOTES: None PiperOrigin-RevId: 192337555
* Make SkylarkCustomCommandLine support efficient fingerprint calculation.Gravatar tomlu2018-04-10
| | | | | | | | | | | When using nested sets, we reuse sub-fingerprint computations by using the nested set key cache. map_each is supported. All formats, before_each, join_with and so on are computed via adding a specific UUID to the fingerprint + the control string (eg. the format string) rather than performing the actual computation. In legacy mode (existence of old map_fn), it falls back to trivial (and slow) fingerprint calculation. RELNOTES: None PiperOrigin-RevId: 192288783
* Fix Printer.getPrinter(boolean)Gravatar brandjon2018-04-09
| | | | | | | Also rename it to a separate function since boolean args are vague. RELNOTES: None PiperOrigin-RevId: 192201308
* Cleanup @SkylarkCallable parameters and their error handling.Gravatar cparsons2018-04-06
| | | | | | | This involves enforcing additional compiletime restrictions on Param ordering and semantics. RELNOTES: None. PiperOrigin-RevId: 191927206
* Split Args#add into three methods.Gravatar tomlu2018-04-05
| | | | | | | | | | | Args#add(value, *, arg, format) Args#add_all(value, *, arg, map_each, format_each, before_each, omit_if_empty, uniquify) Args#add_joined(value, *, arg, join_with, map_each, format_each, format_joined, omit_if_empty, uniquify) The old Args#add remains backwards compatible, but we add a flag to disable this compatibility mode. RELNOTES: None PiperOrigin-RevId: 191804482
* Replaces JavaSerializableCodec with DynamicCodec as the defaultGravatar shahan2018-04-04
| | | | | | | | | * Skylark serialization was previously dropping location in error, which this fixes. * Deletes a lot of codecs with fidelity issues (DynamicCodec has full fidelity). * Deletes EnumRuntimeCodec which can now be replaced with the superior EnumCodec. * This should eventually allow us to delete Serializable from all Blaze. The remaining blocker is NoSuchPackageExceptionCodec. PiperOrigin-RevId: 191603929
* Make RuleClass serializable and remove Environment from it, since it was ↵Gravatar janakr2018-03-30
| | | | | | | | only being used for the transitive hash code and transitive label of its globals, which can be passed in explicitly. Assert along the way that the transitive label of its globals is always non-null. That is currently the case, although there seems to be no hard invariant of the system that it is true. Might as well tighten it now. PiperOrigin-RevId: 191103310
* Support source versions newer than 8 in Bazel's annotation processorsGravatar cushon2018-03-29
| | | | | | This quiets some build warnings. PiperOrigin-RevId: 190958692
* Add codecs needed to fully serialize Attributes.Gravatar janakr2018-03-28
| | | | PiperOrigin-RevId: 190805577
* Expose j2objc.dead_code_report as a configuration field instead of a basic ↵Gravatar cparsons2018-03-27
| | | | | | | struct field on the j2objc fragment. RELNOTES: None. PiperOrigin-RevId: 190672475
* Remove EventHandler from SkylarkCustomCommandLine.Gravatar tomlu2018-03-27
| | | | | | | | | EventHandler is scoped to a commond, but SkylarkCustomCommandLine can outlive a single command. This constitutes a memory leak. Any error messages caused by command line evaluation are still propagated to the user via a CommandLineExpansionException. RELNOTES: None PiperOrigin-RevId: 190650016
* Fix and rollforward of "Convert SkylarkRuleImplementationFunctions functions ↵Gravatar cparsons2018-03-27
| | | | | | | | | to use @SkylarkCallable instead." expand_location.targets needed to be a named parameter. RELNOTES: None. PiperOrigin-RevId: 190624472
* Automated rollback of commit 1f8ba946a3c20413ff0a95235b20d7cc1b4964f0.Gravatar twerth2018-03-27
| | | | | | *** Reason for rollback *** PiperOrigin-RevId: 190600296
* Automated rollback of commit 316cd7da6f6b003b853ccf7d144f395a9a557400.Gravatar janakr2018-03-26
| | | | | | | | *** Reason for rollback *** Roll-forward with fix (equality and hashcode for relevant classes). Also add a bit more debugging info in case of failure. PiperOrigin-RevId: 190492934
* Make a bunch more stuff serializable, especially anonymous classes and ↵Gravatar janakr2018-03-26
| | | | | | lambdas. Give a bit more information in JavaSerializableCodec when serialization fails on an anonymous class or lambda. PiperOrigin-RevId: 190472245
* Convert SkylarkRuleImplementationFunctions functions to use @SkylarkCallable ↵Gravatar cparsons2018-03-26
| | | | | | | instead. RELNOTES: None. PiperOrigin-RevId: 190463597
* Automated rollback of commit f873447a073c8f7374e9f8a74ae42784df3f80e1.Gravatar twerth2018-03-26
| | | | | | | | | | | | *** Reason for rollback *** Breaks proto_library_regtest: http://b/76229470 *** Original change description *** @AutoCodec SelectorList and SkylarkFileType. PiperOrigin-RevId: 190434996
* @AutoCodec SkylarkCustomCommandLine. Includes hack to work around b/76233103.Gravatar janakr2018-03-24
| | | | PiperOrigin-RevId: 190349968
* @AutoCodec SelectorList and SkylarkFileType.Gravatar janakr2018-03-23
| | | | PiperOrigin-RevId: 190285424
* Convert several SkylarkAttr methods to use @SkylarkCallable instead of ↵Gravatar cparsons2018-03-22
| | | | | | | @SkylarkSignature RELNOTES: None. PiperOrigin-RevId: 190129404
* Use an immutable Attribute factory in objects that are persisted to ↵Gravatar janakr2018-03-22
| | | | | | Skyframe, rather than the potentially mutable builder, and @AutoCodec SkylarkAttr.Descriptor. PiperOrigin-RevId: 190118565
* Convert SkylarkActionFactory methods to use @SkylarkCallable instead of ↵Gravatar cparsons2018-03-22
| | | | | | | @SkylarkSignature RELNOTES: None. PiperOrigin-RevId: 190073508
* Force @SkylarkCallable Params with defaultValue = "None" to be noneable.Gravatar cparsons2018-03-20
| | | | | | | | Previously, usage was fairly inconsistent. From now on, if the @Param is mandatory, use defaultValue = "" instead. RELNOTES: None. PiperOrigin-RevId: 189777905
* Add more documentation for rule.outputsGravatar brandjon2018-03-20
| | | | | | | | | We want to simplify/remove this API, but let's document it in the meantime. Also fix harmless bug that annoyed me. It used rawTemplate instead of formatStr when there are no placeholders. This would theoretically fail to properly escape % symbols, except that the code path luckily short-circuits later on if there are no placeholders. RELNOTES: PiperOrigin-RevId: 189760809
* Tag Attribute, SkylarkDefinedAspect and some other Skylark classes withGravatar mjhalupka2018-03-12
| | | | | | | | | @AutoCodec. Remove Environment from SkylarkDefinedAspect. Add a note to BuiltInFunction that we shouldn't need to serialize it because all instances should be constant. PiperOrigin-RevId: 188763259
* Fix broken links and formattingGravatar brandjon2018-03-10
| | | | | RELNOTES: None PiperOrigin-RevId: 188625855
* Update links to examplesGravatar brandjon2018-03-10
| | | | | | | See changes in https://github.com/bazelbuild/examples/pull/56 RELNOTES: None PiperOrigin-RevId: 188601311
* Expose an actions provider on RuleConfiguredTarget instances.Gravatar cparsons2018-03-06
| | | | | | | | | Given a target (for example from a skylark aspect), one will be able to access a list of actions that the target generated using "target.actions". This is without additional memory footprint. Actions themselves are not fully exposed to skylark (and thus there isn't much meaning to gather from them in skylark yet). Access methods will follow soon. RELNOTES: None. PiperOrigin-RevId: 188098079
* Make the builtins registry thread-safeGravatar brandjon2018-03-06
| | | | | | | | | | | | | | It was previously assumed that safety wasn't needed because 1) all builtins should be registered in static initializer blocks, and 2) all retrievals should occur during Skylark evaluation, after static initialization completes. It turns out these assumptions aren't actually true (Who would've thunk it!). SkylarkActionFactory has been observed to be initialized as late as analysis time, and retrievals occur as early as constructing a PackageFactory (when scanning the native module). The failure mode is particularly ugly: Random Skylark method lookups will fail non-deterministically. This change guards against this by making the builtins registry implement a form of freezing. Before freezing, reads and writes are allowed and are synchronized. After freezing, only reads are allowed and they are unsynchronized for performance. BlazeRuntime is responsible for flipping the bit, and for ensuring classes like SkylarkActionFactory run their initialization by that point. Unit tests don't need to worry, since they just stay unfrozen and synchronized throughout. RELNOTES: None PiperOrigin-RevId: 188080136
* Fix incomplete documentation changeGravatar brandjon2018-03-06
| | | | | | | | | This finishes a partial change erroneously submitted as part of https://github.com/bazelbuild/bazel/commit/864ac520951821bd197a02490d2b04f6246be7fa. The full outputs map behavior is still not fully described because its implementation is too complex. That requires a separate discussion. RELNOTES: None PiperOrigin-RevId: 188049028
* Revamp docs for ctx.outputsGravatar brandjon2018-03-02
| | | | | | | Explain the deprecation of ctx.outputs.executable. RELNOTES: None PiperOrigin-RevId: 187640408
* Revamp discussion of executable/test rulesGravatar brandjon2018-03-02
| | | | | | | Rewrite that part of rules.md and update rule() docs. Also clarify the Action object's docs to put it in context. RELNOTES: None PiperOrigin-RevId: 187636896
* Migrate a few trivial uses of @SkylarkSignature to use @SkylarkCallable insteadGravatar cparsons2018-03-01
| | | | | RELNOTES: None. PiperOrigin-RevId: 187531006
* Make the distinction between "global frame" and "lexical frame" explicit. As ↵Gravatar nharmata2018-03-01
| | | | | | | a nice consequence, this lets us reduce GC churn since we no longer need to create a frame instance for the lexical frame at a callsite of either a function when the environment is frozen or a builtin function (since builtins cannot modify bindings in their lexical frame). RELNOTES: None PiperOrigin-RevId: 187495787
* Add @AutoCodec to FileType and FileTypeSet.Gravatar mjhalupka2018-02-28
| | | | | | More strictly type the arguments for creating FileTypes. PiperOrigin-RevId: 187391336
* Revamp docs for default outputs / output groupsGravatar brandjon2018-02-26
| | | | | | | | | | | - collapsed these into one section - removed the term "implicit outputs" - add explanation for what these are first, then how to control them - update docs for DefaultInfo - also update docs for test/executable args of rule() RELNOTES: None PiperOrigin-RevId: 187026641
* Revamp rules.md documentation for filesGravatar brandjon2018-02-26
| | | | | | | Unified "Files" and "Output files" sections. Renamed "declared files" to "predeclared files" to avoid confusion with "declare_file()"/"declare_directory()". RELNOTES: None PiperOrigin-RevId: 187017607
* Do not expand depset twice and store expanded in ctx.actions.run inputs.Gravatar tomlu2018-02-21
| | | | | | | | | | | | | | Previously, when inputs is a depset, we'd: * Expand it to a collection, then * Expand it again and add it as a flat list to the input builder This would be square on both performance and analysis time memory. Note that we _still_ expand the depset once to try to see if any input is a tool. This will have to be fixed in a future CL. RELNOTES: None PiperOrigin-RevId: 186566243
* Deletes POLYMORPHIC strategy. ObjectCodec now uses runtime type information ↵Gravatar shahan2018-02-20
| | | | | | to select a codec. PiperOrigin-RevId: 186378153
* Move CommandLine, CommandLineItem, and ParamFileInfo from ↵Gravatar tomlu2018-02-15
| | | | | | | | | lib.analysis.actions -> lib.actions. These are fundamental types that want to sit alongside types like Spawn. RELNOTES: None PiperOrigin-RevId: 185887971