Move user cache

dev/0.11
TheCodedOne 2018-05-13 02:43:40 +01:00
parent abf17b01d7
commit bd7dfab919
6 changed files with 15 additions and 15 deletions

View File

@ -161,7 +161,7 @@ public class AbstractPlugin implements Plugin<Project> {
LoomGradleExtension extension = project1.getExtensions().getByType(LoomGradleExtension.class); LoomGradleExtension extension = project1.getExtensions().getByType(LoomGradleExtension.class);
project1.getRepositories().flatDir(flatDirectoryArtifactRepository -> { project1.getRepositories().flatDir(flatDirectoryArtifactRepository -> {
flatDirectoryArtifactRepository.dir(extension.getFabricUserCache()); flatDirectoryArtifactRepository.dir(extension.getUserCache());
flatDirectoryArtifactRepository.setName("UserCacheFiles"); flatDirectoryArtifactRepository.setName("UserCacheFiles");
}); });

View File

@ -49,8 +49,8 @@ public class LoomGradleExtension {
return fabricVersion != null && !fabricVersion.isEmpty(); return fabricVersion != null && !fabricVersion.isEmpty();
} }
public File getFabricUserCache() { public File getUserCache() {
File userCache = new File(project.getGradle().getGradleUserHomeDir(), "caches" + File.separator + "loom"); File userCache = new File(project.getGradle().getGradleUserHomeDir(), "caches" + File.separator + "opengradle");
if (!userCache.exists()) { if (!userCache.exists()) {
userCache.mkdirs(); userCache.mkdirs();
} }

View File

@ -143,7 +143,7 @@ public class DownloadTask extends DefaultTask {
Version.AssetIndex assetIndex = version.assetIndex; Version.AssetIndex assetIndex = version.assetIndex;
File assets = new File(extension.getFabricUserCache(), "assets-" + extension.version); File assets = new File(extension.getUserCache(), "assets-" + extension.version);
if (!assets.exists()) { if (!assets.exists()) {
assets.mkdirs(); assets.mkdirs();
} }

View File

@ -140,7 +140,7 @@ public class GenIdeaProjectTask extends DefaultTask {
ideaClient.configName = "Minecraft Client"; ideaClient.configName = "Minecraft Client";
ideaClient.runDir = "file://$PROJECT_DIR$/" + extension.runDir; ideaClient.runDir = "file://$PROJECT_DIR$/" + extension.runDir;
ideaClient.vmArgs = "-Djava.library.path=" + Constants.MINECRAFT_NATIVES.get(extension).getAbsolutePath() + " -Dfabric.development=true"; ideaClient.vmArgs = "-Djava.library.path=" + Constants.MINECRAFT_NATIVES.get(extension).getAbsolutePath() + " -Dfabric.development=true";
ideaClient.programArgs = "--tweakClass com.openmodloader.loader.launch.OpenClientTweaker --assetIndex " + version.assetIndex.id + " --assetsDir " + new File(extension.getFabricUserCache(), "assets-" + extension.version).getAbsolutePath(); ideaClient.programArgs = "--tweakClass com.openmodloader.loader.launch.OpenClientTweaker --assetIndex " + version.assetIndex.id + " --assetsDir " + new File(extension.getUserCache(), "assets-" + extension.version).getAbsolutePath();
runManager.appendChild(ideaClient.genRuns(runManager)); runManager.appendChild(ideaClient.genRuns(runManager));

View File

@ -68,7 +68,7 @@ public class RunClientTask extends JavaExec {
libs.add(Constants.MINECRAFT_FINAL_JAR.get(extension).getAbsolutePath()); libs.add(Constants.MINECRAFT_FINAL_JAR.get(extension).getAbsolutePath());
classpath(libs); classpath(libs);
args("--tweakClass", "com.openmodloader.loader.launch.OpenClientTweaker", "--assetIndex", version.assetIndex.id, "--assetsDir", new File(extension.getFabricUserCache(), "assets-" + extension.version).getAbsolutePath()); args("--tweakClass", "com.openmodloader.loader.launch.OpenClientTweaker", "--assetIndex", version.assetIndex.id, "--assetsDir", new File(extension.getUserCache(), "assets-" + extension.version).getAbsolutePath());
setWorkingDir(new File(getProject().getRootDir(), "run")); setWorkingDir(new File(getProject().getRootDir(), "run"));

View File

@ -37,13 +37,13 @@ public class Constants {
public static final File WORKING_DIRECTORY = new File("."); public static final File WORKING_DIRECTORY = new File(".");
public static final File CACHE_FILES = new File(WORKING_DIRECTORY, ".gradle/minecraft"); public static final File CACHE_FILES = new File(WORKING_DIRECTORY, ".gradle/minecraft");
public static final IDelayed<File> MINECRAFT_CLIENT_JAR = new DelayedFile(extension -> new File(extension.getFabricUserCache(), extension.version + "-client.jar")); public static final IDelayed<File> MINECRAFT_CLIENT_JAR = new DelayedFile(extension -> new File(extension.getUserCache(), extension.version + "-client.jar"));
public static final IDelayed<File> MINECRAFT_SERVER_JAR = new DelayedFile(extension -> new File(extension.getFabricUserCache(), extension.version + "-server.jar")); public static final IDelayed<File> MINECRAFT_SERVER_JAR = new DelayedFile(extension -> new File(extension.getUserCache(), extension.version + "-server.jar"));
public static final IDelayed<File> MINECRAFT_MERGED_JAR = new DelayedFile(extension -> new File(extension.getFabricUserCache(), extension.version + "-merged.jar")); public static final IDelayed<File> MINECRAFT_MERGED_JAR = new DelayedFile(extension -> new File(extension.getUserCache(), extension.version + "-merged.jar"));
public static final IDelayed<File> MINECRAFT_MAPPED_JAR = new DelayedFile(extension -> new File(extension.getFabricUserCache(), extension.getVersionString() + "-mapped-" + extension.pomfVersion + ".jar")); public static final IDelayed<File> MINECRAFT_MAPPED_JAR = new DelayedFile(extension -> new File(extension.getUserCache(), extension.getVersionString() + "-mapped-" + extension.pomfVersion + ".jar"));
public static final IDelayed<File> MINECRAFT_FINAL_JAR = new DelayedFile(extension -> new File(CACHE_FILES, extension.getVersionString() + "-mixed-" + extension.pomfVersion + ".jar")); public static final IDelayed<File> MINECRAFT_FINAL_JAR = new DelayedFile(extension -> new File(CACHE_FILES, extension.getVersionString() + "-mixed-" + extension.pomfVersion + ".jar"));
public static final IDelayed<File> POMF_DIR = new DelayedFile(extension -> new File(extension.getFabricUserCache(), "pomf")); public static final IDelayed<File> POMF_DIR = new DelayedFile(extension -> new File(extension.getUserCache(), "pomf"));
public static IDelayed<File> MAPPINGS_ZIP = new DelayedFile(extension -> new File(POMF_DIR.get(extension), "pomf-enigma-" + extension.version + "." + extension.pomfVersion + ".zip")); public static IDelayed<File> MAPPINGS_ZIP = new DelayedFile(extension -> new File(POMF_DIR.get(extension), "pomf-enigma-" + extension.version + "." + extension.pomfVersion + ".zip"));
public static final IDelayed<File> MAPPINGS_DIR = new DelayedFile(extension -> new File(POMF_DIR.get(extension), "pomf-enigma-" + extension.version + "." + extension.pomfVersion + "")); public static final IDelayed<File> MAPPINGS_DIR = new DelayedFile(extension -> new File(POMF_DIR.get(extension), "pomf-enigma-" + extension.version + "." + extension.pomfVersion + ""));
public static IDelayed<File> MAPPINGS_TINY_GZ = new DelayedFile(extension -> new File(POMF_DIR.get(extension), "pomf-tiny-" + extension.version + "." + extension.pomfVersion + ".gz")); public static IDelayed<File> MAPPINGS_TINY_GZ = new DelayedFile(extension -> new File(POMF_DIR.get(extension), "pomf-tiny-" + extension.version + "." + extension.pomfVersion + ".gz"));
@ -53,11 +53,11 @@ public class Constants {
public static final IDelayed<File> MAPPINGS_ZIP_LOCAL = new DelayedFile(extension -> new File(MAPPINGS_DIR_LOCAL.get(extension), "pomf-enigma-" + extension.version + ".zip")); public static final IDelayed<File> MAPPINGS_ZIP_LOCAL = new DelayedFile(extension -> new File(MAPPINGS_DIR_LOCAL.get(extension), "pomf-enigma-" + extension.version + ".zip"));
public static final IDelayed<File> MAPPINGS_TINY_GZ_LOCAL = new DelayedFile(extension -> new File(MAPPINGS_DIR_LOCAL.get(extension), "pomf-tiny-" + extension.version + ".gz")); public static final IDelayed<File> MAPPINGS_TINY_GZ_LOCAL = new DelayedFile(extension -> new File(MAPPINGS_DIR_LOCAL.get(extension), "pomf-tiny-" + extension.version + ".gz"));
public static final IDelayed<File> MINECRAFT_LIBS = new DelayedFile(extension -> new File(extension.getFabricUserCache(), extension.version + "-libs")); public static final IDelayed<File> MINECRAFT_LIBS = new DelayedFile(extension -> new File(extension.getUserCache(), extension.version + "-libs"));
public static final IDelayed<File> MINECRAFT_NATIVES = new DelayedFile(extension -> new File(extension.getFabricUserCache(), extension.version + "-natives")); public static final IDelayed<File> MINECRAFT_NATIVES = new DelayedFile(extension -> new File(extension.getUserCache(), extension.version + "-natives"));
public static final IDelayed<File> MINECRAFT_JSON = new DelayedFile(extension -> new File(extension.getFabricUserCache(), extension.version + "-info.json")); public static final IDelayed<File> MINECRAFT_JSON = new DelayedFile(extension -> new File(extension.getUserCache(), extension.version + "-info.json"));
public static final IDelayed<File> VERSION_MANIFEST = new DelayedFile(extension -> new File(extension.getFabricUserCache(), "version_manifest.json")); public static final IDelayed<File> VERSION_MANIFEST = new DelayedFile(extension -> new File(extension.getUserCache(), "version_manifest.json"));
public static final String LIBRARIES_BASE = "https://libraries.minecraft.net/"; public static final String LIBRARIES_BASE = "https://libraries.minecraft.net/";
public static final String RESOURCES_BASE = "http://resources.download.minecraft.net/"; public static final String RESOURCES_BASE = "http://resources.download.minecraft.net/";