Skip to content

Commit

Permalink
Tweaks
Browse files Browse the repository at this point in the history
Signed-off-by: Prabhu Subramanian <[email protected]>
  • Loading branch information
prabhu committed Mar 8, 2025
1 parent e7d3ccd commit b71d99c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/main/scala/io/appthreat/atom/Atom.scala
Original file line number Diff line number Diff line change
Expand Up @@ -525,22 +525,22 @@ object Atom:
case "SCALA" | "TASTY" | "SBT" =>
val workDir =
sys.env.getOrElse("ATOM_SCALASEM_WORK_DIR", config.inputPath.parent.pathAsString)
println(s"scalasem ${workDir} ${config.outputSliceFile.pathAsString}")
val result = ExternalCommand.run(
s"scalasem ${workDir} ${config.outputSliceFile.pathAsString}",
workDir
)
result match
case Success(_) =>
println(s"${config.outputSliceFile.pathAsString} created successfully.")
println(
s"Semantic slices file '${config.outputSliceFile.pathAsString}' created successfully."
)
case Failure(exception) =>
println(
s"Failed to run scalasem. Use the atom container image and re-run this command. Exception: ${exception.getMessage}"
)
new Jimple2Cpg()
.createCpgWithOverlays(
JimpleConfig()
.withScalaSdk(System.getProperty("java.class.path"))
JimpleConfig(scalaSdk = Option(System.getProperty("java.class.path")))
.withInputPath(config.inputPath.pathAsString)
.withOutputPath(outputAtomFile)
.withFullResolver(true)
Expand Down Expand Up @@ -642,6 +642,10 @@ object Atom:
case Success(ag) =>
language match
case "SCALA" | "TASTY" | "SBT" =>
try
ag.close()
catch
case err: Throwable => Left(err.getMessage)
Right("Semantic slices generated successfully.")
case _ =>
config match
Expand Down

0 comments on commit b71d99c

Please sign in to comment.