roman-garcia opened a new pull request, #588:
URL: https://github.com/apache/maven-build-cache-extension/pull/588
Before this change, staging (#394) moved each pre-existing output directory,
such as `target/classes`, as a whole into a freshly created directory under
`target/maven-build-cache-extension`. IntelliJ's file watcher (fsnotifier,
Linux) scans a new directory as soon as it sees it. When that scan ran before
the move event was processed, it found the moved directory, and the kernel
returned the inotify watch it already held under the old path, so fsnotifier
aborted:
```
WARN - #c.i.o.v.i.l.NativeFileWatcherImpl - table error: collision at 151472
(new …/target/maven-build-cache-extension/product/core/target/classes, existing
…/product/core/target/classes)
WARN - #c.i.o.v.i.l.NativeFileWatcherImpl - Watcher terminated with exit
code 3
```
IntelliJ restarts it, but a build that misses the cache on many modules
crashes it repeatedly, and IntelliJ then disables its file watcher ("File
watcher failed repeatedly and has been disabled"), so external changes to the
project are no longer picked up.
This change stages a directory by recreating its directories under the
staging directory, moving its files one by one, then deleting the emptied
source directories. No directory changes path, so the watcher never sees one
directory under two paths. Restoring already moved files one by one and is
unchanged.
Checked with IntelliJ's fsnotifier watching a 30-module project, on a second
build with `-Dmaven.build.cache.skipCache=true` so every module stages its
classes: with the current staging fsnotifier died with exit code 3; with this
change it kept running over three builds, and every module got its classes back.
`CacheUtilsMoveFilesTest#movesNoDirectory` fails when `moveFiles` moves the
directory as a whole. Unit tests and the staging-related integration tests
(`StagingRemovesStaleClassesTest`, `StaleArtifactTest`,
`StaleMultimoduleArtifactTest`, `IncrementalRestoreTest`,
`Issue393CompileRestoreTest`, `CacheCompileDisabledTest`, `BuildExtensionTest`,
`CoreExtensionTest`) pass; the full integration suite was not run locally.
---
- [X] I hereby declare this contribution to be licensed under the [Apache
License Version 2.0, January 2004](https://www.apache.org/licenses/LICENSE-2.0)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]