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