fix #28
parent
0f51d2142f
commit
b00b42e3bf
|
@ -84,6 +84,11 @@ public class AbstractPlugin implements Plugin<Project> {
|
|||
configureIDEs();
|
||||
configureCompile();
|
||||
|
||||
if(extension.refmapName == null || extension.refmapName.isEmpty()){
|
||||
project.getLogger().warn("Could not find refmap definition, will be using default name: " + project.getName() + "-refmap.json");
|
||||
extension.refmapName = project.getName() + "-refmap.json";
|
||||
}
|
||||
|
||||
Map<Project, Set<Task>> taskMap = project.getAllTasks(true);
|
||||
for (Map.Entry<Project, Set<Task>> entry : taskMap.entrySet()) {
|
||||
Project project = entry.getKey();
|
||||
|
@ -97,10 +102,6 @@ public class AbstractPlugin implements Plugin<Project> {
|
|||
try {
|
||||
javaCompileTask.getOptions().getCompilerArgs().add("-AinMapFileNamedIntermediary=" + extension.getMappingsProvider().MAPPINGS_TINY.getCanonicalPath());
|
||||
javaCompileTask.getOptions().getCompilerArgs().add("-AoutMapFileNamedIntermediary=" + extension.getMappingsProvider().MAPPINGS_MIXIN_EXPORT.getCanonicalPath());
|
||||
if(extension.refmapName == null || extension.refmapName.isEmpty()){
|
||||
project.getLogger().error("Could not find refmap definition, will be using default name: " + project.getName() + "-refmap.json");
|
||||
extension.refmapName = project.getName() + "-refmap.json";
|
||||
}
|
||||
javaCompileTask.getOptions().getCompilerArgs().add("-AoutRefMapFile=" + new File(javaCompileTask.getDestinationDir(), extension.refmapName).getCanonicalPath());
|
||||
javaCompileTask.getOptions().getCompilerArgs().add("-AdefaultObfuscationEnv=named:intermediary");
|
||||
} catch (IOException e) {
|
||||
|
@ -233,6 +234,9 @@ public class AbstractPlugin implements Plugin<Project> {
|
|||
remapJarTask.doLast(task -> project1.getArtifacts().add("archives", remapJarTask.jar));
|
||||
remapJarTask.dependsOn(project1.getTasks().getByName("jar"));
|
||||
project1.getTasks().getByName("build").dependsOn(remapJarTask);
|
||||
} else {
|
||||
AbstractArchiveTask jarTask = (AbstractArchiveTask) project1.getTasks().getByName("jar");
|
||||
extension.addUnmappedMod(jarTask.getArchivePath());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -31,12 +31,17 @@ import net.fabricmc.loom.util.LoomDependencyManager;
|
|||
import org.gradle.api.Project;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class LoomGradleExtension {
|
||||
public String runDir = "run";
|
||||
public String refmapName;
|
||||
public boolean remapMod = true;
|
||||
|
||||
private List<File> unmappedModsBuilt = new ArrayList<>();
|
||||
|
||||
//Not to be set in the build.gradle
|
||||
private Project project;
|
||||
private LoomDependencyManager dependencyManager;
|
||||
|
@ -45,6 +50,14 @@ public class LoomGradleExtension {
|
|||
this.project = project;
|
||||
}
|
||||
|
||||
public void addUnmappedMod(File file) {
|
||||
unmappedModsBuilt.add(file);
|
||||
}
|
||||
|
||||
public List<File> getUnmappedMods() {
|
||||
return Collections.unmodifiableList(unmappedModsBuilt);
|
||||
}
|
||||
|
||||
public File getUserCache() {
|
||||
File userCache = new File(project.getGradle().getGradleUserHomeDir(), "caches" + File.separator + "fabric-loom");
|
||||
if (!userCache.exists()) {
|
||||
|
|
|
@ -46,8 +46,7 @@ public class RunClientTask extends JavaExec {
|
|||
for (File file : getProject().getConfigurations().getByName("compile").getFiles()) {
|
||||
libs.add(file.getAbsolutePath());
|
||||
}
|
||||
//Used to add the fabric jar that has been built
|
||||
for (File file : new File(getProject().getBuildDir(), "libs").listFiles()) {
|
||||
for (File file : extension.getUnmappedMods()) {
|
||||
if (file.isFile()) {
|
||||
libs.add(file.getAbsolutePath());
|
||||
}
|
||||
|
|
|
@ -42,8 +42,7 @@ public class RunServerTask extends JavaExec {
|
|||
for (File file : getProject().getConfigurations().getByName("compile").getFiles()) {
|
||||
libs.add(file.getAbsolutePath());
|
||||
}
|
||||
//Used to add the fabric jar that has been built
|
||||
for (File file : new File(getProject().getBuildDir(), "libs").listFiles()) {
|
||||
for (File file : extension.getUnmappedMods()) {
|
||||
if (file.isFile()) {
|
||||
libs.add(file.getAbsolutePath());
|
||||
}
|
||||
|
|
|
@ -66,6 +66,11 @@ public class ModRemapper {
|
|||
File modJarOutput = new File(s.substring(0, s.length() - 4) + ".remapped.jar");
|
||||
Path modJarOutputPath = modJarOutput.toPath();
|
||||
|
||||
File modJarUnmappedCopy = new File(s.substring(0, s.length() - 4) + "-dev.jar");
|
||||
if (modJarUnmappedCopy.exists()) {
|
||||
modJarUnmappedCopy.delete();
|
||||
}
|
||||
|
||||
File mixinMapFile = mappingsProvider.MAPPINGS_MIXIN_EXPORT;
|
||||
Path mixinMapPath = mixinMapFile.toPath();
|
||||
|
||||
|
@ -99,7 +104,8 @@ public class ModRemapper {
|
|||
}
|
||||
|
||||
if (modJar.exists()) {
|
||||
modJar.delete();
|
||||
modJar.renameTo(modJarUnmappedCopy);
|
||||
extension.addUnmappedMod(modJarUnmappedCopy);
|
||||
}
|
||||
|
||||
modJarOutput.renameTo(modJar);
|
||||
|
|
Loading…
Reference in New Issue