mirror of https://github.com/sbt/sbt.git
Merge pull request #6493 from adpi2/fix-6492
Add util-interface to SbtInterfaceLoader
This commit is contained in:
commit
20395d107c
|
|
@ -67,15 +67,21 @@ public final class MetaBuildLoader extends URLClassLoader {
|
|||
final String jlineJars = "jline-?[0-9.]+-sbt-.*|jline-terminal(-(jna|jansi))?-[0-9.]+";
|
||||
final String testInterfaceJars = "test-interface(-.*)?";
|
||||
final String compilerInterfaceJars = "compiler-interface(-.*)?";
|
||||
final String utilInterfaceJars = "util-interface(-.*)?";
|
||||
final String jansiJars = "jansi-[0-9.]+";
|
||||
final String jnaJars = "jna-(platform-)?[0-9.]+";
|
||||
final String fullPattern =
|
||||
String.format(
|
||||
"^(%s|%s|%s|%s|%s)\\.jar",
|
||||
jlineJars, testInterfaceJars, compilerInterfaceJars, jansiJars, jnaJars);
|
||||
"^(%s|%s|%s|%s|%s|%s)\\.jar",
|
||||
jlineJars,
|
||||
testInterfaceJars,
|
||||
compilerInterfaceJars,
|
||||
utilInterfaceJars,
|
||||
jansiJars,
|
||||
jnaJars);
|
||||
final Pattern pattern = Pattern.compile(fullPattern);
|
||||
final File[] cp = appProvider.mainClasspath();
|
||||
final URL[] interfaceURLs = new URL[2];
|
||||
final URL[] interfaceURLs = new URL[3];
|
||||
final URL[] jlineURLs = new URL[7];
|
||||
final File[] extra =
|
||||
appProvider.id().classpathExtra() == null ? new File[0] : appProvider.id().classpathExtra();
|
||||
|
|
@ -86,7 +92,9 @@ public final class MetaBuildLoader extends URLClassLoader {
|
|||
int jlineIndex = 0;
|
||||
for (final File file : cp) {
|
||||
final String name = file.getName();
|
||||
if ((name.contains("test-interface") || name.contains("compiler-interface"))
|
||||
if ((name.contains("test-interface")
|
||||
|| name.contains("compiler-interface")
|
||||
|| name.contains("util-interface"))
|
||||
&& pattern.matcher(name).find()) {
|
||||
interfaceURLs[interfaceIndex] = file.toURI().toURL();
|
||||
interfaceIndex += 1;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,13 @@ class SbtInterfaceLoader extends URLClassLoader {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SbtInterfaceClassLoader(" + getURLs()[0] + ")";
|
||||
final StringBuilder builder = new StringBuilder();
|
||||
URL[] urls = getURLs();
|
||||
for (int i = 0; i < urls.length; ++i) {
|
||||
builder.append(urls[i].toString());
|
||||
if (i < urls.length - 2) builder.append(", ");
|
||||
}
|
||||
return "SbtInterfaceClassLoader(" + builder + ")";
|
||||
}
|
||||
|
||||
static {
|
||||
|
|
|
|||
Loading…
Reference in New Issue