add missing setCacheDirectory directives

This commit is contained in:
huanghongxun
2019-08-15 12:45:31 +08:00
parent e862a4b46b
commit 27a33f567f
4 changed files with 12 additions and 4 deletions

View File

@@ -67,6 +67,7 @@ public final class ForgeInstallTask extends Task<Version> {
installer = Files.createTempFile("forge-installer", ".jar");
dependent = new FileDownloadTask(NetworkUtils.toURL(remote.getUrl()), installer.toFile())
.setCacheRepository(dependencyManager.getCacheRepository())
.setCaching(true);
}

View File

@@ -89,7 +89,6 @@ public final class GameAssetDownloadTask extends Task<Void> {
String url = dependencyManager.getDownloadProvider().getAssetBaseURL() + assetObject.getLocation();
FileDownloadTask task = new FileDownloadTask(NetworkUtils.toURL(url), file, new FileDownloadTask.IntegrityCheck("SHA-1", assetObject.getHash()));
task.setName(assetObject.getHash());
task.setCaching(true);
dependencies.add(task
.setCacheRepository(dependencyManager.getCacheRepository())
.setCaching(true)

View File

@@ -128,12 +128,16 @@ public class LibraryDownloadTask extends Task<Void> {
try {
URL packXz = NetworkUtils.toURL(url + ".pack.xz");
if (NetworkUtils.urlExists(packXz)) {
task = new FileDownloadTask(packXz, xzFile, null).setCaching(true);
task = new FileDownloadTask(packXz, xzFile, null)
.setCacheRepository(cacheRepository)
.setCaching(true);
xz = true;
} else {
task = new FileDownloadTask(NetworkUtils.toURL(url),
jar,
library.getDownload().getSha1() != null ? new IntegrityCheck("SHA-1", library.getDownload().getSha1()) : null).setCaching(true);
library.getDownload().getSha1() != null ? new IntegrityCheck("SHA-1", library.getDownload().getSha1()) : null)
.setCacheRepository(cacheRepository)
.setCaching(true);
xz = false;
}
} catch (IOException e) {

View File

@@ -45,6 +45,7 @@ import java.util.stream.Collectors;
*/
public final class CurseCompletionTask extends Task<Void> {
private final DefaultDependencyManager dependency;
private final DefaultGameRepository repository;
private final ModManager modManager;
private final String version;
@@ -70,6 +71,7 @@ public final class CurseCompletionTask extends Task<Void> {
* @param manifest the CurseForgeModpack manifest.
*/
public CurseCompletionTask(DefaultDependencyManager dependencyManager, String version, CurseManifest manifest) {
this.dependency = dependencyManager;
this.repository = dependencyManager.getGameRepository();
this.modManager = repository.getModManager(version);
this.version = version;
@@ -140,7 +142,9 @@ public final class CurseCompletionTask extends Task<Void> {
for (CurseManifestFile file : newManifest.getFiles())
if (StringUtils.isNotBlank(file.getFileName())) {
if (!modManager.hasSimpleMod(file.getFileName())) {
dependencies.add(new FileDownloadTask(file.getUrl(), modManager.getSimpleModPath(file.getFileName()).toFile()).setCaching(true));
dependencies.add(new FileDownloadTask(file.getUrl(), modManager.getSimpleModPath(file.getFileName()).toFile())
.setCacheRepository(dependency.getCacheRepository())
.setCaching(true));
}
}