| Commit message (Collapse) | Author | Age |
|
|
|
|
|
|
|
|
| |
If --incompatible_descriptive_string_representations is passed, functions and rule
classes are converted to strings using `str`, `repr` and `print` functions
differently (more descriptive, without leaking information that shouldn't
be accessible).
PiperOrigin-RevId: 161087777
|
|
|
|
|
|
|
|
|
| |
This helps readability, particularly since we also have "isImmutable" for SkylarkValues and in EvalUtils. I considered changing those to isFrozen as well, but we can leave it as-is since the terminology of freezing doesn't necessarily apply to non-Freezable things.
Also rephrased some javadoc.
RELNOTES: None
PiperOrigin-RevId: 155090987
|
|
|
|
|
|
|
|
|
| |
The code has been untouched and unused for over a year (it's very likely
broken) and we have other priorities for now.
--
PiperOrigin-RevId: 145087310
MOS_MIGRATED_REVID=145087310
|
|
|
|
|
| |
--
MOS_MIGRATED_REVID=135816105
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
| |
--
MOS_MIGRATED_REVID=132058819
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
| |
These are called rather frequently I would imagine, but we don't profile often. Avoid
useless object allocation. The SKYLARK_USER_FN qualifier and function name _should_
be enough to identify what's what, though I understand there could be duplicates. If
this turns out to be an issue we can add more detail by memoizing location + name,
but for now I'm inclined to treat it as YAGNI.
--
MOS_MIGRATED_REVID=127328480
|
|
|
|
|
| |
--
MOS_MIGRATED_REVID=107416625
|
|
|
|
|
|
|
| |
Mostly reuses the interpreters argument checking and helper functions.
--
MOS_MIGRATED_REVID=107395974
|
|
|
|
|
|
|
|
| |
Add EvalExceptions for cases in which the interpreter would throw them
during evaluation of the function definition.
--
MOS_MIGRATED_REVID=107376021
|
|
|
|
|
|
|
|
| |
Does not yet contain any implementation for expressions and statements
but sets up various needed mechanisms and helper classes.
--
MOS_MIGRATED_REVID=107222845
|
|
|
|
|
|
|
| |
Special-case the return statement to avoid throwing an exception.
--
MOS_MIGRATED_REVID=106488391
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
| |
- Moved registration mechanism from BaseFunction into ASTNode / Statement / Expression
- Added more details about statements/expressions to the output trace (including if's)
- Fixed wrong locations
--
MOS_MIGRATED_REVID=102841164
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
| |
of function calls in HTML output
--
MOS_MIGRATED_REVID=102663672
|
|
|
|
|
|
|
|
|
| |
*** Reason for rollback ***
Breaks serialization of SkyValues.
--
MOS_MIGRATED_REVID=102457225
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
| |
statistics.
--
MOS_MIGRATED_REVID=102143715
|
|
|
|
|
|
|
| |
attributes: generator_{function, name, location}
--
MOS_MIGRATED_REVID=102139196
|
|
|
|
|
|
|
|
| |
Move away global constants and global namespaces out of Environment
and into a new file Runtime.
--
MOS_MIGRATED_REVID=101940218
|
|
|
|
|
| |
--
MOS_MIGRATED_REVID=101798931
|
|
|
|
|
|
|
| |
attributes: generator_{function, name, location}
--
MOS_MIGRATED_REVID=101774632
|
|
|
|
|
| |
--
MOS_MIGRATED_REVID=101769963
|
|
|
|
|
| |
--
MOS_MIGRATED_REVID=101572295
|
|
|
|
|
|
|
| |
This means that some tests had to be changed from using exact equality of error messages to working with contains() / startsWith().
--
MOS_MIGRATED_REVID=100923593
|
|
|
|
|
|
|
| |
invalid arguments.
--
MOS_MIGRATED_REVID=100386706
|
|
|
|
|
|
|
| |
methods.
--
MOS_MIGRATED_REVID=98922811
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* New hierarchy BaseFunction > UserModeFunction, BuiltinFunction.
The old hierarchy still exists for now, to be deleted after migration:
Function > AbstractFunction > MixedModeFunction >
(UserModeFunction, SkylarkFunction > SimpleSkylarkFunction)
(UserModeFunction is already migrated, and
BaseFunction implements Function, for now.)
* Function supports *args and **kwargs when calling functions, and
mandatory named-only parameters in the style of Python 3.
Notable difference with Python: *args binds the variable to a tuple,
because a Skylark list would have to be monomorphic.
* A better, simpler, safer FFI using reflection with BuiltinFunction.
Handles typechecking, passes parameters in a more Java style.
(Not used for now, will be used later.)
* A new annotation @SkylarkSignature, intended to replace @SkylarkBuiltin,
supports the full function call protocol, including default arguments.
* Support for annotating function Factory-s rather than functions.
--
MOS_MIGRATED_REVID=88958581
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is the first meaty cl in a series to refactor the Skylark function call protocol.
1- We introduce a first-class notion of FunctionSignature, that supports positional and named-only arguments, mandatory and optional, default values, type-checking, *stararg and **kwarg;
2- To keep things clean, we distinguish two different kinds of Argument's: Argument.Passed that appears in function calls, and Parameter, that appears in function definitions.
3- We refactor the Parser so it uses this infrastructure, and make minimal changes to MixedModeFunction so that it works with it (but don't actually implement *starparam and **kwparam yet).
4- As we modify FuncallExpression, we ensure that the args and kwargs arguments it passes to the underlying function are immutable, as a prerequisite to upcoming implementation of *starparam and **kwparam as being provided directly from a skylark list or dict.
Further changes under review will take advantage of this FunctionSignature to redo all our function call protocol, to be used uniformly for both UserDefinedFunction's and builtin function. The result will be a simpler inheritance model, with better type-checking, builtin functions that are both simpler and better documented, and many redundant competing functionality-limited codepaths being merged and replaced by something better.
NB: The changes to MixedModeFunction, SkylarkFunction and MethodLibrary are temporary hacks to be done away with in an upcoming CL. The rest is the actual changes.
--
MOS_MIGRATED_REVID=86704072
|
|
--
MOE_MIGRATED_REVID=85702957
|