Minor refactoring to the DependencyGrabber.
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index edc3eac..036a6b2 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -10,6 +10,8 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* `javatuples.Pair` avoided on `MapReduce` API in favor of a new `KeyValue` class.
+* Renamed `Gremlin-Plugin` manifest entry for plugins to `Gremlin-Plugin-Paths`.
+* Added `Gremlin-Plugin-Dependencies` manifest entry to list other dependencies that should be retrieved with a plugin jar.
* `Memory.Admin.asImmutable()` yields an immutable representation of the GraphComputer `Memory`.
* Fixed host selection in `gremlin-driver` by properly accounting for all hosts being marked unavailable at the instantiation of a `Client`.
* Removed Giraph-Gremlin in favor of new Hadoop-Gremlin with `GiraphGraphComputer` support. Future support for `MapReduceGraphComputer`.
diff --git a/gremlin-groovy/src/main/groovy/com/tinkerpop/gremlin/groovy/util/DependencyGrabber.groovy b/gremlin-groovy/src/main/groovy/com/tinkerpop/gremlin/groovy/util/DependencyGrabber.groovy
index dd36ab2..9c5ead2 100644
--- a/gremlin-groovy/src/main/groovy/com/tinkerpop/gremlin/groovy/util/DependencyGrabber.groovy
+++ b/gremlin-groovy/src/main/groovy/com/tinkerpop/gremlin/groovy/util/DependencyGrabber.groovy
@@ -38,7 +38,6 @@
new File(extClassPath + fileSep + "plugin-info.txt").withWriter { out -> out << [artifact.group, artifact.artifact, artifact.version].join(":") }
- final def dependencyLocations = Grape.resolve([classLoader: this.classLoaderToUse], null, dep)
def fs = FileSystems.default
def target = fs.getPath(extClassPath)
@@ -54,21 +53,28 @@
"structure can lead to unexpected behavior.");
}
+ final def dependencyLocations = [] as Set<URI>
+ dependencyLocations.addAll(Grape.resolve([classLoader: this.classLoaderToUse], null, dep))
dependencyLocations.collect{fs.getPath(it.path)}
.findAll{!(it.fileName.toFile().name ==~ /(slf4j|logback\-classic)-.*\.jar/)}
.findAll{!filesAlreadyInPath.collect{it.getFileName().toString()}.contains(it.fileName.toFile().name)}
.each { Files.copy(it, target.resolve(it.fileName), StandardCopyOption.REPLACE_EXISTING) }
- getAdditionalsDependencies(target, artifact)
+ getAdditionalDependencies(target, artifact).collect{fs.getPath(it.path)}
+ .findAll{!(it.fileName.toFile().name ==~ /(slf4j|logback\-classic)-.*\.jar/)}
+ .findAll{!filesAlreadyInPath.collect{it.getFileName().toString()}.contains(it.fileName.toFile().name)}
+ .each { Files.copy(it, target.resolve(it.fileName), StandardCopyOption.REPLACE_EXISTING) }
+
alterPaths(target, artifact)
}
- private getAdditionalsDependencies(final Path extPath, final Artifact artifact) {
+ private Set<URI> getAdditionalDependencies(final Path extPath, final Artifact artifact) {
try {
def pathToInstalled = extPath.resolve(artifact.artifact + "-" + artifact.version + ".jar")
- final JarFile jar = new JarFile(pathToInstalled.toFile());
+ final JarFile jar = new JarFile(pathToInstalled.toFile())
final Manifest manifest = jar.getManifest()
def attrLine = manifest.mainAttributes.getValue("Gremlin-Plugin-Dependencies")
+ def additionalDependencies = [] as Set<URI>
if (attrLine != null) {
def splitLine = attrLine.split(";")
splitLine.each {
@@ -76,29 +82,11 @@
def additional = new Artifact(artifactBits[0], artifactBits[1], artifactBits[2])
final def additionalDep = makeDepsMap(additional)
- final def dependencyLocations = Grape.resolve([classLoader: this.classLoaderToUse], null, additionalDep)
-
- def fs = FileSystems.default
- def target = extPath
-
- def filesAlreadyInPath = []
- def libClassPath
- try {
- libClassPath = fs.getPath(System.getProperty("user.dir") + fileSep + "lib")
- getFileNames(filesAlreadyInPath, libClassPath)
- } catch (Exception ignored) {
- println("Detected a non-standard Gremlin directory structure during install. Expecting a 'lib' " +
- "directory sibling to 'ext'. This message does not necessarily imply failure, however " +
- "the console requires a certain directory structure for proper execution. Altering that " +
- "structure can lead to unexpected behavior.");
- }
-
- dependencyLocations.collect{fs.getPath(it.path)}
- .findAll{!(it.fileName.toFile().name ==~ /(slf4j|logback\-classic)-.*\.jar/)}
- .findAll{!filesAlreadyInPath.collect{it.getFileName().toString()}.contains(it.fileName.toFile().name)}
- .each { Files.copy(it, target.resolve(it.fileName), StandardCopyOption.REPLACE_EXISTING) }
+ additionalDependencies.addAll(Grape.resolve([classLoader: this.classLoaderToUse], null, additionalDep))
}
}
+
+ return additionalDependencies
} catch (Exception ex) {
throw new RuntimeException(ex)
}