UP-TO-DATE checking for npm based step config#2192
UP-TO-DATE checking for npm based step config#2192simschla wants to merge 6 commits intodiffplug:mainfrom
Conversation
| @Retention(RetentionPolicy.SOURCE) | ||
| @Documented | ||
| @Target(ElementType.FIELD) | ||
| @interface IrrelevantForEquality { |
There was a problem hiding this comment.
will probably drop this again as it turned out that I don't need it.
| * 1. Equals and hashcode should not include absolute paths and such - optimize for buildcache keys | ||
| * 2. Serialized/deserialized state can include absolute paths and such and should recreate a valid/runnable state | ||
| */ | ||
| class RoundtrippableFile implements Serializable { |
There was a problem hiding this comment.
This is inspired by FileSignature - except that it does not use the serializable-for-equality-hack.
Maybe we could combine these two classes?
| // => equals/hashcode should not include absolute paths and such | ||
| // => serialized/deserialized state can include absolute paths and such and should recreate a valid/runnable state | ||
|
|
||
| private final Map<NpmConfigElement, Serializable> configElements = new HashMap<>(); |
There was a problem hiding this comment.
This map contains all state for the FormatterStep that should be respected for equals/hashCode. Everything else is implemented as derived.
| // override serialize output | ||
| private void writeObject(ObjectOutputStream out) throws IOException { | ||
| // TODO (simschla, 27.06.2024): Implement custom serialization if needed | ||
| // TODO (simschla, 03.07.2024): Should we stop the server here if it is running? |
Hi @simschla, unfortunately I've just learned that maybe (1) isn't going to work with build-cache. Details at |
So it is a good thing I went with (2) 👍 Do you see any issues with the general concept or should I go ahead and transform the other two steps also? |
|
Sorry, a better description of the problem:
For now I think best to wait and see if Gradle has any thoughts on the core problem. |
|
Closing this until we know if and how we need to take action. |
[DRAFT!] This PR introduces correct UP-TO-DATE checking for the npm based steps.
As discussed in #2140 I've tried both ways: Using (1) the current "serialization-as-equality-hack" or (2) implementing
FormatterStepdirectly. After playing around, I think approach (2) leads to a simpler and clearer implementation.So in this PR, I'd like to discuss this second approach based on the changed implementation of the
EslintFormatterStepbefore I go all the way and change alsoTsFmtandPrettier.