Coder Social home page Coder Social logo

Comments (3)

oconnelc avatar oconnelc commented on June 17, 2024

I haven't isolated at what point it changed, but I have done some preliminary investigation into the cause:

In the file: WatchServiceRegistar.java in the method watch:

void watch(FileSystemSubset fileSystemSubset) throws IOException {
    lock.lock();
    try {
        LOG.debug("Begin - adding watches for {}", fileSystemSubset);
        final WatchPointsRegistry.Delta delta = 
            watchPointsRegistry.appendFileSystemSubset(fileSystemSubset, getCurrentWatchPoints());
            Iterable<? extends File> startingWatchPoints = delta.getStartingWatchPoints();

This method gets called twice. The first time to start the watching of src/main/java, which is added by the JavaPlugin, which is added by WarPlugin.java. In this all the src/main/webapp is rejected in the FileWalker, defined within the watch method:

Files.walkFileTree(dirPath, new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult preVisitDirectory(Path path, BasicFileAttributes attrs) throws IOException {
    if (!path.equals(dirPath)) {
        if (delta.shouldWatch(path.toFile())) {
            watchDir(path);
            return FileVisitResult.CONTINUE;
         } else {
             LOG.debug("Skipping watching for {}, filtered by WatchPointsRegistry", path);
             return FileVisitResult.SKIP_SUBTREE;
         }
     } else {
        return FileVisitResult.CONTINUE;
     }
 });

The call to the delta.shouldWatch is rejected because src/main/webapp is not a child of src/main/java.

In the second pass, a new Delta is created with the following parameters:

fileSystemSubset: with files = $projectDir/topLevel and tree=$projectDIr/src/main/webapp
getCurrentWatchPoints() = {$projectDir/src/main, $projectDir}

when calling the delta.getStartingWatchPoints(), the starting points only contains: $projectDir.

In the for loop that iterates over the starting points, src/main/webapp is skipped because the entire src dir is skipped. This is because the src/main/webapp is defined as a root within the delta. As a result, no watchpoint is ever registered because the delta.shouldWatch() returns false for the src directory and prevents the rest of the subtree from being registered.

I'm not sure what the correct way to resolve this.

from gradle.

stale avatar stale commented on June 17, 2024

This issue has been automatically marked as stale because it has not had recent activity. Given the limited bandwidth of the team, it will be automatically closed if no further activity occurs. If you're interested in how we try to keep the backlog in a healthy state, please read our blog post on how we refine our backlog. If you feel this is something you could contribute, please have a look at our Contributor Guide. Thank you for your contribution.

from gradle.

stale avatar stale commented on June 17, 2024

This issue has been automatically closed due to inactivity. If you can reproduce this on a recent version of Gradle or if you have a good use case for this feature, please feel free to reopen the issue with steps to reproduce, a quick explanation of your use case or a high-quality pull request.

from gradle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.