} else {
executorService = Executors.newSingleThreadExecutor();
}
}
ProfileDownloader downloader = new ProfileDownloader(fabricService, target, force, executorService);
downloader.setStopOnFailure(stopOnFailure);
// we do not want to download the files from within the profile itself, only the dependencies
downloader.setDownloadFilesFromProfile(false);
if (verbose) {
downloader.setListener(new ProgressIndicator());
}
if (profile != null) {
Profile profileObject = null;
if (ver.hasProfile(profile)) {
profileObject = ver.getRequiredProfile(profile);
}
if (profileObject == null) {
System.out.println("Source profile " + profile + " not found.");
return null;
}
downloader.downloadProfile(profileObject);
} else {
downloader.downloadVersion(ver);
}
List<String> failedProfileIDs = downloader.getFailedProfileIDs();
System.out.println("Downloaded " + downloader.getProcessedFileCount() + " file(s) to " + target);
if (failedProfileIDs.size() > 0) {
System.out.println("Failed to download these profiles: " + failedProfileIDs + ". Check the logs for details");
}
return null;
}