| Commit message (Collapse) | Author | Age |
|
|
|
|
|
|
|
|
|
| |
These subclasses should be using @SkylarkCallable(structField = true) instead
This is a bit of a memory win, as there is now no need to store field information twice.
There are still a couple of stragglers that are more difficult, namely ToolchainInfo and DefaultInfo. Their APIs will likely need some more extensive revamping before proceeding.
RELNOTES: None.
PiperOrigin-RevId: 187364392
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
PiperOrigin-RevId: 171176871
|
|
|
|
|
|
|
| |
Instead of this escape hatch, we'll encourage outside code to construct and use a legitimate Mutability object.
RELNOTES: None
PiperOrigin-RevId: 170210739
|
|
|
|
|
|
|
| |
Ensure that the casted list is unmodifiable (both for mutability correctness and also type correctness), and clearly document this.
RELNOTES: None
PiperOrigin-RevId: 164739837
|
|
|
|
|
|
|
| |
This method acts as an "escape hatch" for mutating a list regardless of Mutability. It should be avoided if at all possible.
RELNOTES: None
PiperOrigin-RevId: 164716286
|
|
|
|
|
|
|
| |
I.e., ('a', 'b') * 3 == ('a', 'b', 'a', 'b', 'a', 'b'), like lists.
RELNOTES: None
PiperOrigin-RevId: 164403099
|
|
|
|
|
|
|
|
|
| |
Previously, you could modify a frozen MutableList indirectly via its iterator(). This CL wraps the underlying list with a Collections.unmodifiableList when obtaining the iterator, and likewise for other methods that return views over Skylark data structures.
This also eliminates the SkylarkList#getContents method in favor of just using the SkylarkList object itself.
RELNOTES: None
PiperOrigin-RevId: 164402129
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Made abstract collection classes in SkylarkMutable more systematic. Added javadoc. Added a BaseMutableList class to factor out List stubs from SkylarkList. Alphabetized the methods to make it easier to verify that all overrides are covered.
- Simplified MutableList constructors. Added MutableList#copyOf factory, and deprecated public access to the existing constructor to be more in line with Guava collections. Made Tuple#create private.
- Made mutation methods for MutableList take in mutabilities rather than environments. For symmetry with the other mutators, pushed SkylarkList#set down to MutableList and moved the evaluation of its index to the caller.
- Made SkylarkList#getSlice an abstract method that's implemented symmetrically in Tuple and MutableList -- instead of the bizarre thing it was doing before, where its return type was a List that sometimes got passed through SkylarkType.convertToSkylark in the caller.
- Removed final modifier on methods where it wasn't obviously appropriate. Removed redundant super() calls. Renamed type variables to always be one letter, and to not reuse the instance's own type variable name from within static methods.
RELNOTES: None
PiperOrigin-RevId: 164257778
|
|
|
|
|
| |
RELNOTES: None
PiperOrigin-RevId: 164131012
|
|
|
|
|
|
|
|
|
| |
Also throw IllegalArgumentException instead of AssertionError.
A follow-up CL will look to eliminate the SkylarkMutable#checkMutable(Location, Environment) override in favor of checkMutable(Location, Mutability). This will make it easier to manipulate Skylark values in specialized contexts aside from normal evaluation.
RELNOTES: None
PiperOrigin-RevId: 163978262
|
|
|
|
|
|
|
| |
I.e., use an accessor for type inference. The EMPTY field will be made private in a future CL.
RELNOTES: None
PiperOrigin-RevId: 163843569
|
|
|
|
|
| |
RELNOTES: None
PiperOrigin-RevId: 161560683
|
|
|
|
|
|
|
| |
It's now easier to customize Printer if in different situations objects should
be printed differently. Also its API is cleaner now. Names of methods of SkylarkValue objects now reflect names of Skylark functions: SkylarkValue#repr and SkylarkPrintableValue#str.
PiperOrigin-RevId: 160635154
|
|
|
|
|
|
|
|
| |
[2] * 3 should return [2, 2, 2] and not [2, 2, 2, 2].
--
PiperOrigin-RevId: 147017581
MOS_MIGRATED_REVID=147017581
|
|
|
|
|
|
|
|
| |
--
Change-Id: I9ec3209a69ba5a51943b334f278ba93d67d4f9f4
Reviewed-on: https://cr.bazel.build/8090
PiperOrigin-RevId: 143470915
MOS_MIGRATED_REVID=143470915
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- list * int
- int * list
RELNOTES[NEW]: Skylark: you can now multiply a list by an integer to get the concatenation of N copies of this list, e.g. [a,b] * 3 = [a,b,a,b,a,b]
--
Change-Id: I2068ad30e11df26dc7b4b8c41e51f85db56f0390
Reviewed-on: https://github.com/bazelbuild/bazel/pull/1524
PiperOrigin-RevId: 142140726
MOS_MIGRATED_REVID=142140726
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There was a crash when the starting point of a negative slice is larger than
the list length.
In addition, there was an incorrect result when the ending point of a negative
slice is less than the list's length times -1. It would wrongly exclude the
first element.
RELNOTES: Fix slicing bug where "abc"[:-4:-1] would give wrong answer
--
MOS_MIGRATED_REVID=138878716
|
|
|
|
|
| |
--
MOS_MIGRATED_REVID=135483694
|
|
|
|
|
|
|
| |
function calls.
--
MOS_MIGRATED_REVID=133259901
|
|
|
|
|
| |
--
MOS_MIGRATED_REVID=132226460
|
|
|
|
|
| |
--
MOS_MIGRATED_REVID=131056178
|
|
|
|
|
|
|
|
|
| |
Specialize the creation of internal contents if we have a collection and can
properly presize the ArrayList (this is almost always the case), and provide a
special case constructor for concat.
--
MOS_MIGRATED_REVID=129919134
|
|
|
|
|
| |
--
MOS_MIGRATED_REVID=129331086
|
|
|
|
|
| |
--
MOS_MIGRATED_REVID=128800280
|
|
|
|
|
| |
--
MOS_MIGRATED_REVID=126081020
|
|
|
|
|
|
|
|
|
| |
It is probably more efficient in the common case where the Iterable is a collection. String and list handling in Skylark results in a *lot* of calls to this method, and the use of addAll should reduce the amount of copying and GCing that needs to occur.
An alternative would be to change the underlying type of SkylarkList from ArrayList to LinkedList, which would reduce the copying and GCing due to list concatenation even more. There is probably a downside to that but it is not clear if it is significant.
--
MOS_MIGRATED_REVID=119891128
|
|
|
|
|
|
|
| |
RELNOTES: implement list.insert for skylark rule
--
MOS_MIGRATED_REVID=119243427
|
|
|
|
|
| |
--
MOS_MIGRATED_REVID=114860576
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
*** 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
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
*** 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
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
SkylarkList now implements the List interfaces, except that its mutating methods
throw an UnsupportedOperationException, just like ImmutableList does.
To actually mutate a SkylarkList, you need to pass a Location and a suitable
Environment object with a matching Mutability while it is still active.
Introduce SkylarkMutable and SkylarkMutable.MutableCollection to better handle
mutable data structures.
Remove some functions in EvalUtils made obsolete by this and previous changes regarding Skylark lists.
--
MOS_MIGRATED_REVID=112768457
|
|
|
|
|
| |
--
MOS_MIGRATED_REVID=110838816
|
|
|
|
|
| |
--
MOS_MIGRATED_REVID=110446625
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
| |
--
MOS_MIGRATED_REVID=110356439
|
|
|
|
|
| |
--
MOS_MIGRATED_REVID=108243881
|
|
|
|
|
| |
--
MOS_MIGRATED_REVID=107231604
|
|
|
|
|
|
|
| |
Convert to Skylark values when destructuring a sequence or map.
--
MOS_MIGRATED_REVID=106591523
|
|
|
|
|
|
|
|
| |
Use SkylarkList everywhere rather than either List or GlobList.
Keep a GlobList underneath a MutableList, where applicable.
--
MOS_MIGRATED_REVID=105864035
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
| |
Make SkylarkList no longer read-only to match Python and the BUILD language.
Instead, subject it to a Mutability object inherited from the Environment.
--
MOS_MIGRATED_REVID=103332973
|
|
|
|
|
|
|
|
|
|
|
| |
Clarify the criterion for being a valid Skylark value;
stop claiming immutability is "the" criterion when Skylark now has mutable values;
stop relying on a reflection with a magic list (this also fixes the SkylarkShell build).
Clarify the criterion for determining immutable types when making a SkylarkNestedSet.
Clarify and use the criterion for being a valid Skylark dict key.
--
MOS_MIGRATED_REVID=103313934
|
|
|
|
|
|
|
|
|
| |
This brings consistency between BUILD and Skylark interpreters. It also brings
consistency with dicts (e.g. **kwargs can contain anything and kwargs.values
is allowed).
--
MOS_MIGRATED_REVID=100278980
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Move printing code from EvalUtils to Printer.
Rename functions in Printer:
printValue becomes str or print,
prettyPrintValue becomes repr or write,
formatString becomes format,
makeFormattable becomes strFormattable,
prettyPrintValues becomes listString.
write being self-sufficient is made the reference,
and print is the one that is a wrapper around write,
rather than the other way around, avoiding mutual recursion.
--
MOS_MIGRATED_REVID=95897834
|
|
|
|
|
| |
--
MOS_MIGRATED_REVID=92063536
|