Skip to content

Commit b572f74

Browse files
committed
Add --mappings-data artifact to output just the mappings.csv zip file.
1 parent 31bda40 commit b572f74

File tree

5 files changed

+16
-10
lines changed

5 files changed

+16
-10
lines changed

src/main/java/net/minecraftforge/mcmaven/cli/MavenTask.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ static void run(String[] args) throws Exception {
7272

7373
var parchmentO = parser.accepts("parchment",
7474
"Version of parchment mappings to use, snapshots are not supported")
75+
.availableUnless(mappingsO)
7576
.withRequiredArg();
7677

7778
var shorthandOptions = new HashMap<String, OptionSpecBuilder>();
@@ -80,7 +81,8 @@ static void run(String[] args) throws Exception {
8081
"fml", Constants.FMLONLY_ARTIFACT,
8182
"mc", "net.minecraft:joined",
8283
"client", "net.minecraft:client",
83-
"server", "net.minecraft:server"
84+
"server", "net.minecraft:server",
85+
"mapping-data", "net.minecraft:mappings"
8486
);
8587
for (var entry : artifacts.entrySet()) {
8688
var key = entry.getKey();

src/main/java/net/minecraftforge/mcmaven/impl/mappings/Mappings.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
import java.util.HashMap;
1010
import java.util.List;
1111
import java.util.Map;
12-
import java.util.Set;
13-
1412
import net.minecraftforge.mcmaven.impl.GlobalOptions;
1513
import net.minecraftforge.mcmaven.impl.repo.mcpconfig.MCPSide;
1614
import net.minecraftforge.mcmaven.impl.util.Artifact;

src/main/java/net/minecraftforge/mcmaven/impl/mappings/ParchmentMappings.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import java.util.Set;
1717
import java.util.TreeMap;
1818
import java.util.function.Function;
19-
import java.util.zip.Deflater;
2019
import java.util.zip.ZipFile;
2120
import java.util.zip.ZipOutputStream;
2221

@@ -33,7 +32,6 @@
3332
import net.minecraftforge.srgutils.IMappingFile;
3433
import net.minecraftforge.util.file.FileUtils;
3534
import net.minecraftforge.util.hash.HashStore;
36-
import org.jetbrains.annotations.Nullable;
3735

3836
public class ParchmentMappings extends Mappings {
3937
private Task downloadTask;
@@ -149,7 +147,7 @@ record Type(String file, Function<SideData, Map<String, Info>> data) {}
149147
FileUtils.ensureParent(output);
150148
try (var fos = new FileOutputStream(output);
151149
var out = new ZipOutputStream(fos)) {
152-
out.setLevel(Deflater.NO_COMPRESSION); // Don't compress in case the system has custom zlib library, which will case hash differences
150+
//out.setLevel(Deflater.NO_COMPRESSION); // Don't compress in case the system has custom zlib library, which will case hash differences
153151

154152
var uncloseable = new OutputStreamWriter(out, StandardCharsets.UTF_8) {
155153
public void close() throws IOException {

src/main/java/net/minecraftforge/mcmaven/impl/repo/mcpconfig/MCPConfigRepo.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import java.util.HashMap;
3131
import java.util.List;
3232
import java.util.Map;
33-
import java.util.Set;
3433

3534
/*
3635
* Provides the following artifacts:
@@ -93,10 +92,21 @@ public List<PendingArtifact> process(Artifact artifact, Mappings mappings) {
9392
throw new IllegalArgumentException("MCPConfigRepo cannot process modules that aren't for group net.minecraft");
9493

9594
var side = module.substring("net.minecraft:".length());
95+
boolean isMappings = "mappings".equals(side);
96+
if (isMappings)
97+
side = "joined";
98+
9699
var mcp = this.get(Artifact.from("de.oceanlabs.mcp", "mcp_config", version, null, "zip"));
97100
var mcpSide = mcp.getSide(side);
98-
var mcpTasks = mcpSide.getTasks();
99101

102+
if (isMappings) {
103+
var name = mappings.getArtifact(mcpSide);
104+
return List.of(
105+
pending("Mappings", mappings.getCsvZip(mcpSide), name)
106+
);
107+
}
108+
109+
var mcpTasks = mcpSide.getTasks();
100110
var build = mcpSide.getBuildFolder();
101111
var name = Artifact.from("net.minecraft", side, version);
102112

src/main/java/net/minecraftforge/mcmaven/impl/tasks/RenameTask.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
import java.io.FileOutputStream;
2121
import java.io.IOException;
2222
import java.nio.charset.StandardCharsets;
23-
import java.util.Set;
24-
import java.util.function.Supplier;
2523
import java.util.zip.ZipInputStream;
2624
import java.util.zip.ZipOutputStream;
2725

0 commit comments

Comments
 (0)