diff --git a/build.gradle b/build.gradle index db31133..a3823b0 100644 --- a/build.gradle +++ b/build.gradle @@ -113,6 +113,10 @@ gradlePlugin { } } +import org.w3c.dom.Document +import org.w3c.dom.Element +import org.w3c.dom.Node + publishing { publications { plugin(MavenPublication) { publication -> @@ -137,6 +141,27 @@ publishing { artifact sourcesJar artifact javadocJar } + + //Manually crate the plugin marker for snapshot versions + snapshotPlugin(MavenPublication) { publication -> + groupId "fabric-loom" + artifactId "fabric-loom.gradle.plugin" + version baseVersion + "-SNAPSHOT" + + pom.withXml({ + //Based of org.gradle.plugin.devel.plugins.MavenPluginPublishPlugin + Element root = asElement() + Document document = root.getOwnerDocument() + Node dependencies = root.appendChild(document.createElement("dependencies")) + Node dependency = dependencies.appendChild(document.createElement("dependency")) + Node groupId = dependency.appendChild(document.createElement("groupId")) + groupId.setTextContent("net.fabricmc") + Node artifactId = dependency.appendChild(document.createElement("artifactId")) + artifactId.setTextContent("fabric-loom") + Node version = dependency.appendChild(document.createElement("version")) + version.setTextContent(baseVersion + "-SNAPSHOT") + }) + } } repositories { maven { diff --git a/src/main/java/net/fabricmc/loom/util/accesswidener/AccessWidener.java b/src/main/java/net/fabricmc/loom/util/accesswidener/AccessWidener.java index 0989a54..ac9ed50 100644 --- a/src/main/java/net/fabricmc/loom/util/accesswidener/AccessWidener.java +++ b/src/main/java/net/fabricmc/loom/util/accesswidener/AccessWidener.java @@ -47,7 +47,13 @@ public class AccessWidener { private Set classes = new LinkedHashSet<>(); public void read(BufferedReader reader) throws IOException { - String[] header = reader.readLine().split("\\s+"); + String headerStr = reader.readLine(); + + if (headerStr == null) { + throw new RuntimeException("Cannot read empty or invalid access widener"); + } + + String[] header = headerStr.split("\\s+"); if (header.length != 3 || !header[0].equals("accessWidener")) { throw new UnsupportedOperationException("Invalid access access widener header");