make modCompile use flat directory artifact location instead of hack
parent
a620812aab
commit
530896e41a
|
@ -196,6 +196,11 @@ public class AbstractPlugin implements Plugin<Project> {
|
||||||
flatDirectoryArtifactRepository.setName("UserLocalCacheFiles");
|
flatDirectoryArtifactRepository.setName("UserLocalCacheFiles");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
project1.getRepositories().flatDir(flatDirectoryArtifactRepository -> {
|
||||||
|
flatDirectoryArtifactRepository.dir(extension.getRemappedModCache());
|
||||||
|
flatDirectoryArtifactRepository.setName("UserLocalRemappedMods");
|
||||||
|
});
|
||||||
|
|
||||||
project1.getRepositories().maven(mavenArtifactRepository -> {
|
project1.getRepositories().maven(mavenArtifactRepository -> {
|
||||||
mavenArtifactRepository.setName("Fabric");
|
mavenArtifactRepository.setName("Fabric");
|
||||||
mavenArtifactRepository.setUrl("https://maven.fabricmc.net/");
|
mavenArtifactRepository.setUrl("https://maven.fabricmc.net/");
|
||||||
|
|
|
@ -100,6 +100,14 @@ public class LoomGradleExtension {
|
||||||
return projectCache;
|
return projectCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public File getRemappedModCache() {
|
||||||
|
File remappedModCache = new File(getProjectCache(), "remapped_mods/");
|
||||||
|
if (!remappedModCache.exists()) {
|
||||||
|
remappedModCache.mkdir();
|
||||||
|
}
|
||||||
|
return remappedModCache;
|
||||||
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public String getMixinVersion() {
|
public String getMixinVersion() {
|
||||||
for (Dependency dependency : project.getConfigurations().getByName("compile").getDependencies()) {
|
for (Dependency dependency : project.getConfigurations().getByName("compile").getDependencies()) {
|
||||||
|
|
|
@ -40,9 +40,10 @@ public class ModRemapperProvider extends DependencyProvider {
|
||||||
project.getLogger().lifecycle("Providing " + dependency.getDepString());
|
project.getLogger().lifecycle("Providing " + dependency.getDepString());
|
||||||
|
|
||||||
MappingsProvider mappingsProvider = getDependencyManager().getProvider(MappingsProvider.class);
|
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?
|
String outputName = input.getName().substring(0, input.getName().length() - 4) + verSuffix + ".jar";//TODO use the hash of the input file or something?
|
||||||
File modStore = new File(extension.getProjectCache(), "remapped_mods");
|
File modStore = extension.getRemappedModCache();
|
||||||
File output = new File(modStore, outputName);
|
File output = new File(modStore, outputName);
|
||||||
if(output.exists()){
|
if(output.exists()){
|
||||||
output.delete();
|
output.delete();
|
||||||
|
@ -54,7 +55,9 @@ public class ModRemapperProvider extends DependencyProvider {
|
||||||
throw new RuntimeException("Failed to remap mod");
|
throw new RuntimeException("Failed to remap mod");
|
||||||
}
|
}
|
||||||
|
|
||||||
addDependency(output, project);
|
project.getDependencies().add("compile", project.getDependencies().module(
|
||||||
|
dependency.getDepString() + verSuffix
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue