mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-03-28 04:07:01 -05:00
Fix #97, use userdev source jar coordinates in ForgeSourcesRemapper
This commit is contained in:
@@ -45,14 +45,13 @@ import org.cadixdev.lorenz.MappingSet;
|
||||
import org.cadixdev.mercury.Mercury;
|
||||
import org.cadixdev.mercury.remapper.MercuryRemapper;
|
||||
import org.gradle.api.Project;
|
||||
import org.gradle.api.artifacts.ResolvedArtifact;
|
||||
|
||||
import net.fabricmc.loom.LoomGradleExtension;
|
||||
import net.fabricmc.loom.api.mappings.layered.MappingsNamespace;
|
||||
import net.fabricmc.loom.configuration.mods.ModConfigurationRemapper;
|
||||
import net.fabricmc.loom.task.GenerateSourcesTask;
|
||||
import net.fabricmc.loom.util.Constants;
|
||||
import net.fabricmc.loom.util.DeletingFileVisitor;
|
||||
import net.fabricmc.loom.util.DependencyDownloader;
|
||||
import net.fabricmc.loom.util.FileSystemUtil;
|
||||
import net.fabricmc.loom.util.ForgeToolExecutor;
|
||||
import net.fabricmc.loom.util.SourceRemapper;
|
||||
@@ -108,14 +107,12 @@ public class ForgeSourcesRemapper {
|
||||
}
|
||||
|
||||
public static void provideForgeSources(Project project, BiConsumer<String, byte[]> consumer) throws IOException {
|
||||
LoomGradleExtension extension = LoomGradleExtension.get(project);
|
||||
String sourceDependency = extension.getForgeUserdevProvider().getJson().getAsJsonPrimitive("sources").getAsString();
|
||||
List<Path> forgeInstallerSources = new ArrayList<>();
|
||||
|
||||
for (ResolvedArtifact artifact : project.getConfigurations().getByName(Constants.Configurations.FORGE_INSTALLER).getResolvedConfiguration().getResolvedArtifacts()) {
|
||||
Path forgeInstallerSource = ModConfigurationRemapper.findSources(project, artifact);
|
||||
|
||||
if (forgeInstallerSource != null) {
|
||||
forgeInstallerSources.add(forgeInstallerSource);
|
||||
}
|
||||
for (File file : DependencyDownloader.download(project, sourceDependency)) {
|
||||
forgeInstallerSources.add(file.toPath());
|
||||
}
|
||||
|
||||
project.getLogger().lifecycle(":found {} forge source jars", forgeInstallerSources.size());
|
||||
|
||||
@@ -68,6 +68,7 @@ import net.fabricmc.loom.api.mappings.layered.MappingsNamespace;
|
||||
import net.fabricmc.loom.configuration.accesswidener.TransitiveAccessWidenerMappingsProcessor;
|
||||
import net.fabricmc.loom.configuration.ifaceinject.InterfaceInjectionProcessor;
|
||||
import net.fabricmc.loom.configuration.processors.ModJavadocProcessor;
|
||||
import net.fabricmc.loom.configuration.sources.ForgeSourcesRemapper;
|
||||
import net.fabricmc.loom.decompilers.LineNumberRemapper;
|
||||
import net.fabricmc.loom.util.Constants;
|
||||
import net.fabricmc.loom.util.FileSystemUtil;
|
||||
@@ -147,6 +148,11 @@ public abstract class GenerateSourcesTask extends AbstractLoomTask {
|
||||
} finally {
|
||||
Files.deleteIfExists(ipcPath);
|
||||
}
|
||||
|
||||
// Inject Forge's own sources
|
||||
if (getExtension().isForge()) {
|
||||
ForgeSourcesRemapper.addForgeSources(getProject(), getOutputJar().get().getAsFile().toPath());
|
||||
}
|
||||
}
|
||||
|
||||
private void doWork(@Nullable IPCServer ipcServer) {
|
||||
|
||||
Reference in New Issue
Block a user