[GRADLE-301] Improve search speed for settings file in hierarchical layouts Created: 04/Nov/08  Updated: 04/Jan/13  Resolved: 07/Nov/08

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: 0.5

Type: Improvement
Reporter: Hans Dockter Assignee: Hans Dockter
Resolution: Fixed Votes: 0


From a posting of Martin:

I found the cause of the delay when debugging gradle and it's not the

  • my project is at /media/sda1/work/...
  • however, there are also other smb mounts like /media/share1, ..., which
    are not reachable any more, when I pull my network cable.
  • gradle searches for settings in all parent directories by getting
    directory lists and when asking for the files/directories in /media it takes
    a LONG time (because of non-reachable mounts).

So, no big problem, but I would replace the method in
ParentDirSettingsFinderStrategy with this more efficient one, which does not
get all files in the directories (and would not cause the above delay):

    protected File findBeyondCurrentDir(StartParameter startParameter) {
        File searchDir = startParameter.getCurrentDir().getParentFile();
        while (searchDir != null && startParameter.isSearchUpwards()) {
            File settingsFile = new File(searchDir,
            if (settingsFile.exists() && settingsFile.isFile()) {
                return settingsFile;
            searchDir = searchDir.getParentFile();
        return null;

Generated at Wed Jun 30 11:26:40 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.