Add option to isolate the tiny remapper instance between sub-projects. (#588)
parent
03089cf6d7
commit
4fe19028cf
|
@ -58,6 +58,12 @@ public abstract class AbstractRemapJarTask extends Jar {
|
||||||
@Input
|
@Input
|
||||||
public abstract Property<String> getTargetNamespace();
|
public abstract Property<String> getTargetNamespace();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When enabled the TinyRemapperService will not be shared across sub projects.
|
||||||
|
*/
|
||||||
|
@Input
|
||||||
|
public abstract Property<Boolean> getRemapperIsolation();
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected abstract WorkerExecutor getWorkerExecutor();
|
protected abstract WorkerExecutor getWorkerExecutor();
|
||||||
|
|
||||||
|
@ -65,6 +71,7 @@ public abstract class AbstractRemapJarTask extends Jar {
|
||||||
public AbstractRemapJarTask() {
|
public AbstractRemapJarTask() {
|
||||||
getSourceNamespace().convention(MappingsNamespace.NAMED.toString()).finalizeValueOnRead();
|
getSourceNamespace().convention(MappingsNamespace.NAMED.toString()).finalizeValueOnRead();
|
||||||
getTargetNamespace().convention(MappingsNamespace.INTERMEDIARY.toString()).finalizeValueOnRead();
|
getTargetNamespace().convention(MappingsNamespace.INTERMEDIARY.toString()).finalizeValueOnRead();
|
||||||
|
getRemapperIsolation().convention(false).finalizeValueOnRead();
|
||||||
}
|
}
|
||||||
|
|
||||||
public final <P extends AbstractRemapParams> void submitWork(Class<? extends AbstractRemapAction<P>> workAction, Action<P> action) {
|
public final <P extends AbstractRemapParams> void submitWork(Class<? extends AbstractRemapAction<P>> workAction, Action<P> action) {
|
||||||
|
|
|
@ -33,6 +33,7 @@ import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.StringJoiner;
|
||||||
|
|
||||||
import org.gradle.api.Project;
|
import org.gradle.api.Project;
|
||||||
|
|
||||||
|
@ -56,7 +57,19 @@ public class TinyRemapperService implements SharedService {
|
||||||
final boolean useKotlinExtension = project.getPluginManager().hasPlugin("org.jetbrains.kotlin.jvm");
|
final boolean useKotlinExtension = project.getPluginManager().hasPlugin("org.jetbrains.kotlin.jvm");
|
||||||
|
|
||||||
// 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.
|
// 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 var joiner = new StringJoiner(":");
|
||||||
|
joiner.add(extension.getMappingsProvider().getBuildServiceName("remapJarService", from, to));
|
||||||
|
joiner.add(remapJarTask.getName());
|
||||||
|
|
||||||
|
if (useKotlinExtension) {
|
||||||
|
joiner.add("kotlin");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (remapJarTask.getRemapperIsolation().get()) {
|
||||||
|
joiner.add(project.getPath());
|
||||||
|
}
|
||||||
|
|
||||||
|
final String id = joiner.toString();
|
||||||
|
|
||||||
TinyRemapperService service = sharedServiceManager.getOrCreateService(id, () -> {
|
TinyRemapperService service = sharedServiceManager.getOrCreateService(id, () -> {
|
||||||
List<IMappingProvider> mappings = new ArrayList<>();
|
List<IMappingProvider> mappings = new ArrayList<>();
|
||||||
|
|
Loading…
Reference in New Issue