make modCompile use flat directory artifact location instead of hack

dev/0.11
Adrian Siekierka 2018-12-22 14:44:34 +01:00
parent a620812aab
commit 530896e41a
3 changed files with 19 additions and 3 deletions

View File

@ -196,6 +196,11 @@ public class AbstractPlugin implements Plugin<Project> {
flatDirectoryArtifactRepository.setName("UserLocalCacheFiles");
});
project1.getRepositories().flatDir(flatDirectoryArtifactRepository -> {
flatDirectoryArtifactRepository.dir(extension.getRemappedModCache());
flatDirectoryArtifactRepository.setName("UserLocalRemappedMods");
});
project1.getRepositories().maven(mavenArtifactRepository -> {
mavenArtifactRepository.setName("Fabric");
mavenArtifactRepository.setUrl("https://maven.fabricmc.net/");

View File

@ -100,6 +100,14 @@ public class LoomGradleExtension {
return projectCache;
}
public File getRemappedModCache() {
File remappedModCache = new File(getProjectCache(), "remapped_mods/");
if (!remappedModCache.exists()) {
remappedModCache.mkdir();
}
return remappedModCache;
}
@Nullable
public String getMixinVersion() {
for (Dependency dependency : project.getConfigurations().getByName("compile").getDependencies()) {

View File

@ -40,9 +40,10 @@ public class ModRemapperProvider extends DependencyProvider {
project.getLogger().lifecycle("Providing " + dependency.getDepString());
MappingsProvider mappingsProvider = getDependencyManager().getProvider(MappingsProvider.class);
String verSuffix = ".mapped." + mappingsProvider.mappingsName + "." + mappingsProvider.mappingsVersion;
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 modStore = new File(extension.getProjectCache(), "remapped_mods");
String outputName = input.getName().substring(0, input.getName().length() - 4) + verSuffix + ".jar";//TODO use the hash of the input file or something?
File modStore = extension.getRemappedModCache();
File output = new File(modStore, outputName);
if(output.exists()){
output.delete();
@ -54,7 +55,9 @@ public class ModRemapperProvider extends DependencyProvider {
throw new RuntimeException("Failed to remap mod");
}
addDependency(output, project);
project.getDependencies().add("compile", project.getDependencies().module(
dependency.getDepString() + verSuffix
));
}
@Override