mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-03-30 13:05:27 -05:00
Workaround FabricMC/fabric-loom#587
Signed-off-by: shedaniel <daniel@shedaniel.me>
This commit is contained in:
@@ -41,6 +41,7 @@ import org.gradle.workers.WorkAction;
|
||||
import org.gradle.workers.WorkParameters;
|
||||
import org.gradle.workers.WorkQueue;
|
||||
import org.gradle.workers.WorkerExecutor;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
import net.fabricmc.loom.api.mappings.layered.MappingsNamespace;
|
||||
import net.fabricmc.loom.util.SourceRemapper;
|
||||
@@ -62,10 +63,23 @@ public abstract class AbstractRemapJarTask extends Jar {
|
||||
@Inject
|
||||
protected abstract WorkerExecutor getWorkerExecutor();
|
||||
|
||||
/**
|
||||
* Whether the remap jar service is reused between different projects, this is defaulted to true on upstream, but
|
||||
* it is false by default on this fork, as it breaks setups where remap jar services are receiving the same classes.
|
||||
* This is a temporary workaround until we can figure out a better solution.
|
||||
*
|
||||
* @see <a href="https://github.com/FabricMC/fabric-loom/issues/587">Issue 587</a>
|
||||
* @return Whether the remap jar service is reused between different projects
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@Input
|
||||
public abstract Property<Boolean> getDoesShareProjectState();
|
||||
|
||||
@Inject
|
||||
public AbstractRemapJarTask() {
|
||||
getSourceNamespace().convention(MappingsNamespace.NAMED.toString()).finalizeValueOnRead();
|
||||
getTargetNamespace().convention(SourceRemapper.intermediary(getProject())).finalizeValueOnRead();
|
||||
getDoesShareProjectState().convention(false);
|
||||
}
|
||||
|
||||
public final <P extends AbstractRemapParams> void submitWork(Class<? extends AbstractRemapAction<P>> workAction, Action<P> action) {
|
||||
|
||||
@@ -54,9 +54,10 @@ public class TinyRemapperService implements SharedService {
|
||||
final SharedServiceManager sharedServiceManager = SharedServiceManager.get(project);
|
||||
final boolean legacyMixin = extension.getMixin().getUseLegacyMixinAp().get();
|
||||
final boolean useKotlinExtension = project.getPluginManager().hasPlugin("org.jetbrains.kotlin.jvm");
|
||||
final boolean doesShareProjectState = remapJarTask.getDoesShareProjectState().get();
|
||||
|
||||
// Generates an id that is used to share the remapper across projects. This tasks in the remap jar task name to handle custom remap jar tasks separately.
|
||||
final String id = extension.getMappingsProvider().getBuildServiceName("remapJarService", from, to) + ":" + remapJarTask.getName() + (useKotlinExtension ? ":kotlin" : "");
|
||||
final String id = extension.getMappingsProvider().getBuildServiceName("remapJarService", from, to) + ":" + (doesShareProjectState ? "" : project.getPath() + ":") + remapJarTask.getName() + (useKotlinExtension ? ":kotlin" : "");
|
||||
|
||||
TinyRemapperService service = sharedServiceManager.getOrCreateService(id, () -> {
|
||||
List<IMappingProvider> mappings = new ArrayList<>();
|
||||
|
||||
Reference in New Issue
Block a user