Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type" : "bugfix",
"description" : "Fix(Amazon Q Code Transformation): always show user latest/correct transformation results"
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import software.aws.toolkits.core.utils.warn
import software.aws.toolkits.jetbrains.services.codemodernizer.TransformationSummary
import software.aws.toolkits.jetbrains.services.codemodernizer.utils.unzipFile
import java.io.File
import java.util.UUID
import kotlin.io.path.ExperimentalPathApi
import kotlin.io.path.Path
import kotlin.io.path.isDirectory
Expand All @@ -39,7 +40,7 @@ open class CodeModernizerArtifact(

companion object {
private const val MAX_SUPPORTED_VERSION = 1.0
private val tempDir = createTempDirectory("codeTransformArtifacts", null)
private var tempDir = createTempDirectory("codeTransformArtifacts", null)
private const val MANIFEST_FILE_NAME = "manifest.json"
private const val SUMMARY_FILE_NAME = "summary.md"
private const val METRICS_FILE_NAME = "metrics.json"
Expand All @@ -52,6 +53,7 @@ open class CodeModernizerArtifact(
* If anything goes wrong during this process an exception is thrown.
*/
fun create(zipPath: String): CodeModernizerArtifact {
tempDir = createTempDirectory("codeTransformArtifacts-", UUID.randomUUID().toString())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leaking state through the companion object. please have backlog for better encapsulation

val path = Path(zipPath)
if (path.exists()) {
if (!unzipFile(path, tempDir.toPath())) {
Expand Down
Loading