mirror of
https://github.com/corda/corda.git
synced 2025-05-28 21:24:24 +00:00
Caplet now filters for JAR files.
This commit is contained in:
parent
bdcbd80d4e
commit
a8d73fb73f
@ -2,6 +2,8 @@
|
|||||||
// must also be in the default package. When using Kotlin there are a whole host of exceptions
|
// must also be in the default package. When using Kotlin there are a whole host of exceptions
|
||||||
// trying to construct this from Capsule, so it is written in Java.
|
// trying to construct this from Capsule, so it is written in Java.
|
||||||
|
|
||||||
|
import org.apache.commons.io.FilenameUtils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -13,6 +15,9 @@ public class CordaCaplet extends Capsule {
|
|||||||
super(pred);
|
super(pred);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overriding the Caplet classpath generation via the intended interface in Capsule.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
protected <T> T attribute(Map.Entry<String, T> attr) {
|
protected <T> T attribute(Map.Entry<String, T> attr) {
|
||||||
@ -24,9 +29,8 @@ public class CordaCaplet extends Capsule {
|
|||||||
return super.attribute(attr);
|
return super.attribute(attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: If/when capsule fix the globbing issue (See: https://github.com/puniverse/capsule/issues/109)
|
// TODO: Make directory configurable via the capsule manifest.
|
||||||
// then replace this with a simple glob
|
// TODO: Add working directory variable to capsules string replacement variables.
|
||||||
// TODO: Make directory configurable
|
|
||||||
private List<Path> augmentClasspath(List<Path> classpath) {
|
private List<Path> augmentClasspath(List<Path> classpath) {
|
||||||
File dir = new File("plugins");
|
File dir = new File("plugins");
|
||||||
if(!dir.exists()) {
|
if(!dir.exists()) {
|
||||||
@ -35,7 +39,8 @@ public class CordaCaplet extends Capsule {
|
|||||||
|
|
||||||
File[] files = dir.listFiles();
|
File[] files = dir.listFiles();
|
||||||
for (File file : files) {
|
for (File file : files) {
|
||||||
if (file.isFile()) {
|
Boolean isJAR = FilenameUtils.getExtension(file.getName()).toLowerCase() == "jar";
|
||||||
|
if (file.isFile() && isJAR) {
|
||||||
classpath.add(file.toPath().toAbsolutePath());
|
classpath.add(file.toPath().toAbsolutePath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user