Skip to content

[1.x] Remove two unused methods that depends on Analysis Timestamp #7787

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 20, 2024

Conversation

Friendseeker
Copy link
Member

Issue

With introduction of ConsistentAnalysisFormat, compilation time is wiped hence methods that relies on timestamp is no longer reliable.

Fix

Remove the two unused methods.

val lastCompilation = analysis.compilations.allCompilations.lastOption
lastCompilation.map(_.getStartTime) getOrElse 0L
}
def generateVersionFile(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't remember how this is used but I'm a bit concerned that this is no longer used.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw Eugene may I ask what might generateVersionFile method be originally used for? My current guess is that this is a crude archaic invalidation mechanism to generate a distinct incrementalcompiler.version.properties in target of compiler-interface to invalidate some unknown upstream cache (or analysis?).

Either way this incrementalcompiler.version.properties is non-hermetic and I am thinking whether we should remove the logic at Zinc side too.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The use site seems to be here https://github.com/sbt/sbt/blob/v1.10.3/zinc-lm-integration/src/main/scala/sbt/internal/inc/ZincComponentManager.scala#L121, so I guess we're using that as a cache key for compiler bridge products?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the info!

This is out of the scope of this PR but I am thinking whether the cache key (stampedVersion) should just include version instead of both version and timestamp to make the cache hermetic. Maybe back in the old days when Zinc was part of sbt repo, timestamp is needed to invalidate locally built zinc product. But now they are in separate repo and the use case for timestamp is gone.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe back in the old days when Zinc was part of sbt repo, timestamp is needed to invalidate locally built zinc product.

Yea. That sounds like a plausible hypothesis. Maybe when the version is non-snapshot, only the versions should be used, and otherwise use sha256 of something?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am actually thinking if we can do something easier. We can just always invalidate if the version ends with "SNAPSHOT". As even for sbt maintainers, there's very few situation we use a snapshot Zinc version in sbt repo (at least I never had to do it).

@eed3si9n eed3si9n merged commit 34fe56d into sbt:1.10.x Oct 20, 2024
10 checks passed
@Friendseeker Friendseeker deleted the remove-unused branch October 20, 2024 23:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants