Maven Repo (first version)
This commit is contained in:
parent
a195f248b1
commit
e9133fc5ba
|
@ -14,7 +14,6 @@ repositories {
|
|||
|
||||
dependencies {
|
||||
compile 'com.google.code.gson:gson:+'
|
||||
compile 'org.apache.maven:maven-core:+'
|
||||
compile 'org.python:jython-standalone:2.7.0'
|
||||
compile "com.github.TheRandomLabs:CurseAPI:master-SNAPSHOT"
|
||||
testCompile group: 'junit', name: 'junit', version: '4.12'
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
package ley.anvil.addonscript.maven;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class ArtifactDestination {
|
||||
|
||||
public String group;
|
||||
public String id;
|
||||
public String version;
|
||||
public String[] others;
|
||||
|
||||
public ArtifactDestination(String dest) {
|
||||
List<String> parts = Arrays.asList(dest.split(":"));
|
||||
if (parts.size() >= 3) {
|
||||
group = parts.get(0);
|
||||
id = parts.get(1);
|
||||
version = parts.get(2);
|
||||
others = parts.subList(3, parts.size()).toArray(new String[0]);
|
||||
} else {
|
||||
throw new RuntimeException("Invalid artifact: " + dest);
|
||||
}
|
||||
}
|
||||
|
||||
public String getPOMPath() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String s : group.split("\\.")) {
|
||||
sb.append(s).append("/");
|
||||
}
|
||||
sb.append(id).append("/").append(version).append("/");
|
||||
sb.append(id).append("-").append(version);
|
||||
sb.append(".pom");
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public String getPath(String filetype) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String s : group.split("\\.")) {
|
||||
sb.append(s).append("/");
|
||||
}
|
||||
sb.append(id).append("/").append(version).append("/");
|
||||
sb.append(id).append("-").append(version);
|
||||
for (String s : others) {
|
||||
sb.append("-").append(s);
|
||||
}
|
||||
sb.append(".").append(filetype);
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package ley.anvil.addonscript.maven;
|
||||
|
||||
import ley.anvil.addonscript.util.IRepository;
|
||||
import ley.anvil.addonscript.v1.AddonscriptJSON;
|
||||
|
||||
public class MavenRepository implements IRepository {
|
||||
|
||||
String url;
|
||||
|
||||
public MavenRepository(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFileURL(String artifact) {
|
||||
ArtifactDestination dest = new ArtifactDestination(artifact);
|
||||
return dest.getPath(".jar");
|
||||
}
|
||||
|
||||
@Override
|
||||
public AddonscriptJSON.Meta getMeta(String artifact) {
|
||||
return new AddonscriptJSON.Meta();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue