-
Notifications
You must be signed in to change notification settings - Fork 459
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
UP-TO-DATE checking for npm based step config #2192
base: main
Are you sure you want to change the base?
UP-TO-DATE checking for npm based step config #2192
Conversation
@Retention(RetentionPolicy.SOURCE) | ||
@Documented | ||
@Target(ElementType.FIELD) | ||
@interface IrrelevantForEquality { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we?
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. |
[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
FormatterStep
directly. 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
EslintFormatterStep
before I go all the way and change alsoTsFmt
andPrettier
.