Skip to content

Commit

Permalink
RemapJarTask: Support config cache for Aw2At
Browse files Browse the repository at this point in the history
  • Loading branch information
Juuxel committed Dec 6, 2024
1 parent ef2f09a commit ea3d34b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import dev.architectury.at.AccessTransformSet;
import dev.architectury.at.io.AccessTransformFormats;
import org.gradle.api.provider.Property;
import org.gradle.api.provider.Provider;
import org.gradle.api.provider.SetProperty;
import org.jetbrains.annotations.Nullable;

Expand Down Expand Up @@ -49,13 +50,7 @@ public static Set<String> readMixinConfigsFromManifest(File jarFile) {
}
}

public static void convertAwToAt(ServiceFactory serviceFactory, SetProperty<String> atAccessWidenersProperty, Path outputFile, Property<MappingsService.Options> options) throws IOException {
if (!atAccessWidenersProperty.isPresent()) {
return;
}

Set<String> atAccessWideners = atAccessWidenersProperty.get();

public static void convertAwToAt(ServiceFactory serviceFactory, Set<String> atAccessWideners, Path outputFile, Provider<MappingsService.Options> options) throws IOException {
if (atAccessWideners.isEmpty()) {
return;
}
Expand Down
13 changes: 7 additions & 6 deletions src/main/java/net/fabricmc/loom/task/RemapJarTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,6 @@ public void run() {
params.getReadMixinConfigsFromManifest().set(getReadMixinConfigsFromManifest());
params.getAtAccessWideners().set(getAtAccessWideners());

if (!getAtAccessWideners().get().isEmpty()) {
params.getMappingsServiceOptions().set(MappingsService.createOptionsWithProjectMappings(getProject(), getSourceNamespace(), getTargetNamespace()));
}

params.getOptimizeFmj().set(getOptimizeFabricModJson().get());
});
}
Expand All @@ -236,7 +232,6 @@ public interface RemapParams extends AbstractRemapParams {

Property<TinyRemapperService.Options> getTinyRemapperServiceOptions();
ListProperty<MixinRefmapService.Options> getMixinRefmapServiceOptions();
Property<MappingsService.Options> getMappingsServiceOptions();
}

public abstract static class RemapAction extends AbstractRemapAction<RemapParams> {
Expand Down Expand Up @@ -277,7 +272,13 @@ public void execute() {

addRefmaps(serviceFactory);
addNestedJars();
ModBuildExtensions.convertAwToAt(serviceFactory, getParameters().getAtAccessWideners(), outputFile, getParameters().getMappingsServiceOptions());

if (getParameters().getAtAccessWideners().isPresent()) {
final Provider<MappingsService.Options> mappingsServiceOptions = getParameters().getTinyRemapperServiceOptions()
.flatMap(TinyRemapperService.Options::getMappings)
.map(mappingsOptions -> mappingsOptions.get(0));
ModBuildExtensions.convertAwToAt(serviceFactory, getParameters().getAtAccessWideners().get(), outputFile, mappingsServiceOptions);
}

if (!getParameters().getPlatform().get().isForgeLike()) {
modifyJarManifest();
Expand Down

0 comments on commit ea3d34b

Please sign in to comment.