/** * Given a targetDirectory /some/path/to/y that contains files z, w, and v, create the following * directory structure: * * <pre> * .external-repository/ * x/ * WORKSPACE * BUILD -> <build_root>/x.BUILD * z -> /some/path/to/y/z * w -> /some/path/to/y/w * v -> /some/path/to/y/v * </pre> */ public static boolean symlinkLocalRepositoryContents( Path repositoryDirectory, Path targetDirectory, Environment env) throws RepositoryFunctionException { try { for (Path target : targetDirectory.getDirectoryEntries()) { Path symlinkPath = repositoryDirectory.getRelative(target.getBaseName()); if (createSymbolicLink(symlinkPath, target, env) == null) { return false; } } } catch (IOException e) { throw new RepositoryFunctionException(e, Transience.TRANSIENT); } return true; }