resolve mcvaadin and vaadin libraries
(no problems found)
This commit is contained in:
+34
-8
@@ -91,12 +91,18 @@ public class ResolveDescriptorsFromExternalLibraries {
|
|||||||
|
|
||||||
hasErrors |= testLibrary("com.google.guava", "guava", "12.0-rc2");
|
hasErrors |= testLibrary("com.google.guava", "guava", "12.0-rc2");
|
||||||
hasErrors |= testLibrary("org.springframework", "spring-core", "3.1.1.RELEASE");
|
hasErrors |= testLibrary("org.springframework", "spring-core", "3.1.1.RELEASE");
|
||||||
|
hasErrors |= testLibrary("com.vaadin", "vaadin", "6.6.8");
|
||||||
|
hasErrors |= testLibraryFromUrl("http://mcvaadin.googlecode.com/files/mcvaadin.jar");
|
||||||
return hasErrors;
|
return hasErrors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean testLibraryFromUrl(@NotNull String urlJar) throws Exception {
|
||||||
|
return testLibraryFile(getLibraryFromUrl(urlJar), urlJar);
|
||||||
|
}
|
||||||
|
|
||||||
private boolean testLibrary(@NotNull String org, @NotNull String module, @NotNull String rev) throws Exception {
|
private boolean testLibrary(@NotNull String org, @NotNull String module, @NotNull String rev) throws Exception {
|
||||||
LibFromMaven lib = new LibFromMaven(org, module, rev);
|
LibFromMaven lib = new LibFromMaven(org, module, rev);
|
||||||
File jar = getLibrary(lib);
|
File jar = getLibraryFromMaven(lib);
|
||||||
|
|
||||||
return testLibraryFile(jar, lib.toString());
|
return testLibraryFile(jar, lib.toString());
|
||||||
}
|
}
|
||||||
@@ -185,22 +191,40 @@ public class ResolveDescriptorsFromExternalLibraries {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private File getLibrary(@NotNull LibFromMaven lib) throws Exception {
|
private File getLibraryFromUrl(@NotNull String url) throws Exception {
|
||||||
File userHome = new File(System.getProperty("user.home"));
|
|
||||||
String fileName = lib.getModule() + "-" + lib.getRev() + ".jar";
|
|
||||||
|
|
||||||
File dir = new File(userHome, ".kotlin-project/resolve-libraries/" + lib.getOrg() + "/" + lib.getModule());
|
String fileName = url
|
||||||
|
.replaceAll("^http://", "")
|
||||||
|
.replaceAll("/", "_")
|
||||||
|
;
|
||||||
|
File dir = new File(userHome(), ".kotlin-project/resolve-libraries");
|
||||||
|
|
||||||
File file = new File(dir, fileName);
|
File file = new File(dir, fileName);
|
||||||
|
|
||||||
|
return getFileFromUrl(url, file, url);
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private File getLibraryFromMaven(@NotNull LibFromMaven lib) throws Exception {
|
||||||
|
String fileName = lib.getModule() + "-" + lib.getRev() + ".jar";
|
||||||
|
|
||||||
|
File dir = new File(userHome(), ".kotlin-project/resolve-libraries/" + lib.getOrg() + "/" + lib.getModule());
|
||||||
|
|
||||||
|
File file = new File(dir, fileName);
|
||||||
|
String uri = url(lib);
|
||||||
|
|
||||||
|
return getFileFromUrl(lib.toString(), file, uri);
|
||||||
|
}
|
||||||
|
|
||||||
|
private File getFileFromUrl(@NotNull String lib, @NotNull File file, @NotNull String uri) throws IOException {
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
JetTestUtils.mkdirs(dir);
|
JetTestUtils.mkdirs(file.getParentFile());
|
||||||
|
|
||||||
File tmp = new File(dir, fileName + "~");
|
File tmp = new File(file.getPath() + "~");
|
||||||
|
|
||||||
String uri = url(lib);
|
|
||||||
GetMethod method = new GetMethod(uri);
|
GetMethod method = new GetMethod(uri);
|
||||||
|
|
||||||
FileOutputStream os = null;
|
FileOutputStream os = null;
|
||||||
@@ -252,6 +276,8 @@ public class ResolveDescriptorsFromExternalLibraries {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static File userHome() {return new File(System.getProperty("user.home"));}
|
||||||
|
|
||||||
private static String url(LibFromMaven lib) {
|
private static String url(LibFromMaven lib) {
|
||||||
return "http://repo1.maven.org/maven2/" + lib.getOrg().replace(".", "/") + "/" + lib.getModule() + "/" + lib.getRev()
|
return "http://repo1.maven.org/maven2/" + lib.getOrg().replace(".", "/") + "/" + lib.getModule() + "/" + lib.getRev()
|
||||||
+ "/" + lib.getModule() + "-" + lib.getRev() + ".jar";
|
+ "/" + lib.getModule() + "-" + lib.getRev() + ".jar";
|
||||||
|
|||||||
Reference in New Issue
Block a user