add toggle to disable jar nesting in RemapJar tasks
parent
221fcf2f51
commit
6a7a00c426
|
@ -33,25 +33,31 @@ import java.io.File;
|
|||
|
||||
public class RemapJar extends DefaultLoomTask {
|
||||
public File jar;
|
||||
public File backupTo;
|
||||
public File destination;
|
||||
public boolean nestJar;
|
||||
|
||||
@Input
|
||||
public File getJar() {
|
||||
return jar;
|
||||
}
|
||||
|
||||
@Input
|
||||
public boolean isNestJar() {
|
||||
return nestJar;
|
||||
}
|
||||
|
||||
@OutputFile
|
||||
public File getBackupTo() {
|
||||
if (backupTo == null) {
|
||||
public File getDestination() {
|
||||
if (destination == null) {
|
||||
String s = jar.getAbsolutePath();
|
||||
return new File(s.substring(0, s.length() - 4) + "-dev.jar");
|
||||
}
|
||||
|
||||
return backupTo;
|
||||
return destination;
|
||||
}
|
||||
|
||||
@TaskAction
|
||||
public void remap() {
|
||||
ModRemapper.remap(this);
|
||||
ModRemapper.remap(this, nestJar);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ import java.util.List;
|
|||
|
||||
public class ModRemapper {
|
||||
|
||||
public static void remap(RemapJar task) {
|
||||
public static void remap(RemapJar task, boolean nest) {
|
||||
Project project = task.getProject();
|
||||
LoomGradleExtension extension = project.getExtensions().getByType(LoomGradleExtension.class);
|
||||
|
||||
|
@ -70,7 +70,7 @@ public class ModRemapper {
|
|||
File modJarOutput = new File(s.substring(0, s.length() - 4) + ".remapped.jar");
|
||||
Path modJarOutputPath = modJarOutput.toPath();
|
||||
|
||||
File modJarUnmappedCopy = task.getBackupTo();
|
||||
File modJarUnmappedCopy = task.getDestination();
|
||||
if (modJarUnmappedCopy.exists()) {
|
||||
modJarUnmappedCopy.delete();
|
||||
}
|
||||
|
@ -107,9 +107,11 @@ public class ModRemapper {
|
|||
project.getLogger().debug("Transformed mixin reference maps in output JAR!");
|
||||
}
|
||||
|
||||
if (nest) {
|
||||
if (NestedJars.addNestedJars(project, modJarOutput)) {
|
||||
project.getLogger().debug("Added nested jar paths to mod json");
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
if (modJar.exists()) {
|
||||
|
|
Loading…
Reference in New Issue