From 658ca0c7094ddba1c6c61510aec1425642e8bd92 Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Wed, 20 Mar 2024 23:03:25 +0000 Subject: [PATCH 1/5] Replace hard link with move. Fixes https://github.com/orgs/FabricMC/discussions/3659 --- .../java/net/fabricmc/loom/util/download/Download.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/fabricmc/loom/util/download/Download.java b/src/main/java/net/fabricmc/loom/util/download/Download.java index bdd9b04b..df903148 100644 --- a/src/main/java/net/fabricmc/loom/util/download/Download.java +++ b/src/main/java/net/fabricmc/loom/util/download/Download.java @@ -279,10 +279,9 @@ public final class Download { } try { - // Once the file has been fully read, create a hard link to the destination file. - // And then remove the temporary file, this ensures that the output file only exists in fully populated state. - Files.createLink(output, partFile); - Files.delete(partFile); + // Once the file has been fully read, move it to the destination file. + // This ensures that the output file only exists in fully populated state. + Files.move(partFile, output); } catch (IOException e) { throw error(e, "Failed to complete download"); } From 4b5f62e6b174fecf54b21f04bb633e9df0498a77 Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Thu, 21 Mar 2024 19:24:42 +0000 Subject: [PATCH 2/5] Fix custom decompiler test --- .../integration/buildSrc/decompile/CustomDecompiler.groovy | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/test/groovy/net/fabricmc/loom/test/integration/buildSrc/decompile/CustomDecompiler.groovy b/src/test/groovy/net/fabricmc/loom/test/integration/buildSrc/decompile/CustomDecompiler.groovy index 31609a91..8bcc1615 100644 --- a/src/test/groovy/net/fabricmc/loom/test/integration/buildSrc/decompile/CustomDecompiler.groovy +++ b/src/test/groovy/net/fabricmc/loom/test/integration/buildSrc/decompile/CustomDecompiler.groovy @@ -26,15 +26,14 @@ package net.fabricmc.loom.test.integration.buildSrc.decompile import java.nio.file.Path -import com.google.common.io.Files - import net.fabricmc.loom.api.decompilers.DecompilationMetadata import net.fabricmc.loom.api.decompilers.LoomDecompiler +import net.fabricmc.loom.util.ZipUtils class CustomDecompiler implements LoomDecompiler { @Override void decompile(Path compiledJar, Path sourcesDestination, Path linemapDestination, DecompilationMetadata metaData) { println("Running custom decompiler") - Files.touch(sourcesDestination.toFile()) + ZipUtils.add(sourcesDestination, "/META-INF/test.txt", "test") } } From ba8124e2d6d3684dd2f183b5bcf10c55596c981a Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Mon, 1 Apr 2024 15:00:03 +0100 Subject: [PATCH 3/5] Set artifact urls for the Mojang maven repo in the correct place. --- src/main/java/net/fabricmc/loom/LoomRepositoryPlugin.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/fabricmc/loom/LoomRepositoryPlugin.java b/src/main/java/net/fabricmc/loom/LoomRepositoryPlugin.java index ef9bd58e..896c72df 100644 --- a/src/main/java/net/fabricmc/loom/LoomRepositoryPlugin.java +++ b/src/main/java/net/fabricmc/loom/LoomRepositoryPlugin.java @@ -78,6 +78,10 @@ public class LoomRepositoryPlugin implements Plugin { sources.artifact(); sources.ignoreGradleMetadataRedirection(); }); + + // Fallback to maven central for artifacts such as sources or javadocs that are not mirrored on Mojang's repo. + // See: https://github.com/FabricMC/fabric-loom/issues/1032 + repo.artifactUrls(ArtifactRepositoryContainer.MAVEN_CENTRAL_URL); }); // If a mavenCentral repo is already defined, remove the mojang repo and add it back before the mavenCentral repo so that it will be checked first. @@ -117,10 +121,6 @@ public class LoomRepositoryPlugin implements Plugin { sources.artifact(); sources.ignoreGradleMetadataRedirection(); }); - - // Fallback to maven central for artifacts such as sources or javadocs that are not mirrored on Mojang's repo. - // See: https://github.com/FabricMC/fabric-loom/issues/1032 - repo.artifactUrls(ArtifactRepositoryContainer.MAVEN_CENTRAL_URL); }); } From e96c0e2fbdf4e45d12e7063617ac7fe26ae5832a Mon Sep 17 00:00:00 2001 From: modmuss Date: Mon, 1 Apr 2024 21:13:50 +0100 Subject: [PATCH 4/5] Fix remapped sources publishing (#1084) --- .../net/fabricmc/loom/task/RemapTaskConfiguration.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/fabricmc/loom/task/RemapTaskConfiguration.java b/src/main/java/net/fabricmc/loom/task/RemapTaskConfiguration.java index d138779c..f38fed6d 100644 --- a/src/main/java/net/fabricmc/loom/task/RemapTaskConfiguration.java +++ b/src/main/java/net/fabricmc/loom/task/RemapTaskConfiguration.java @@ -163,11 +163,14 @@ public abstract class RemapTaskConfiguration implements Runnable { } if (getConfigurations().getNames().contains(JavaPlugin.SOURCES_ELEMENTS_CONFIGURATION_NAME)) { - getArtifacts().add(JavaPlugin.SOURCES_ELEMENTS_CONFIGURATION_NAME, remapSourcesTask); - // Remove the dev sources artifact Configuration configuration = getConfigurations().getByName(JavaPlugin.SOURCES_ELEMENTS_CONFIGURATION_NAME); - configuration.getArtifacts().removeIf(a -> a.getFile().equals(sourcesJarTask.getArchiveFile().get().getAsFile())); + configuration.getArtifacts().removeIf(a -> "sources".equals(a.getClassifier())); + + // Add the remapped sources artifact + getArtifacts().add(JavaPlugin.SOURCES_ELEMENTS_CONFIGURATION_NAME, remapSourcesTask.map(AbstractArchiveTask::getArchiveFile), artifact -> { + artifact.setClassifier("sources"); + }); } else { // Sources jar may not have been created with withSourcesJar getProject().getLogger().warn("Not publishing sources jar as it was not found. Use java.withSourcesJar() to fix."); From 7a89e40fd0756bcd97057a349f2968d6c907dec3 Mon Sep 17 00:00:00 2001 From: modmuss Date: Thu, 4 Apr 2024 11:45:14 +0100 Subject: [PATCH 5/5] Update Loom native (#1085) --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a4b1d3bc..b1923d2d 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -12,7 +12,7 @@ mapping-io = "0.5.1" lorenz-tiny = "4.0.2" mercury = "0.4.1" kotlinx-metadata = "0.9.0" -loom-native = "0.1.0" +loom-native = "0.1.1" # Plugins spotless = "6.25.0"