Improve mod re-mapper
This commit is contained in:
parent
9f959ef04d
commit
e274d0c8c5
3 changed files with 18 additions and 14 deletions
|
@ -241,7 +241,7 @@ public class AbstractPlugin implements Plugin<Project> {
|
||||||
|
|
||||||
if (extension.fabricVersion != null && !extension.fabricVersion.isEmpty()) {
|
if (extension.fabricVersion != null && !extension.fabricVersion.isEmpty()) {
|
||||||
//only add this when not in a fabric dev env
|
//only add this when not in a fabric dev env
|
||||||
project1.getDependencies().add(Constants.CONFIG_MC_DEPENDENCIES, "net.fabricmc:fabric-base:" + extension.version + "-" + extension.fabricVersion);
|
project1.getDependencies().add(Constants.CONFIG_MC_DEPENDENCIES, "net.fabricmc:fabric-base:" + extension.version + "-" + extension.fabricVersion + ":debof");
|
||||||
}
|
}
|
||||||
project1.getDependencies().add(Constants.PROCESS_MODS_DEPENDENCIES, "net.fabricmc:fabric-base:16w38a-0.0.4-SNAPSHOT");
|
project1.getDependencies().add(Constants.PROCESS_MODS_DEPENDENCIES, "net.fabricmc:fabric-base:16w38a-0.0.4-SNAPSHOT");
|
||||||
});
|
});
|
||||||
|
|
|
@ -59,8 +59,6 @@ public class ProcessModsTask extends DefaultTask {
|
||||||
if (mods.size() == 0) {
|
if (mods.size() == 0) {
|
||||||
FileUtils.copyFile(Constants.MINECRAFT_MAPPED_JAR.get(extension), Constants.MINECRAFT_FINAL_JAR.get(extension));
|
FileUtils.copyFile(Constants.MINECRAFT_MAPPED_JAR.get(extension), Constants.MINECRAFT_FINAL_JAR.get(extension));
|
||||||
} else {
|
} else {
|
||||||
//TODO figure out a way to specify what deps do what
|
|
||||||
//TODO download deps when needed
|
|
||||||
downloadRequiredDeps(extension);
|
downloadRequiredDeps(extension);
|
||||||
new PreBakeMixins().proccess(getProject(), extension, mods);
|
new PreBakeMixins().proccess(getProject(), extension, mods);
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,17 +42,19 @@ public class ModRemapper {
|
||||||
LoomGradleExtension extension = project.getExtensions().getByType(LoomGradleExtension.class);
|
LoomGradleExtension extension = project.getExtensions().getByType(LoomGradleExtension.class);
|
||||||
//TODO whats the proper way of doing this???
|
//TODO whats the proper way of doing this???
|
||||||
File libsDir = new File(project.getBuildDir(), "libs");
|
File libsDir = new File(project.getBuildDir(), "libs");
|
||||||
File modJar = new File(libsDir, project.getName() + "-" + project.getVersion() + "-unmapped.jar");
|
File debofJar = new File(libsDir, project.getName() + "-" + project.getVersion() + "-debof.jar");
|
||||||
File modMappedJar = new File(libsDir, project.getName() + "-" + project.getVersion() + ".jar");
|
File modJar = new File(libsDir, project.getName() + "-" + project.getVersion() + ".jar");
|
||||||
if (!modMappedJar.exists()) {
|
if (!modJar.exists()) {
|
||||||
project.getLogger().error("Could not find mod jar @" + modJar.getAbsolutePath());
|
project.getLogger().error("Could not find mod jar @" + debofJar.getAbsolutePath());
|
||||||
|
project.getLogger().error("This is can be fixed by adding a 'settings.gradle' file specifying 'rootProject.name'");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (modJar.exists()) {
|
if (debofJar.exists()) {
|
||||||
modJar.delete();
|
debofJar.delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
modMappedJar.renameTo(modJar);
|
//Move the pre existing mod jar to the debof jar
|
||||||
|
modJar.renameTo(debofJar);
|
||||||
|
|
||||||
Path mappings = Constants.MAPPINGS_TINY.get(extension).toPath();
|
Path mappings = Constants.MAPPINGS_TINY.get(extension).toPath();
|
||||||
|
|
||||||
|
@ -75,12 +77,16 @@ public class ModRemapper {
|
||||||
.withMappings(TinyUtils.createTinyMappingProvider(Constants.MAPPINGS_MIXIN_EXPORT.get(extension).toPath(), fromM, toM))
|
.withMappings(TinyUtils.createTinyMappingProvider(Constants.MAPPINGS_MIXIN_EXPORT.get(extension).toPath(), fromM, toM))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
OutputConsumerPath outputConsumer = new OutputConsumerPath(modMappedJar.toPath());
|
OutputConsumerPath outputConsumer = new OutputConsumerPath(modJar.toPath());
|
||||||
outputConsumer.addNonClassFiles(modJar.toPath());
|
//Rebof the debof jar
|
||||||
remapper.read(modJar.toPath());
|
outputConsumer.addNonClassFiles(debofJar.toPath());
|
||||||
|
remapper.read(debofJar.toPath());
|
||||||
remapper.read(classpath);
|
remapper.read(classpath);
|
||||||
remapper.apply(modJar.toPath(), outputConsumer);
|
remapper.apply(debofJar.toPath(), outputConsumer);
|
||||||
outputConsumer.finish();
|
outputConsumer.finish();
|
||||||
remapper.finish();
|
remapper.finish();
|
||||||
|
|
||||||
|
//Add the debof jar to be uploaded to maven
|
||||||
|
project.getArtifacts().add("archives", debofJar);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue