Allow other source sets to be remapped without needing an access widener

dev/0.11
Joe 2020-05-11 12:48:04 +01:00
parent 26755cb82c
commit a134913c71
No known key found for this signature in database
GPG Key ID: 1CFA16855A08AEAB
3 changed files with 13 additions and 1 deletions

View File

@ -295,6 +295,7 @@ public class AbstractPlugin implements Plugin<Project> {
extension.addUnmappedMod(jarTask.getArchivePath().toPath());
remapJarTask.getAddNestedDependencies().set(true);
remapJarTask.getRemapAccessWidener().set(true);
project1.getArtifacts().add("archives", remapJarTask);
remapJarTask.dependsOn(jarTask);

View File

@ -100,6 +100,10 @@ public class LoomGradleExtension {
return installerJson;
}
public void accessWidener(Object file) {
this.accessWidener = project.file(file);
}
public File getUserCache() {
File userCache = new File(project.getGradle().getGradleUserHomeDir(), "caches" + File.separator + "fabric-loom");

View File

@ -53,11 +53,13 @@ import net.fabricmc.tinyremapper.TinyUtils;
public class RemapJarTask extends Jar {
private RegularFileProperty input;
private Property<Boolean> addNestedDependencies;
private Property<Boolean> remapAccessWidener;
public RemapJarTask() {
super();
input = GradleSupport.getfileProperty(getProject());
addNestedDependencies = getProject().getObjects().property(Boolean.class);
remapAccessWidener = getProject().getObjects().property(Boolean.class);
}
@TaskAction
@ -129,7 +131,7 @@ public class RemapJarTask extends Jar {
}
}
if (extension.accessWidener != null) {
if (getRemapAccessWidener().getOrElse(false) && extension.accessWidener != null) {
extension.getJarProcessorManager().getByType(AccessWidenerJarProcessor.class).remapAccessWidener(output);
}
@ -154,4 +156,9 @@ public class RemapJarTask extends Jar {
public Property<Boolean> getAddNestedDependencies() {
return addNestedDependencies;
}
@Input
public Property<Boolean> getRemapAccessWidener() {
return remapAccessWidener;
}
}