Skip to content

Commit c308d51

Browse files
Fix in ConfigFactory.load re: unit test --> test branch (#515)
--------- Co-authored-by: Ted Brookings <ted@fulcrumgenomics.com>
1 parent 5fcd1d1 commit c308d51

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

compiler/src/main/scala/dx/compiler/Compiler.scala

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ case class Compiler(extras: Option[Extras],
163163

164164
// Add a checksum to a request
165165
private def checksumRequest(name: String,
166+
versionTag: String,
166167
desc: Map[String, JsValue]): (Map[String, JsValue], String) = {
167168
logger2.trace(
168169
s"""|${name} -> checksum request
@@ -196,7 +197,7 @@ case class Compiler(extras: Option[Extras],
196197
}
197198
val updatedDetails = existingDetails ++
198199
Map(
199-
Constants.Version -> JsString(getVersion),
200+
Constants.Version -> JsString(versionTag),
200201
Constants.Checksum -> JsString(digest)
201202
)
202203
// Add properties and attributes we don't want to fall under the checksum
@@ -320,6 +321,7 @@ case class Compiler(extras: Option[Extras],
320321
*/
321322
private def maybeBuildApplet(
322323
applet: Application,
324+
versionTag: String,
323325
dependencyDict: Map[String, CompiledExecutable]
324326
): (DxApplet, Vector[ExecutableLink]) = {
325327
logger2.trace(s"Compiling applet ${applet.name}")
@@ -357,6 +359,7 @@ case class Compiler(extras: Option[Extras],
357359
// Calculate a checksum of the inputs that went into the making of the applet.
358360
val (appletApiRequest, digest) = checksumRequest(
359361
applet.name,
362+
versionTag,
360363
appletCompiler.apply(applet, dependencies)
361364
)
362365
// write the request to a file, in case we need it for debugging
@@ -392,6 +395,7 @@ case class Compiler(extras: Option[Extras],
392395
*/
393396
private def maybeBuildWorkflow(
394397
workflow: Workflow,
398+
versionTag: String,
395399
dependencyDict: Map[String, CompiledExecutable]
396400
): (DxWorkflow, JsValue) = {
397401
logger2.trace(s"Compiling workflow ${workflow.name}")
@@ -408,7 +412,8 @@ case class Compiler(extras: Option[Extras],
408412
logger2)
409413
// Calculate a checksum of the inputs that went into the making of the applet.
410414
val (workflowApiRequest, execTree) = workflowCompiler.apply(workflow, dependencyDict)
411-
val (requestWithChecksum, digest) = checksumRequest(workflow.name, workflowApiRequest)
415+
val (requestWithChecksum, digest) =
416+
checksumRequest(workflow.name, versionTag, workflowApiRequest)
412417
// Add properties we do not want to fall under the checksum.
413418
// This allows, for example, moving the dx:executable, while
414419
// still being able to reuse it.
@@ -445,6 +450,7 @@ case class Compiler(extras: Option[Extras],
445450
*/
446451
private def buildExecutable(
447452
name: String,
453+
versionTag: String,
448454
dependencyDict: Map[String, CompiledExecutable]
449455
): (String, CompiledExecutable) = {
450456
bundle.allCallables(name) match {
@@ -477,11 +483,11 @@ case class Compiler(extras: Option[Extras],
477483
case _ =>
478484
val (dxApplet, dependencies) =
479485
try {
480-
maybeBuildApplet(application, dependencyDict)
486+
maybeBuildApplet(application, versionTag, dependencyDict)
481487
} catch {
482488
case t: Throwable =>
483489
throw new RuntimeException(
484-
"Building applet '" + application.name + "': " + t.toString()
490+
"Building applet '" + application.name + "': " + t.toString
485491
)
486492
}
487493

@@ -491,10 +497,10 @@ case class Compiler(extras: Option[Extras],
491497
case wf: Workflow =>
492498
val (dxWorkflow, execTree) =
493499
try {
494-
maybeBuildWorkflow(wf, dependencyDict)
500+
maybeBuildWorkflow(wf, versionTag, dependencyDict)
495501
} catch {
496502
case t: Throwable =>
497-
throw new RuntimeException("Building workflow '" + wf.name + "': " + t.toString())
503+
throw new RuntimeException("Building workflow '" + wf.name + "': " + t.toString)
498504
}
499505
wf.name -> CompiledExecutable(wf, dxWorkflow, execTree = Some(execTree))
500506
}
@@ -545,6 +551,7 @@ case class Compiler(extras: Option[Extras],
545551
logger.trace(
546552
s""
547553
)
554+
val versionTag: String = getVersion
548555
var stage: Int = 0
549556
val executables: Map[String, CompiledExecutable] =
550557
getCompileOrder.foldLeft(Map.empty[String, CompiledExecutable]) {
@@ -558,7 +565,7 @@ case class Compiler(extras: Option[Extras],
558565
val blockExecutables = blockExecutableNames
559566
.parWith(parallelism = executableCreationParallelism)
560567
.map { name =>
561-
buildExecutable(name, executables)
568+
buildExecutable(name, versionTag, executables)
562569
}
563570
.toMap
564571
.seq

core/src/main/scala/dx/core/package.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ import com.typesafe.config.ConfigFactory
55
package object core {
66
// The version lives in application.conf
77
def getVersion: String = {
8-
val config = ConfigFactory.load("application.conf")
8+
val config = this.synchronized {
9+
ConfigFactory.load("application.conf")
10+
}
911
config.getString("dxCompilerCore.version")
1012
}
1113
}

0 commit comments

Comments
 (0)