Skip to content

Commit 3d43d3d

Browse files
committed
write pom files for non-primary mappings if they don't already exist.
1 parent d036cf9 commit 3d43d3d

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

src/main/java/net/minecraftforge/mcmaven/impl/MinecraftMaven.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,15 @@ private void finalize(Artifact module, Mappings mappings, List<Repo.PendingArtif
138138
var cache = HashStore.fromFile(target)
139139
.add("source", source);
140140

141-
if (!target.exists() || !cache.isSame()) {
141+
boolean write;
142+
if ("pom".equals(pending.getArtifact().getExtension())) {
143+
// Write the pom for non-primary mappings if we haven't generated primary mappings yet
144+
write = !target.exists() || (mappings.isPrimary() && !cache.isSame());
145+
} else {
146+
write = !target.exists() || !cache.isSame();
147+
}
148+
149+
if (write) {
142150
// TODO: [MCMavenizer] Add --api argument to turn class artifacts to api-only targets for a public repo
143151
try {
144152
org.apache.commons.io.FileUtils.copyFile(source, target);

src/main/java/net/minecraftforge/mcmaven/impl/repo/forge/ForgeRepo.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
import java.util.ArrayList;
3737
import java.util.Arrays;
3838
import java.util.List;
39-
import java.util.Set;
4039
import java.util.stream.Stream;
4140

4241
// TODO: [MCMavenizer][ForgeRepo] For now, the ForgeRepo needs to be fully complete with everything it has to do.
@@ -148,9 +147,7 @@ private List<PendingArtifact> processV3(String version, Mappings mappings) {
148147
var classes = pending("Classes", classesTask, name, () -> classVariants(mappings, patcher, extraCoords, mappingCoords));
149148
var metadata = pending("Metadata", metadata(build, patcher), name.withClassifier("metadata").withExtension("zip"));
150149

151-
PendingArtifact pom = null;
152-
if (mappings.isPrimary())
153-
pom = pending("Maven POM", pom(build, patcher, version, extraCoords, mappingCoords), name.withExtension("pom"));
150+
var pom = pending("Maven POM", pom(build, patcher, version, extraCoords, mappingCoords), name.withExtension("pom"));
154151

155152
var extraOutput = this.mcpconfig.processExtra(Constants.MC_GROUP + ':' + Constants.MC_CLIENT, patcher.getMCP().getName().getVersion());
156153
return Stream.concat(

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,12 @@ public List<PendingArtifact> process(Artifact artifact, Mappings mappings) {
123123
var sources = pending("Sources", sourcesTask, name.withClassifier("sources"), sourceVariant(mappings));
124124
var classes = pending("Classes", classesTask, name, () -> classVariants(mappings, mcpSide));
125125
var metadata = pending("Metadata", metadata(build, mcpSide), name.withClassifier("metadata").withExtension("zip"));
126+
var pom = pending("Maven POM", pom(build, side, mcpSide, version), name.withExtension("pom"));
127+
126128
pending.addAll(List.of(
127-
sources, classes, metadata
129+
sources, classes, metadata, pom
128130
));
129131

130-
if (mappings.isPrimary()) {
131-
var pom = pending("Maven POM", pom(build, side, mcpSide, version), name.withExtension("pom"));
132-
pending.add(pom);
133-
}
134-
135132
yield pending;
136133
}
137134
};

0 commit comments

Comments
 (0)