Fix or fail fast on null minecraft version. Add back the old check for mirgate mappings
parent
37af4c8152
commit
8da300563a
|
@ -36,6 +36,7 @@ import java.nio.file.Paths;
|
||||||
import java.nio.file.StandardCopyOption;
|
import java.nio.file.StandardCopyOption;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
import com.google.common.base.Preconditions;
|
||||||
import com.google.common.net.UrlEscapers;
|
import com.google.common.net.UrlEscapers;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.tools.ant.util.StringUtils;
|
import org.apache.tools.ant.util.StringUtils;
|
||||||
|
@ -314,13 +315,14 @@ public class MappingsProvider extends DependencyProvider {
|
||||||
|
|
||||||
public Path getIntermediaryTiny() throws IOException {
|
public Path getIntermediaryTiny() throws IOException {
|
||||||
if (intermediaryTiny == null) {
|
if (intermediaryTiny == null) {
|
||||||
intermediaryTiny = Paths.get(mappingsStepsDir.toString(), String.format("intermediary-%s%s.tiny", minecraftVersion, mappingsVersion));
|
minecraftVersion = getExtension().getMinecraftProvider().getMinecraftVersion();
|
||||||
|
Preconditions.checkNotNull(minecraftVersion, "Minecraft version cannot be null");
|
||||||
|
|
||||||
|
intermediaryTiny = Paths.get(mappingsStepsDir.toString(), String.format("intermediary-%s-v2.tiny", minecraftVersion));
|
||||||
|
|
||||||
if (!Files.exists(intermediaryTiny) || (isRefreshDeps() && !hasRefreshed)) {
|
if (!Files.exists(intermediaryTiny) || (isRefreshDeps() && !hasRefreshed)) {
|
||||||
hasRefreshed = true;
|
hasRefreshed = true;
|
||||||
|
|
||||||
minecraftVersion = getExtension().getMinecraftProvider().getMinecraftVersion();
|
|
||||||
|
|
||||||
// Download and extract intermediary
|
// Download and extract intermediary
|
||||||
String encodedMinecraftVersion = UrlEscapers.urlFragmentEscaper().escape(minecraftVersion);
|
String encodedMinecraftVersion = UrlEscapers.urlFragmentEscaper().escape(minecraftVersion);
|
||||||
String intermediaryArtifactUrl = getExtension().getIntermediaryUrl().apply(encodedMinecraftVersion);
|
String intermediaryArtifactUrl = getExtension().getIntermediaryUrl().apply(encodedMinecraftVersion);
|
||||||
|
|
|
@ -118,7 +118,7 @@ public class MigrateMappingsTask extends AbstractLoomTask {
|
||||||
Set<File> files;
|
Set<File> files;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (mappings.startsWith(MojangMappingsDependency.GROUP + ':' + MojangMappingsDependency.MODULE + ':')) {
|
if (mappings.startsWith(MojangMappingsDependency.GROUP + ':' + MojangMappingsDependency.MODULE + ':') || mappings.startsWith("net.mojang.minecraft:mappings:")) {
|
||||||
if (!mappings.endsWith(":" + project.getExtensions().getByType(LoomGradleExtension.class).getMinecraftProvider().getMinecraftVersion())) {
|
if (!mappings.endsWith(":" + project.getExtensions().getByType(LoomGradleExtension.class).getMinecraftProvider().getMinecraftVersion())) {
|
||||||
throw new UnsupportedOperationException("Migrating Mojang mappings is currently only supported for the specified minecraft version");
|
throw new UnsupportedOperationException("Migrating Mojang mappings is currently only supported for the specified minecraft version");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue