Alter TransitiveAccessWidenerJarProcessor to use the same logic used in ModCompileRemapper for resolving mod jars.
parent
640deecd96
commit
13f4b29d12
|
@ -26,12 +26,18 @@ package net.fabricmc.loom.configuration.accesswidener;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Path;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import org.gradle.api.Project;
|
import org.gradle.api.Project;
|
||||||
|
import org.gradle.api.artifacts.Configuration;
|
||||||
|
import org.gradle.api.artifacts.FileCollectionDependency;
|
||||||
|
import org.gradle.api.artifacts.ResolvedArtifact;
|
||||||
|
import org.gradle.api.file.FileCollection;
|
||||||
|
|
||||||
import net.fabricmc.accesswidener.AccessWidener;
|
import net.fabricmc.accesswidener.AccessWidener;
|
||||||
import net.fabricmc.accesswidener.AccessWidenerReader;
|
import net.fabricmc.accesswidener.AccessWidenerReader;
|
||||||
|
@ -80,7 +86,8 @@ public class TransitiveAccessWidenerJarProcessor implements JarProcessor {
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<AccessWidenerFile> getTransitiveAccessWideners() {
|
private List<AccessWidenerFile> getTransitiveAccessWideners() {
|
||||||
List<AccessWidenerFile> accessWideners = new ArrayList<>();
|
final List<AccessWidenerFile> accessWideners = new ArrayList<>();
|
||||||
|
final Set<Path> possibleModJars = new HashSet<>();
|
||||||
|
|
||||||
for (RemappedConfigurationEntry entry : Constants.MOD_COMPILE_ENTRIES) {
|
for (RemappedConfigurationEntry entry : Constants.MOD_COMPILE_ENTRIES) {
|
||||||
// Only apply global AWs from mods that are part of the compile classpath
|
// Only apply global AWs from mods that are part of the compile classpath
|
||||||
|
@ -88,12 +95,24 @@ public class TransitiveAccessWidenerJarProcessor implements JarProcessor {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Set<File> artifacts = extension.getLazyConfigurationProvider(entry.sourceConfiguration())
|
final Configuration configuration = extension.getLazyConfigurationProvider(entry.sourceConfiguration()).get();
|
||||||
.get()
|
|
||||||
.resolve();
|
|
||||||
|
|
||||||
for (File artifact : artifacts) {
|
// Based off the logic in ModCompileRemapper.
|
||||||
AccessWidenerFile accessWidener = AccessWidenerFile.fromModJar(artifact.toPath());
|
for (ResolvedArtifact artifact : configuration.getResolvedConfiguration().getResolvedArtifacts()) {
|
||||||
|
possibleModJars.add(artifact.getFile().toPath());
|
||||||
|
}
|
||||||
|
|
||||||
|
for (FileCollectionDependency dependency : configuration.getAllDependencies().withType(FileCollectionDependency.class)) {
|
||||||
|
FileCollection files = dependency.getFiles();
|
||||||
|
|
||||||
|
for (File artifact : files) {
|
||||||
|
possibleModJars.add(artifact.toPath());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Path path : possibleModJars) {
|
||||||
|
AccessWidenerFile accessWidener = AccessWidenerFile.fromModJar(path);
|
||||||
|
|
||||||
if (accessWidener == null) {
|
if (accessWidener == null) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -106,7 +125,6 @@ public class TransitiveAccessWidenerJarProcessor implements JarProcessor {
|
||||||
|
|
||||||
accessWideners.add(accessWidener);
|
accessWideners.add(accessWidener);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return accessWideners;
|
return accessWideners;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ import org.gradle.util.GradleVersion
|
||||||
|
|
||||||
class LoomTestConstants {
|
class LoomTestConstants {
|
||||||
public final static String DEFAULT_GRADLE = GradleVersion.current().getVersion()
|
public final static String DEFAULT_GRADLE = GradleVersion.current().getVersion()
|
||||||
public final static String PRE_RELEASE_GRADLE = "7.4-20211011231946+0000"
|
public final static String PRE_RELEASE_GRADLE = "7.4-20211023222429+0000"
|
||||||
|
|
||||||
public final static String[] STANDARD_TEST_VERSIONS = [DEFAULT_GRADLE, PRE_RELEASE_GRADLE]
|
public final static String[] STANDARD_TEST_VERSIONS = [DEFAULT_GRADLE, PRE_RELEASE_GRADLE]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue