From: Ben Soares Date: Fri, 17 Sep 2021 12:05:49 +0000 (+0100) Subject: JAL-3874 attempt to add source jars to eclipse through buildship X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Ffeature%2FJAL-3874_add_source_jars_to_eclipse;p=jalview.git JAL-3874 attempt to add source jars to eclipse through buildship --- diff --git a/build.gradle b/build.gradle index ee7be0f..9987e3b 100644 --- a/build.gradle +++ b/build.gradle @@ -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' diff --git a/gradle.properties b/gradle.properties index d0fb57d..510c83b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -31,6 +31,7 @@ testng_excluded_groups = j8libDir = j8lib j11libDir = j11lib +j11sourcesDir = j11sources resource_dir = resources help_parent_dir = help help_dir = help diff --git a/j11sources/Jmol-14.31.53-sources.jar b/j11sources/Jmol-14.31.53-sources.jar new file mode 100644 index 0000000..72f16b5 Binary files /dev/null and b/j11sources/Jmol-14.31.53-sources.jar differ