Example #1
0
  private void unmigrateJobsDir(File jobs) throws Exception {
    File[] jobDirs = jobs.listFiles();
    if (jobDirs == null) {
      System.err.println(jobs + " claimed to exist, but cannot be listed");
      return;
    }
    for (File job : jobDirs) {

      if (job.getName().equals("builds")) {
        // Might be maven modules, matrix builds, etc. which are direct children of job
        unmigrateBuildsDir(job);
      }

      File[] kids = job.listFiles();
      if (kids == null) {
        continue;
      }
      for (File kid : kids) {
        if (!kid.isDirectory()) {
          continue;
        }
        if (kid.getName().equals("builds")) {
          unmigrateBuildsDir(kid);
        } else {
          // Might be jobs, modules, promotions, etc.; we assume an ItemGroup.getRootDirFor
          // implementation
          // returns grandchildren, unmigrateJobsDir(job) call above handles children.
          unmigrateJobsDir(kid);
        }
      }
    }
  }
Example #2
0
 private void unmigrateJobsDir(File jobs) throws Exception {
   for (File job : jobs.listFiles()) {
     File[] kids = job.listFiles();
     if (kids == null) {
       continue;
     }
     for (File kid : kids) {
       if (!kid.isDirectory()) {
         continue;
       }
       if (kid.getName().equals("builds")) {
         unmigrateBuildsDir(kid);
       } else {
         // Might be jobs, modules, promotions, etc.; we assume an ItemGroup.getRootDirFor
         // implementation returns grandchildren.
         unmigrateJobsDir(kid);
       }
     }
   }
 }