-
Notifications
You must be signed in to change notification settings - Fork 949
Convert lastModified() calls to the more precise getModifiedTime() #3789
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
Conversation
I need a place to run exactly once, during startup, a quick test in the source directory in order to check for the availability of precise timestamps. Something like:
It can be done at any stage during startup. If native support for milliseconds is not available on that filesystem or OS, it will generate an informational message like:
It can be either logged as a debug or info level message. Any suggestions as to the best place to place this line? @eed3si9n @dwijnand |
Please do not merge yet |
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.
Tweaked cunei#1
This reverts commit 4ac231d.
This reverts commit 3c5aaca.
In Eval there is a calculation of hashes by scanning the elements of classpath, and getting the last modification time of each directory. When lastModified() was in use, non-existent elements would return 0L, but getModifiedTime() will throw an exception instead (like getLastModifiedTime(), incidentally). So, we catch the FileNotFoundException and return 0L now as well.
It turns out the code in Sync.scala activiely tries to transfer the invalid modifed time of non-existent files in the source directory over the time of the target file, which may or may not exist. In case it exists, the modification time is set to January 1, 1970. This is arguably a bug in Sync, which should be adjusted to better handle mappings with source files that do not exist. For now, however, we preserve the current behavior, using the deprecated copyLastModified().
Superseded by #3816. |
The validator has checked the following projects against Scala 2.12, 2.11,
❌ The result is: FAILED |
Use the new native file modification timestamps, which return times with full millisecond precisions whenever possible. Re-enables the tests run/error and tests/fork-parallel.
Depends on sbt/zinc#463
See: sbt/io#92
Fixes #3543
Fixes #3545