use project root dir, should fix files being all over the place

dev/0.11
modmuss50 2018-12-10 14:28:58 +00:00
parent da675e9545
commit f8bcf214f8
8 changed files with 16 additions and 15 deletions

View File

@ -25,9 +25,9 @@
package net.fabricmc.loom;
import com.google.common.collect.ImmutableMap;
import net.fabricmc.loom.providers.MappingsProvider;
import net.fabricmc.loom.providers.MinecraftProvider;
import net.fabricmc.loom.providers.ModRemapperProvider;
import net.fabricmc.loom.providers.MappingsProvider;
import net.fabricmc.loom.task.RemapJar;
import net.fabricmc.loom.util.Constants;
import net.fabricmc.loom.util.LoomDependencyManager;
@ -189,7 +189,7 @@ public class AbstractPlugin implements Plugin<Project> {
});
project1.getRepositories().flatDir(flatDirectoryArtifactRepository -> {
flatDirectoryArtifactRepository.dir(Constants.CACHE_FILES);
flatDirectoryArtifactRepository.dir(extension.getProjectCache());
flatDirectoryArtifactRepository.setName("UserLocalCacheFiles");
});

View File

@ -53,6 +53,14 @@ public class LoomGradleExtension {
return userCache;
}
public File getProjectCache(){
File projectCache = new File(project.getRootDir(), ".gradle/minecraft/");
if(!projectCache.exists()){
projectCache.mkdirs();
}
return projectCache;
}
public LoomDependencyManager getDependencyManager() {
return dependencyManager;
}

View File

@ -106,7 +106,7 @@ public class MappingsProvider extends DependencyProvider {
MAPPINGS_TINY_BASE = new File(MAPPINGS_DIR, mappingsName + "-tiny-" + minecraftVersion + "." + mappingsVersion + "-base");
MAPPINGS_TINY = new File(MAPPINGS_DIR, mappingsName + "-tiny-" + minecraftVersion + "." + mappingsVersion);
MAPPINGS_MIXIN_EXPORT = new File(Constants.CACHE_FILES, "mixin-map-" + minecraftVersion + "." + mappingsVersion + ".tiny");
MAPPINGS_MIXIN_EXPORT = new File(extension.getProjectCache(), "mixin-map-" + minecraftVersion + "." + mappingsVersion + ".tiny");
}
@Override

View File

@ -42,7 +42,8 @@ public class ModRemapperProvider extends DependencyProvider {
MappingsProvider mappingsProvider = getDependencyManager().getProvider(MappingsProvider.class);
String outputName = input.getName().substring(0, input.getName().length() - 4) + "-mapped-" + mappingsProvider.mappingsVersion + ".jar";//TODO use the hash of the input file or something?
File output = new File(Constants.REMAPPED_MODS_STORE, outputName);
File modStore = new File(extension.getProjectCache(), "remapped_mods");
File output = new File(modStore, outputName);
if(output.exists()){
output.delete();
}

View File

@ -24,9 +24,7 @@
package net.fabricmc.loom.task;
import net.fabricmc.loom.LoomGradleExtension;
import net.fabricmc.loom.util.Constants;
import net.fabricmc.loom.util.IdeaRunConfig;
import org.gradle.api.DefaultTask;
import org.gradle.api.Project;
@ -86,7 +84,7 @@ public class GenIdeaProjectTask extends DefaultTask {
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
transformer.transform(source, result);
File runDir = new File(Constants.WORKING_DIRECTORY, extension.runDir);
File runDir = new File(getProject().getRootDir(), extension.runDir);
if (!runDir.exists()) {
runDir.mkdirs();
}

View File

@ -27,7 +27,6 @@ package net.fabricmc.loom.task;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import net.fabricmc.loom.LoomGradleExtension;
import net.fabricmc.loom.util.Constants;
import net.fabricmc.loom.util.IdeaRunConfig;
import org.apache.commons.io.FileUtils;
import org.gradle.api.DefaultTask;
@ -70,7 +69,7 @@ public class GenVsCodeProjectTask extends DefaultTask {
throw new RuntimeException("Failed to write launch.json", e);
}
File runDir = new File(Constants.WORKING_DIRECTORY, extension.runDir);
File runDir = new File(getProject().getRootDir(), extension.runDir);
if (!runDir.exists()) {
runDir.mkdirs();
}

View File

@ -24,13 +24,8 @@
package net.fabricmc.loom.util;
import java.io.File;
public class Constants {
public static final File WORKING_DIRECTORY = new File(".");
public static final File CACHE_FILES = new File(WORKING_DIRECTORY, ".gradle/minecraft");
public static final File REMAPPED_MODS_STORE = new File(CACHE_FILES, "remapped_mods");
public static final String FABRIC_CLIENT_TWEAKER = "net.fabricmc.loader.launch.FabricClientTweaker";
public static final String FABRIC_SERVER_TWEAKER = "net.fabricmc.loader.launch.FabricServerTweaker";

View File

@ -47,7 +47,7 @@ public class SetupIntelijRunConfigs {
throw new RuntimeException("Failed to generate run configs", e);
}
File runDir = new File(Constants.WORKING_DIRECTORY, extension.runDir);
File runDir = new File(project.getRootDir(), extension.runDir);
if (!runDir.exists()) {
runDir.mkdirs();
}