JAL-3874 attempt to add source jars to eclipse through buildship
[jalview.git] / build.gradle
index 56140e6..9987e3b 100644 (file)
@@ -628,7 +628,15 @@ eclipse {
             //println("Not adding duplicate entry "+itPath)
           } else {
             //println("Adding entry "+itPath)
-            cp.entries += new Library(fileReference(itPath))
+            def lib = new Library(fileReference(itPath))
+            // check for source jar
+            def sourcePath = file("${j11sourcesDir}/"+it.name.replaceAll(".jar\$","-sources.jar"))
+            if (sourcePath.exists()) {
+              def refFactory = eclipse.classpath.getFileReferenceFactory();
+              def sourceRef = refFactory.fromFile(sourcePath)
+              lib.setSourcePath(sourceRef)
+            }
+            cp.entries += lib
             alreadyAddedLibPath.put(itPath, true)
           }
         }
@@ -656,6 +664,18 @@ eclipse {
 
       } // whenMerged
 
+      /*
+      withXml {
+        xml ->
+        def node = xml.asNode()
+        node.classpathentry.forEach {
+          if (it.@kind == "lib") {
+            println("LIB "+it.toString())
+          }
+        }
+      }
+      */
+
     } // file
 
     containers 'org.eclipse.buildship.core.gradleclasspathcontainer'
@@ -2949,8 +2969,8 @@ task jalviewjsServer {
 
     def factory
     try {
-      def class = Class.forName("SimpleHttpFileServerFactory")
-      factory = class.newInstance()
+      def f = Class.forName("org.gradle.plugins.javascript.envjs.http.simple.SimpleHttpFileServerFactory")
+      factory = f.newInstance()
     } catch (ClassNotFoundException e) {
       throw new GradleException("Unable to create SimpleHttpFileServerFactory")
     }