Initial work on remapping mixins
This commit is contained in:
parent
c322cbd3de
commit
5e18df32a5
3 changed files with 33 additions and 2 deletions
|
@ -15,7 +15,7 @@ apply from: 'https://github.com/FabricMC/fabric-docs/raw/master/gradle/license.g
|
|||
|
||||
group = 'net.fabricmc'
|
||||
archivesBaseName = project.name.toLowerCase()
|
||||
version = '0.0.3-SNAPSHOT'
|
||||
version = '0.0.4-SNAPSHOT'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
|
|
@ -31,6 +31,7 @@ import com.google.gson.JsonObject;
|
|||
import net.fabricmc.loom.task.DownloadTask;
|
||||
import net.fabricmc.loom.util.Constants;
|
||||
import net.fabricmc.loom.util.Version;
|
||||
import org.gradle.api.Action;
|
||||
import org.gradle.api.Plugin;
|
||||
import org.gradle.api.Project;
|
||||
import org.gradle.api.Task;
|
||||
|
@ -38,6 +39,7 @@ import org.gradle.api.artifacts.repositories.MavenArtifactRepository;
|
|||
import org.gradle.api.plugins.JavaPlugin;
|
||||
import org.gradle.api.plugins.JavaPluginConvention;
|
||||
import org.gradle.api.tasks.SourceSet;
|
||||
import org.gradle.api.tasks.compile.JavaCompile;
|
||||
import org.gradle.api.tasks.javadoc.Javadoc;
|
||||
import org.gradle.plugins.ide.eclipse.model.EclipseModel;
|
||||
import org.gradle.plugins.ide.idea.model.IdeaModel;
|
||||
|
@ -46,6 +48,8 @@ import java.io.File;
|
|||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class AbstractPlugin implements Plugin<Project> {
|
||||
protected Project project;
|
||||
|
@ -62,7 +66,8 @@ public class AbstractPlugin implements Plugin<Project> {
|
|||
project.getExtensions().create("minecraft", LoomGradleExtension.class);
|
||||
project.getExtensions().getByType(LoomGradleExtension.class).project = project;
|
||||
|
||||
readModJson(project.getExtensions().getByType(LoomGradleExtension.class));
|
||||
LoomGradleExtension extension = project.getExtensions().getByType(LoomGradleExtension.class);
|
||||
readModJson(extension);
|
||||
|
||||
// Force add Mojang repository
|
||||
addMavenRepo(target, "Mojang", "https://libraries.minecraft.net/");
|
||||
|
@ -77,6 +82,29 @@ public class AbstractPlugin implements Plugin<Project> {
|
|||
|
||||
configureIDEs();
|
||||
configureCompile();
|
||||
|
||||
//TODO other languages?
|
||||
Map<Project,Set<Task>> taskMap = project.getAllTasks(true);
|
||||
for(Map.Entry<Project,Set<Task>> entry : taskMap.entrySet()) {
|
||||
Project project = entry.getKey();
|
||||
Set<Task> taskSet = entry.getValue();
|
||||
for(Task task : taskSet){
|
||||
if(task instanceof JavaCompile){
|
||||
JavaCompile javaCompileTask = (JavaCompile) task;
|
||||
javaCompileTask.doFirst(task1 -> {
|
||||
project.getLogger().lifecycle(":setting java compiler args");
|
||||
try {
|
||||
javaCompileTask.getOptions().getCompilerArgs().add("-AreobfNotchSrgFile=" + Constants.MAPPINGS_SRG.get(extension).getCanonicalPath());
|
||||
javaCompileTask.getOptions().getCompilerArgs().add("-AdefaultObfuscationEnv=notch");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -46,6 +46,9 @@ public class Constants {
|
|||
public static final IDelayed<File> POMF_DIR = new DelayedFile(extension -> new File(extension.getFabricUserCache(), "pomf"));
|
||||
public static final IDelayed<File> MAPPINGS_ZIP = new DelayedFile(extension -> new File(POMF_DIR.get(extension), "pomf-enigma-" + extension.version + "." + extension.pomfVersion + ".zip"));
|
||||
public static final IDelayed<File> MAPPINGS_DIR = new DelayedFile(extension -> new File(POMF_DIR.get(extension), "pomf-enigma-" + extension.version + "." + extension.pomfVersion + ""));
|
||||
public static final IDelayed<File> MAPPINGS_SRG = new DelayedFile(extension -> new File(WORKING_DIRECTORY, "mappings.srg"));
|
||||
|
||||
public static final IDelayed<File> REF_MAP = new DelayedFile(extension -> new File(WORKING_DIRECTORY, "RefMap.json"));
|
||||
|
||||
public static final IDelayed<File> MINECRAFT_LIBS = new DelayedFile(extension -> new File(extension.getFabricUserCache(), extension.version + "-libs"));
|
||||
public static final IDelayed<File> MINECRAFT_NATIVES = new DelayedFile(extension -> new File(extension.getFabricUserCache(), extension.version + "-natives"));
|
||||
|
|
Loading…
Reference in a new issue