Fix crash when reading empty aw file, fix -SNAPSHOT versions plugin marker not being published

dev/0.11
modmuss50 2020-05-14 02:07:34 +01:00
parent bf8dad499d
commit a36d7a20d4
2 changed files with 32 additions and 1 deletions

View File

@ -113,6 +113,10 @@ gradlePlugin {
} }
} }
import org.w3c.dom.Document
import org.w3c.dom.Element
import org.w3c.dom.Node
publishing { publishing {
publications { publications {
plugin(MavenPublication) { publication -> plugin(MavenPublication) { publication ->
@ -137,6 +141,27 @@ publishing {
artifact sourcesJar artifact sourcesJar
artifact javadocJar 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 { repositories {
maven { maven {

View File

@ -47,7 +47,13 @@ public class AccessWidener {
private Set<String> classes = new LinkedHashSet<>(); private Set<String> classes = new LinkedHashSet<>();
public void read(BufferedReader reader) throws IOException { 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")) { if (header.length != 3 || !header[0].equals("accessWidener")) {
throw new UnsupportedOperationException("Invalid access access widener header"); throw new UnsupportedOperationException("Invalid access access widener header");