diff --git a/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/BiopetCommandLineFunctionTrait.scala b/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/BiopetCommandLineFunctionTrait.scala index f6de8b3e4ab954dea6013bf54dcfe9450ca32b8b..614aed75942f4adc80a58bd85c08383d9b125bfc 100644 --- a/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/BiopetCommandLineFunctionTrait.scala +++ b/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/BiopetCommandLineFunctionTrait.scala @@ -156,7 +156,13 @@ trait BiopetCommandLineFunctionTrait extends CommandLineFunction with Configurab protected val versionExitcode = List(0) /** Executes the version command */ - private def getVersionInternal: Option[String] = { + private[core] def getVersionInternal(): Option[String] = { + if (versionCommand == null || versionRegex == null) None + else getVersionInternal(versionCommand, versionRegex) + } + + /** Executes the version command */ + private[core] def getVersionInternal(versionCommand: String, versionRegex: Regex): Option[String] = { if (versionCommand == null || versionRegex == null) return None val exe = new File(versionCommand.trim.split(" ")(0)) if (!exe.exists()) return None @@ -221,7 +227,7 @@ trait BiopetCommandLineFunctionTrait extends CommandLineFunction with Configurab /** stores global caches */ object BiopetCommandLineFunctionTrait { import scala.collection.mutable.Map - private val versionCache: Map[String, String] = Map() + private[core] val versionCache: Map[String, String] = Map() private[core] val executableMd5Cache: Map[String, String] = Map() - private val executableCache: Map[String, String] = Map() + private[core] val executableCache: Map[String, String] = Map() } diff --git a/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/BiopetJavaCommandLineFunction.scala b/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/BiopetJavaCommandLineFunction.scala index cd26c269d9779f4cb2bb29bf06db18f04a548ae4..d0d4496e9a2dd08c15d38565bd01efe8938a6843 100644 --- a/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/BiopetJavaCommandLineFunction.scala +++ b/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/BiopetJavaCommandLineFunction.scala @@ -37,6 +37,19 @@ trait BiopetJavaCommandLineFunction extends JavaCommandLineFunction with BiopetC return cmd } + def javaVersionCommand: String = executable + " -version" + + def getJavaVersion: Option[String] = { + if (!BiopetCommandLineFunctionTrait.executableCache.contains(executable)) + preProcesExecutable + if (!BiopetCommandLineFunctionTrait.versionCache.contains(javaVersionCommand)) + getVersionInternal(javaVersionCommand, """java version "(.*)"""".r) match { + case Some(version) => BiopetCommandLineFunctionTrait.versionCache += javaVersionCommand -> version + case _ => + } + BiopetCommandLineFunctionTrait.versionCache.get(javaVersionCommand) + } + override def setupRetry(): Unit = { super.setupRetry() javaMemoryLimit = memoryLimit diff --git a/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/summary/WriteSummary.scala b/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/summary/WriteSummary.scala index f28b4db04416373bd58e5f5cc5bc79c4a8dbccf8..5498c613935fe8152bb48046c9818d9c64467c86 100644 --- a/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/summary/WriteSummary.scala +++ b/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/summary/WriteSummary.scala @@ -74,11 +74,13 @@ class WriteSummary(val root: Configurable) extends InProcessFunction with Config case f: BiopetJavaCommandLineFunction => { f.configName -> Map("version" -> f.getVersion.getOrElse(None), "java_md5" -> BiopetCommandLineFunctionTrait.executableMd5Cache.getOrElse(f.executable, None), - "jar_md5" -> SummaryQScript.md5sumCache.getOrElse(f.jarFile, None)) + "java_version" -> f.getJavaVersion, + "jar_path" -> f.jarFile) } case f: BiopetCommandLineFunction => { f.configName -> Map("version" -> f.getVersion.getOrElse(None), - "md5" -> BiopetCommandLineFunctionTrait.executableMd5Cache.getOrElse(f.executable, None)) + "md5" -> BiopetCommandLineFunctionTrait.executableMd5Cache.getOrElse(f.executable, None), + "path" -> f.executable) } case _ => throw new IllegalStateException("This should not be possible") }