aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/skyframe/serialization/testutils
Commit message (Collapse)AuthorAge
* Automated rollback of commit 7e87730de985b7099b9b683571d58efdaab70890.Gravatar ccalvarin2018-07-27
| | | | | | | | | | | | | | | | | *** Reason for rollback *** Go back to the default constructor - instead of requiring everywhere to know the correct hash function, we'll have the default rely on global state. It will make transition easier, even if it makes the origin of the hash less obvious. *** Original change description *** Remove default MD5 in most of Bazel's virtual filesystems. This forces the ex-default to be explicit in a lot of tests, but I'd rather that than have the risk of implicit md5-use in production code. To keep this CL smaller, do not remove the default from UnixFS quite yet. RELNOTES: None. PiperOrigin-RevId: 206358838
* Remove default MD5 in most of Bazel's virtual filesystems.Gravatar ccalvarin2018-07-26
| | | | | | | | | This forces the ex-default to be explicit in a lot of tests, but I'd rather that than have the risk of implicit md5-use in production code. To keep this CL smaller, do not remove the default from UnixFS quite yet. RELNOTES: None. PiperOrigin-RevId: 206223521
* Add events and get rid of ErrorInfoEncoder. Clean up some signatures and ↵Gravatar janakr2018-05-22
| | | | | | visibility in Skyframe classes. PiperOrigin-RevId: 197665817
* Use the local JDK as the default target javabaseGravatar cushon2018-05-14
| | | | | | and continue to use the embedded JDK as the default host_javabase. PiperOrigin-RevId: 196471714
* Wire up future to wait for in NestedSetCodecWithStore.Gravatar janakr2018-04-30
| | | | PiperOrigin-RevId: 194895469
* Refactor NestedSet to permit alternate NestedSetStore implementations.Gravatar cpeyser2018-04-30
| | | | PiperOrigin-RevId: 194787067
* SourceArtifacts are interned on deserialization using an ArtifactFactory. ↵Gravatar cpeyser2018-04-24
| | | | | | This should reduce memory consumption in NestedSet deserialization, which currently does not recycle Artifact instances. PiperOrigin-RevId: 194083901
* PiperOrigin-RevId: 193371485Gravatar carmi2018-04-18
|
* Automated rollback of commit 3643afad04be41caa4b247d327230e8a1e32bb6a.Gravatar carmi2018-04-17
| | | | | | | | | | | *** Reason for rollback *** Breaks //third_party/java_src/copybara/java/com/google/copybara/config:parser: [] *** Original change description *** PiperOrigin-RevId: 193292991
* PiperOrigin-RevId: 193274137Gravatar carmi2018-04-17
|
* Introduce NestedSetCodecWithStore, which serializes NestedSet using a ↵Gravatar cpeyser2018-04-16
| | | | | | process-global bimap of fingerprints to NestedSet contents. PiperOrigin-RevId: 193063717
* Add value constants to ObjectCodecRegistry. Value constants are to be used ↵Gravatar janakr2018-04-10
| | | | | | when there may not be a canonical instance of the object we want (or the canonical instance isn't available at registry construction time), but we can reasonably cheaply do value equality comparisons. Strings are a good example. PiperOrigin-RevId: 192354865
* Makes BlazeDirectories a serialization constant.Gravatar shahan2018-04-10
| | | | PiperOrigin-RevId: 192325937
* Makes the decision to memoize at the SkyValue level.Gravatar shahan2018-04-09
| | | | PiperOrigin-RevId: 192158825
* Deletes KryoGravatar shahan2018-04-09
| | | | PiperOrigin-RevId: 192155942
* 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
* Moves the decision to enable memoization from codecs to the top-level ↵Gravatar shahan2018-04-02
| | | | | | | | invocation. Also, makes it benign to registerInitialValue when memoization is disabled. PiperOrigin-RevId: 191338253
* Clean up unnecessary "additional data" from memoizing deserialization. Since ↵Gravatar janakr2018-03-21
| | | | | | memoization is now a simple on-off switch, change semantics to have at most one memoizing frame: starting memoization is now an idempotent operation. PiperOrigin-RevId: 189993914
* Integrate memoization into standard serialization. This involves a number of ↵Gravatar janakr2018-03-13
| | | | | | | | | | | | | | | | large changes: 1. SerializationContext and DeserializationContext become the owners of the Memoizer if requested. They produce new versions of themselves on demand that are memoization-aware. Because of intricacies of Skylark that I do not fully understand, we inject a Mutability object when starting memoization, and so to be conservative, that injection starts up a new memoization frame, nested if we were already memoizing, just like before. It would be nice to decouple this injection from memoization in the future. 2. MemoizingCodec is deleted, but really ObjectCodec becomes MemoizingCodec, so it lives on. BaseCodec is deleted since it now has only one implementation. 3. The simplified model of registering MemoizingCodecs is adopted for ObjectCodecs: all codecs are registered based on their #getEncodedClass and #additionalEncodedSubclasses. This also allows us to register codecs that are defined using tricky parameter types, since we're no longer trying to reflectively examine them. This required a clean-up of such codecs, and the addition of ArrayListCodec to stop NullableListCodec from making lists unmodifiable when they shouldn't be. 4. @AutoCodec is extended to allow users to specify that memoization should start with this codec. To ensure bit-equivalence, SkyKeySerializer disables memoization. PiperOrigin-RevId: 188918251
* Allow ObjectCodecRegistry to handle MemoizingCodecs. Initially this is just ↵Gravatar janakr2018-03-09
| | | | | | | | | | | | | | | | Skylark memoization, but we may extend in future to handle more than just Skylark this way. In fact, we probably want most of our ObjectCodecs to be MemoizingCodecs that can efficiently fall back to ObjectCodec if not using memoization (maybe coming in a follow-up). At a high level, this CL merges the functionality of MemoizingCodecMap into ObjectCodecRegistry, adds auto-registration of MemoizingCodec, and uses that to get rid of a lot of codecs that were just delegating. The big one to get rid of there is SkylarkValueCodec: all of its delegation duties are implicitly now in ObjectCodecRegistry and friends. One danger with this CL is that many of the features of Skylark serialization are only being tested in unit tests, which had to be reworked as part of this change. I don't think we've lost any coverage, but I could be wrong. SkylarkValueCodec had a bunch of methods that were effectively test-only, which made it easier to remove. The plan is to provide a Memoizer.Serializer inside the SerializationContext. At the top level, it will be a DUMMY_SERIALIZER that does no memoization, but a MemoizingCodec can do context = context.ensureMemoizing() which will recreate the context with a true memoizing serializer. Then all references to the Serializer in codec code can be cleaned up, and the MemoizingCodec and ObjectCodec signatures will be the same. At that point, we can make all ObjectCodecs compatible with memoization by default (with strategy MEMOIZE_AFTER), and add a "memoize" boolean to @AutoCodec. That should allow us to have full interoperability between all codecs. This CL also makes CodecScanner deterministic in the order of classes that it processes (there was a lurking bug here where constants must be deterministically ordered but that wasn't enforced at all). PiperOrigin-RevId: 188559983
* Convert a bunch of non-AutoCodec classes to use @AutoCodec: ↵Gravatar janakr2018-03-06
| | | | | | BuildConfiguration, BuildOptions, CollectTargetsUnderDirectoryValue. PiperOrigin-RevId: 188059815
* Serialize Path using AutoCodec.Gravatar janakr2018-03-05
| | | | PiperOrigin-RevId: 187945746
* 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
* Deletes CODEC fields now that they are no longer needed.Gravatar shahan2018-02-28
| | | | PiperOrigin-RevId: 187397314
* SerializationTester uses an addDependency method instead ofGravatar shahan2018-02-24
| | | | | | | | (Des|S)erializationContext factories. This is consistent as ObjectCodecs will eventually create context objects if needed. PiperOrigin-RevId: 186900662
* Integrates CodecScanner into SkyValueEncoder.Gravatar shahan2018-02-23
| | | | | | | | * Deletes a number of CODEC references, now superceded by registry functionality. * Minimal SkyKeySerializer modifications for correctness, as certain codec changes require codecs to be in available in the registry. PiperOrigin-RevId: 186834520
* Adds ObjectCodecRegistry to {Des|S}erializationContext.Gravatar shahan2018-02-20
| | | | | | | | | | | | * AutoCodec now delegates to the registry. * Adds getSuperclass logic for resolving a codec. * Small cleanups for classes that break the registry. TODO after this change: * Explicit CODEC definitions are no longer needed and existing ones should be cleaned up. * POLYMORPHIC is no longer be needed and should be cleaned up. PiperOrigin-RevId: 186351845
* Adds Class-keyed lookup to ObjectCodecRegistry and populates it using ↵Gravatar shahan2018-02-14
| | | | | | | | | CodecScanner. Introduces a class, CodecRegisterer, to allow customization of the scan-based registration process. PiperOrigin-RevId: 185749655
* Replaces InjectingObjectCodec with dependencies threaded through ↵Gravatar shahan2018-02-13
| | | | | | (Des|S)erializationContext. PiperOrigin-RevId: 185547740
* Add context argument to ObjectCodec.{serialize,deserialize}Gravatar michajlo2018-02-11
| | | | | | | | | | Context implementations are currently empty, just doing the plumbing in this change. Once this is in we can start passing along the ObjectCodecRegistry, which will allow runtime codec resolution for classes not known at compile time. We'll also inevitably add some memoization helpers, allowing us to optimize the serialization process further. PiperOrigin-RevId: 185305674
* CanonicalReferenceResolver for KryoGravatar shahan2018-01-26
| | | | | | | | Uses type and object equality to determine references. This results in a canonical serialized representation. ObjectCodecTester and SerializerTester now log some timing information. PiperOrigin-RevId: 183403658
* Serializers for HashCode, Map.Entry and OptionalGravatar shahan2018-01-25
| | | | | | This should bring Serializers to parity with AutoCodec Marshallers. PiperOrigin-RevId: 183330231
* Serializer implementation for NestedSetGravatar shahan2018-01-25
| | | | | | | | | | | | | Adds some logging to test helpers for size of serialized data. Jan 25, 2018 7:16:25 AM com.google.devtools.build.lib.skyframe.serialization.testutils.SerializerTester testSerializeDeserialize INFO: total serialized bytes = 70 Jan 25, 2018 7:16:25 AM com.google.devtools.build.lib.skyframe.serialization.testutils.ObjectCodecTester testSerializeDeserialize INFO: total serialized bytes = 208 Kryo output is significantly smaller. PiperOrigin-RevId: 183300353
* Serializer implementations for Guava CollectionsGravatar shahan2018-01-25
| | | | PiperOrigin-RevId: 183248133
* SerializerAdapterGravatar shahan2018-01-24
| | | | | | Allows ObjectCodec to be registered as a Kryo Serializer. PiperOrigin-RevId: 183149177
* Rename relativePath -> rootRelativePath in Root and friends.Gravatar tomlu2018-01-19
| | | | | | This makes it clearer that the path fragments in question are relative *to the root*. Confusingly, when the root is absolute, the root relative fragment is also absolute. This makes it a tiny bit clearer that the path fragment may be absolute. PiperOrigin-RevId: 182544893
* Add TestUtils#ConstantStringCodecGravatar brandjon2018-01-18
| | | | | RELNOTES: None PiperOrigin-RevId: 182390511
* Introduce Root class.Gravatar tomlu2018-01-17
| | | | | | | | | | | This class represents a root (such as a package path or an output root) used for file lookups and artifacts. It is meant to be as opaque as possible in order to hide the user's environment from sky keys and sky functions. Roots are used by RootedPaths and ArtifactRoots. This CL attempts to make the minimum number of modifications necessary to change RootedPath and ArtifactRoot to use these fields. Deprecated methods and invasive accessors are permitted to minimise the risk of any observable changes. RELNOTES: None PiperOrigin-RevId: 182271759
* Adds a CODEC for CppConfiguration.Gravatar shahan2018-01-10
| | | | | | | * Creates an enum for cpu transformer, which is easier to serialize than an opaque function. This also means moving FakeCPU to avoid introducing a circular dependency. * Adds a CODEC to Path using InjectingObjectCodec. PiperOrigin-RevId: 181445911
* Make ObjectCodecTester more convenientGravatar brandjon2017-12-18
| | | | | | | Add a safe varargs annotation. Use more precise type signature for ObjectCodecTester#verifyDeserialized and AbstractObjectCodecTest#verifyDeserialization. RELNOTES: None PiperOrigin-RevId: 179460437
* Support nested set serialization.Gravatar tomlu2017-11-27
| | | | PiperOrigin-RevId: 177032673
* Add ObjectCodecTester, migrating a few tests to use itGravatar michajlo2017-10-20
| | | | | | | | | | | This provides a composition-based alternative to the existing inheritance-based testing style. The inheritance style has been showing its age/has become quite cumbersome when multiple codecs are in the same class or codecs are colocated with their encoded class. This will hopefully get rid of some friction when adding new codecs. RELNOTES: None PiperOrigin-RevId: 172778555
* Move serialization test utilities from test/ to main/Gravatar brandjon2017-09-29
This is so other packages can depend on them without violating our style guide. (Dependencies on test/ packages should be limited to aggregating test suites.) The target is also renamed from ".../serialization:serialization-test-base" to a new subpackage, ".../serialization/testutils:testutils". RELNOTES: None PiperOrigin-RevId: 170426906