TINKERPOP-1493 Groovy project doesn't build on Windows

Removed support for user.dir property as it was being prepended to a
fully qualified path and the second drive letter was making the path
illegal.

Made sure JarFile instances were being closed so that Groovy could
delete the directory without encountering file locked errors.

Exclude Unix scripts from RAT plugin

Tinkergraph integration tests fail but can build when skipping
integration tests. Hadoop fails either way. Could be environmental on my
end.


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/63eff183
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/63eff183
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/63eff183

Branch: refs/heads/master
Commit: 63eff183683f881e3d3b022dc32839aecc65a0a4
Parents: 4745fe1
Author: PaulJackson123 <pauljackson...@verizon.net>
Authored: Wed Oct 12 22:41:17 2016 -0400
Committer: PaulJackson123 <pauljackson...@verizon.net>
Committed: Sun Nov 27 07:19:14 2016 -0500

----------------------------------------------------------------------
 .../groovy/util/DependencyGrabber.groovy        | 55 +++++++++++---------
 .../util/DependencyGrabberIntegrateTest.java    |  2 +-
 pom.xml                                         |  2 +
 3 files changed, 34 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/63eff183/gremlin-groovy/src/main/groovy/org/apache/tinkerpop/gremlin/groovy/util/DependencyGrabber.groovy
----------------------------------------------------------------------
diff --git 
a/gremlin-groovy/src/main/groovy/org/apache/tinkerpop/gremlin/groovy/util/DependencyGrabber.groovy
 
b/gremlin-groovy/src/main/groovy/org/apache/tinkerpop/gremlin/groovy/util/DependencyGrabber.groovy
index 6b5242d..e7ab55b 100644
--- 
a/gremlin-groovy/src/main/groovy/org/apache/tinkerpop/gremlin/groovy/util/DependencyGrabber.groovy
+++ 
b/gremlin-groovy/src/main/groovy/org/apache/tinkerpop/gremlin/groovy/util/DependencyGrabber.groovy
@@ -173,21 +173,24 @@ class DependencyGrabber {
         try {
             def pathToInstalled = extPath.resolve(artifact.artifact + "-" + 
artifact.version + ".jar")
             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 {
-                    def artifactBits = it.split(":")
-                    def additional = new Artifact(artifactBits[0], 
artifactBits[1], artifactBits[2])
-
-                    final def additionalDep = makeDepsMap(additional)
-                    additionalDependencies.addAll(Grape.resolve([classLoader: 
this.classLoaderToUse], null, additionalDep))
+            try {
+                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 {
+                        def artifactBits = it.split(":")
+                        def additional = new Artifact(artifactBits[0], 
artifactBits[1], artifactBits[2])
+
+                        final def additionalDep = makeDepsMap(additional)
+                        
additionalDependencies.addAll(Grape.resolve([classLoader: 
this.classLoaderToUse], null, additionalDep))
+                    }
                 }
+                return additionalDependencies
+            } finally {
+                jar.close()
             }
-
-            return additionalDependencies
         } catch (Exception ex) {
             throw new RuntimeException(ex)
         }
@@ -196,19 +199,23 @@ class DependencyGrabber {
     private static alterPaths(final String manifestEntry, final Path extPath, 
final Artifact artifact) {
         try {
             def pathToInstalled = extPath.resolve(artifact.artifact + "-" + 
artifact.version + ".jar")
-            final JarFile jar = new JarFile(pathToInstalled.toFile());
-            final Manifest manifest = jar.getManifest()
-            def attrLine = manifest.mainAttributes.getValue(manifestEntry)
-            if (attrLine != null) {
-                def splitLine = attrLine.split(";")
-                splitLine.each {
-                    if (it.endsWith("="))
-                        Files.delete(extPath.resolve(it.substring(0, 
it.length() - 1)))
-                    else {
-                        def kv = it.split("=")
-                        Files.move(extPath.resolve(kv[0]), 
extPath.resolve(kv[1]), StandardCopyOption.REPLACE_EXISTING)
+            final JarFile jar = new JarFile(pathToInstalled.toFile())
+            try {
+                final Manifest manifest = jar.getManifest()
+                def attrLine = manifest.mainAttributes.getValue(manifestEntry)
+                if (attrLine != null) {
+                    def splitLine = attrLine.split(";")
+                    splitLine.each {
+                        if (it.endsWith("="))
+                            Files.delete(extPath.resolve(it.substring(0, 
it.length() - 1)))
+                        else {
+                            def kv = it.split("=")
+                            Files.move(extPath.resolve(kv[0]), 
extPath.resolve(kv[1]), StandardCopyOption.REPLACE_EXISTING)
+                        }
                     }
                 }
+            } finally {
+                jar.close()
             }
         } catch (Exception ex) {
             throw new RuntimeException(ex)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/63eff183/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/util/DependencyGrabberIntegrateTest.java
----------------------------------------------------------------------
diff --git 
a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/util/DependencyGrabberIntegrateTest.java
 
b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/util/DependencyGrabberIntegrateTest.java
index 7b3bba8..517ce8f 100644
--- 
a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/util/DependencyGrabberIntegrateTest.java
+++ 
b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/util/DependencyGrabberIntegrateTest.java
@@ -33,7 +33,7 @@ import static org.junit.Assert.assertTrue;
  */
 public class DependencyGrabberIntegrateTest {
     private static final GroovyClassLoader dummyClassLoader = new 
GroovyClassLoader();
-    private static final File extTestDir = new 
File(System.getProperty("user.dir"), 
TestHelper.makeTestDataDirectory(DependencyGrabberIntegrateTest.class));
+    private static final File extTestDir = 
TestHelper.makeTestDataPath(DependencyGrabberIntegrateTest.class);
     private static final DependencyGrabber dg = new 
DependencyGrabber(dummyClassLoader, extTestDir.getAbsolutePath());
 
     @AfterClass

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/63eff183/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 7dd063a..ee4b965 100644
--- a/pom.xml
+++ b/pom.xml
@@ -286,6 +286,8 @@ limitations under the License.
                         <exclude>**/_bsp/**</exclude>
                         <exclude>DEPENDENCIES</exclude>
                         <exclude>**/.glv</exclude>
+                        <exclude>bin/gremlin.sh</exclude>
+                        <exclude>gremlin-console/bin/gremlin.sh</exclude>
                     </excludes>
                     <licenses>
                         <license 
implementation="org.apache.rat.analysis.license.ApacheSoftwareLicense20"/>

Reply via email to