diff --git a/.changes/next-release/feature-065d979a-e921-4252-a9a7-f0c2079015f3.json b/.changes/next-release/feature-065d979a-e921-4252-a9a7-f0c2079015f3.json new file mode 100644 index 0000000000..ae117a7993 --- /dev/null +++ b/.changes/next-release/feature-065d979a-e921-4252-a9a7-f0c2079015f3.json @@ -0,0 +1,4 @@ +{ + "type" : "feature", + "description" : "/transform: run all builds client-side" +} \ No newline at end of file diff --git a/plugins/amazonq/build.gradle.kts b/plugins/amazonq/build.gradle.kts index b20472a83f..6475f80378 100644 --- a/plugins/amazonq/build.gradle.kts +++ b/plugins/amazonq/build.gradle.kts @@ -1,11 +1,7 @@ // Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType import software.aws.toolkits.gradle.changelog.tasks.GeneratePluginChangeLog -import software.aws.toolkits.gradle.intellij.IdeFlavor -import software.aws.toolkits.gradle.intellij.IdeVersions -import software.aws.toolkits.gradle.intellij.toolkitIntelliJ plugins { id("toolkit-publishing-conventions") @@ -19,6 +15,12 @@ val changelog = tasks.register("pluginChangeLog") { changeLogFile.value(layout.buildDirectory.file("changelog/change-notes.xml")) } +tasks.prepareSandbox { + from("contrib/QCT-Maven.jar") { + into("/plugin-amazonq/lib") + } +} + tasks.jar { dependsOn(changelog) from(changelog) { diff --git a/plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/controller/CodeTransformChatController.kt b/plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/controller/CodeTransformChatController.kt index 7e1f17ce25..6e648eecb3 100644 --- a/plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/controller/CodeTransformChatController.kt +++ b/plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/controller/CodeTransformChatController.kt @@ -4,17 +4,21 @@ package software.aws.toolkits.jetbrains.services.codemodernizer.controller import com.intellij.ide.BrowserUtil +import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.application.runInEdt import com.intellij.openapi.fileChooser.FileChooser import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory +import com.intellij.openapi.fileEditor.FileEditorManager import com.intellij.openapi.module.ModuleUtil import com.intellij.openapi.projectRoots.JavaSdkVersion import com.intellij.openapi.projectRoots.ProjectJdkTable import com.intellij.openapi.util.io.FileUtil.createTempDirectory import com.intellij.openapi.vfs.VirtualFile +import com.intellij.testFramework.LightVirtualFile import kotlinx.coroutines.delay import kotlinx.coroutines.runBlocking import kotlinx.coroutines.withContext +import org.jetbrains.yaml.YAMLFileType import software.amazon.awssdk.services.codewhispererstreaming.model.TransformationDownloadArtifactType import software.aws.toolkits.core.utils.debug import software.aws.toolkits.core.utils.error @@ -76,6 +80,7 @@ import software.aws.toolkits.jetbrains.services.codemodernizer.constants.buildTr import software.aws.toolkits.jetbrains.services.codemodernizer.constants.buildTransformStoppingChatContent import software.aws.toolkits.jetbrains.services.codemodernizer.constants.buildUserCancelledChatContent import software.aws.toolkits.jetbrains.services.codemodernizer.constants.buildUserHilSelection +import software.aws.toolkits.jetbrains.services.codemodernizer.constants.buildUserInputCustomDependencyVersionsChatContent import software.aws.toolkits.jetbrains.services.codemodernizer.constants.buildUserInputLanguageUpgradeChatContent import software.aws.toolkits.jetbrains.services.codemodernizer.constants.buildUserInputOneOrMultipleDiffsChatIntroContent import software.aws.toolkits.jetbrains.services.codemodernizer.constants.buildUserInputOneOrMultipleDiffsFlagChatContent @@ -92,6 +97,7 @@ import software.aws.toolkits.jetbrains.services.codemodernizer.messages.Authenti import software.aws.toolkits.jetbrains.services.codemodernizer.messages.CodeTransformChatMessage import software.aws.toolkits.jetbrains.services.codemodernizer.messages.CodeTransformCommandMessage import software.aws.toolkits.jetbrains.services.codemodernizer.messages.IncomingCodeTransformMessage +import software.aws.toolkits.jetbrains.services.codemodernizer.model.CLIENT_SIDE_BUILD import software.aws.toolkits.jetbrains.services.codemodernizer.model.CodeModernizerArtifact import software.aws.toolkits.jetbrains.services.codemodernizer.model.CodeModernizerJobCompletedResult import software.aws.toolkits.jetbrains.services.codemodernizer.model.CodeTransformConversationState @@ -427,23 +433,22 @@ class CodeTransformChatController( override suspend fun processCodeTransformOneOrMultipleDiffs(message: IncomingCodeTransformMessage.CodeTransformConfirmOneOrMultipleDiffs) { val transformCapabilities = when (message.oneOrMultipleDiffsSelection) { - // TODO: add CLIENT_SIDE_BUILD to both below when releasing CSB message("codemodernizer.chat.message.one_or_multiple_diffs_form.multiple_diffs") -> listOf( EXPLAINABILITY_V1, - SELECTIVE_TRANSFORMATION_V1 + SELECTIVE_TRANSFORMATION_V1, + CLIENT_SIDE_BUILD ) else -> listOf( EXPLAINABILITY_V1, + CLIENT_SIDE_BUILD ) } telemetry.submitSelection(message.oneOrMultipleDiffsSelection) codeTransformChatHelper.addNewMessage(buildUserOneOrMultipleDiffsSelectionChatContent(message.oneOrMultipleDiffsSelection)) codeModernizerManager.codeTransformationSession?.let { it.sessionContext.transformCapabilities = transformCapabilities - codeModernizerManager.runLocalMavenBuild(context.project, it) } - // TODO: when releasing CSB, delete "runLocalMavenBuild" line above and uncomment line below - // promptForCustomYamlFile() + promptForCustomYamlFile() } override suspend fun processCodeTransformCustomDependencyVersions(message: IncomingCodeTransformMessage.CodeTransformConfirmCustomDependencyVersions) { @@ -485,14 +490,11 @@ class CodeTransformChatController( } } - // TODO: uncomment when releasing CSB -/* private suspend fun promptForCustomYamlFile() { codeTransformChatHelper.addNewMessage(buildUserInputCustomDependencyVersionsChatContent()) val sampleYAML = """ -name: "custom-dependency-management" +name: "dependency-upgrade" description: "Custom dependency version management for Java migration from JDK 8/11/17 to JDK 17/21" - dependencyManagement: dependencies: - identifier: "com.example:library1" @@ -503,18 +505,18 @@ dependencyManagement: targetVersion: "3.0.0" originType: "THIRD_PARTY" plugins: - - identifier: "com.example.plugin" + - identifier: "com.example:plugin" targetVersion: "1.2.0" versionProperty: "plugin.version" # Optional """.trimIndent() - val virtualFile = LightVirtualFile("sample-dependency-management.yaml", YAMLFileType.YML, sampleYAML) + val virtualFile = LightVirtualFile("sample-dependency-upgrade.yaml", YAMLFileType.YML, sampleYAML) virtualFile.isWritable = true ApplicationManager.getApplication().invokeLater { FileEditorManager.getInstance(context.project).openFile(virtualFile, true) } } -*/ + override suspend fun processCodeTransformContinueAction(message: IncomingCodeTransformMessage.CodeTransformContinue) { codeTransformChatHelper.addNewMessage(buildContinueTransformationChatContent()) promptForTargetJdkName(message.tabId) diff --git a/plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/ideMaven/MavenRunnerUtils.kt b/plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/ideMaven/MavenRunnerUtils.kt index 35ecb95564..f99e7546d4 100644 --- a/plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/ideMaven/MavenRunnerUtils.kt +++ b/plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/ideMaven/MavenRunnerUtils.kt @@ -17,6 +17,8 @@ import org.jetbrains.idea.maven.execution.MavenRunnerSettings import org.slf4j.Logger import software.aws.toolkits.core.utils.error import software.aws.toolkits.core.utils.info +import software.aws.toolkits.jetbrains.AwsPlugin +import software.aws.toolkits.jetbrains.AwsToolkit import software.aws.toolkits.jetbrains.services.codemodernizer.CodeModernizerManager import software.aws.toolkits.jetbrains.services.codemodernizer.CodeTransformTelemetryManager import software.aws.toolkits.jetbrains.services.codemodernizer.model.CodeModernizerSessionContext @@ -29,79 +31,20 @@ import java.io.File import java.nio.file.Files import java.nio.file.Path -fun runClientSideBuild(targetDir: VirtualFile, logger: Logger, project: Project): Pair { - // run mvn test-compile or mvn test - val transformMvnRunner = TransformMavenRunner(project) - val mvnSettings = MavenRunner.getInstance(project).settings.clone() - val buildRunnable = runClientSideBuild(targetDir, mvnSettings, transformMvnRunner, logger, project) - buildRunnable.await() - // write build output to a new text file and open it - val buildLogOutput = buildRunnable.getOutput().toString() - // first line is a long Maven String showing the build command; not useful or needed - val outputWithoutFirstLine = buildLogOutput.lines().drop(1).joinToString("\n") - val buildLogOutputFile = Files.createTempFile("build-logs-", ".txt") - Files.write(buildLogOutputFile, outputWithoutFirstLine.toByteArray()) - val buildLogOutputVirtualFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(buildLogOutputFile.toFile()) - runInEdt { - if (buildLogOutputVirtualFile != null) { - FileEditorManager.getInstance(project).openFile(buildLogOutputVirtualFile, true) - } - } - return buildRunnable.getExitCode() to buildRunnable.getOutput().toString() -} - -fun runHilMavenCopyDependency( - context: CodeModernizerSessionContext, - sourceFolder: File, - destinationDir: File, - logBuilder: StringBuilder, - logger: Logger, - project: Project, -): MavenCopyCommandsResult { - logger.info { "Executing IntelliJ bundled Maven" } - try { - // Create shared parameters - val transformMvnRunner = TransformMavenRunner(project) - context.mavenRunnerQueue.add(transformMvnRunner) - val mvnSettings = MavenRunner.getInstance(project).settings.clone() // clone required to avoid editing user settings - - // run copy dependencies - val copyDependenciesRunnable = - runMavenCopyDependencies(sourceFolder, logBuilder, mvnSettings, transformMvnRunner, destinationDir.toPath(), logger) - copyDependenciesRunnable.await() - logBuilder.appendLine(copyDependenciesRunnable.getOutput()) - if (copyDependenciesRunnable.isComplete()) { - val successMsg = "IntelliJ IDEA bundled Maven copy-dependencies executed successfully" - logger.info { successMsg } - logBuilder.appendLine(successMsg) - } else if (copyDependenciesRunnable.isTerminated()) { - return MavenCopyCommandsResult.Cancelled - } - } catch (t: Throwable) { - logger.error(t) { "IntelliJ bundled Maven copy-dependencies failed" } - return MavenCopyCommandsResult.Failure - } - // When all commands executed successfully, show the transformation hub - return MavenCopyCommandsResult.Success(destinationDir) -} - fun runMavenCopyCommands( context: CodeModernizerSessionContext, sourceFolder: File, logBuilder: StringBuilder, logger: Logger, project: Project, - shouldSkipTests: Boolean, ): MavenCopyCommandsResult { val currentTimestamp = System.currentTimeMillis() val destinationDir = Files.createTempDirectory("transformation_dependencies_temp_$currentTimestamp") val telemetry = CodeTransformTelemetryManager.getInstance(project) var telemetryErrorMessage = "" var telemetryLocalBuildResult = Result.Succeeded - logger.info { "Executing IntelliJ bundled Maven" } try { - // Create shared parameters val transformMvnRunner = TransformMavenRunner(project) context.mavenRunnerQueue.add(transformMvnRunner) val mvnSettings = MavenRunner.getInstance(project).settings.clone() // clone required to avoid editing user settings @@ -111,108 +54,94 @@ fun runMavenCopyCommands( val sdk = moduleSdk ?: ProjectRootManager.getInstance(project).projectSdk // edge case: module SDK and project SDK are null, and Maven Runner Settings is using the null project SDK, so Maven Runner will definitely fail if (sdk == null && mvnSettings.jreName == "#USE_PROJECT_JDK") return MavenCopyCommandsResult.NoJdk - - // run copy dependencies - val copyDependenciesRunnable = - runMavenCopyDependencies(sourceFolder, logBuilder, mvnSettings, transformMvnRunner, destinationDir, logger) - copyDependenciesRunnable.await() - logBuilder.appendLine(copyDependenciesRunnable.getOutput()) - if (copyDependenciesRunnable.isComplete()) { - val successMsg = "IntelliJ IDEA bundled Maven copy-dependencies executed successfully" + // run clean test-compile with Maven JAR + val jarRunnable = runMavenJar(sourceFolder, logBuilder, mvnSettings, transformMvnRunner, destinationDir, logger) + jarRunnable.await() + val output = jarRunnable.getOutput()?.lowercase()?.replace("elasticgumby", "QCT") + logBuilder.appendLine(output) + if (jarRunnable.isComplete()) { + val successMsg = "IntelliJ bundled Maven JAR executed successfully" logger.info { successMsg } logBuilder.appendLine(successMsg) - } else if (copyDependenciesRunnable.isTerminated()) { + } else if (jarRunnable.isTerminated()) { telemetryLocalBuildResult = Result.Cancelled return MavenCopyCommandsResult.Cancelled } else { - telemetryErrorMessage += "Maven Copy: bundled Maven failed. " - } - - // Run clean - val cleanRunnable = runMavenClean(sourceFolder, logBuilder, mvnSettings, transformMvnRunner, logger, destinationDir) - cleanRunnable.await() - logBuilder.appendLine(cleanRunnable.getOutput()) - if (cleanRunnable.isComplete()) { - val successMsg = "IntelliJ bundled Maven clean executed successfully" - logger.info { successMsg } - logBuilder.appendLine(successMsg) - } else if (cleanRunnable.isTerminated()) { - telemetryLocalBuildResult = Result.Cancelled - return MavenCopyCommandsResult.Cancelled - } else { - telemetryErrorMessage += "Maven Clean: bundled Maven failed." - - telemetryLocalBuildResult = Result.Failed - return MavenCopyCommandsResult.Failure - } - - // Run install - val installRunnable = runMavenInstall(sourceFolder, logBuilder, mvnSettings, transformMvnRunner, logger, destinationDir, shouldSkipTests) - installRunnable.await() - logBuilder.appendLine(installRunnable.getOutput()) - if (installRunnable.isComplete()) { - val successMsg = "IntelliJ bundled Maven install executed successfully" - logger.info { successMsg } - logBuilder.appendLine(successMsg) - } else if (installRunnable.isTerminated()) { - telemetryLocalBuildResult = Result.Cancelled - return MavenCopyCommandsResult.Cancelled - } else { - telemetryErrorMessage += "Maven Install: bundled Maven failed." - + telemetryErrorMessage += "Maven JAR: bundled Maven failed." telemetryLocalBuildResult = Result.Failed return MavenCopyCommandsResult.Failure } } catch (t: Throwable) { - val errorMessage = "IntelliJ bundled Maven executed failed: ${t.message}" + val error = t.message?.lowercase()?.replace("elasticgumby", "QCT") + val errorMessage = "IntelliJ bundled Maven JAR executed failed: $error" logger.error(t) { errorMessage } telemetryErrorMessage = errorMessage telemetryLocalBuildResult = Result.Failed return MavenCopyCommandsResult.Failure } finally { - // emit telemetry telemetry.localBuildProject(CodeTransformBuildCommand.IDEBundledMaven, telemetryLocalBuildResult, telemetryErrorMessage) } - // When all commands executed successfully, show the transformation hub return MavenCopyCommandsResult.Success(destinationDir.toFile()) } -private fun runMavenCopyDependencies( +private fun runMavenJar( sourceFolder: File, - buildlogBuilder: StringBuilder, + logBuilder: StringBuilder, mvnSettings: MavenRunnerSettings, transformMavenRunner: TransformMavenRunner, destinationDir: Path, logger: Logger, ): TransformRunnable { - buildlogBuilder.appendLine("Command Run: IntelliJ IDEA bundled Maven dependency:copy-dependencies") - val copyCommandList = listOf( - "dependency:copy-dependencies", - "-DoutputDirectory=$destinationDir", - "-Dmdep.useRepositoryLayout=true", - "-Dmdep.copyPom=true", - "-Dmdep.addParentPoms=true", + logBuilder.appendLine("Command Run: IntelliJ IDEA bundled Maven JAR") + val jarPath = AwsToolkit.PLUGINS_INFO[AwsPlugin.Q]?.path?.resolve("lib/QCT-Maven.jar") + + val commandList = listOf( + "-Dmaven.ext.class.path=$jarPath", + "-Dcom.amazon.aws.developer.transform.jobDirectory=$destinationDir", + "clean", + "test-compile" ) - val copyParams = MavenRunnerParameters( + val jarParams = MavenRunnerParameters( false, sourceFolder.absolutePath, null, - copyCommandList, + commandList, emptyList(), null ) - val copyTransformRunnable = TransformRunnable() + val jarRunnable = TransformRunnable() runInEdt { try { - transformMavenRunner.run(copyParams, mvnSettings, copyTransformRunnable) + transformMavenRunner.run(jarParams, mvnSettings, jarRunnable) } catch (t: Throwable) { - val error = "Maven Copy: Unexpected error when executing bundled Maven copy dependencies" - copyTransformRunnable.setExitCode(Integer.MIN_VALUE) // to stop looking for the exitCode + val error = "Maven JAR: Unexpected error when executing bundled Maven JAR" + jarRunnable.setExitCode(Integer.MIN_VALUE) // to stop looking for the exitCode logger.info(t) { error } - buildlogBuilder.appendLine("IntelliJ bundled Maven copy dependencies failed: ${t.message}") + logBuilder.appendLine("IntelliJ bundled Maven JAR failed: ${t.message}") } } - return copyTransformRunnable + return jarRunnable +} + +fun runClientSideBuild(targetDir: VirtualFile, logger: Logger, project: Project): Pair { + // run mvn test-compile or mvn test + val transformMvnRunner = TransformMavenRunner(project) + val mvnSettings = MavenRunner.getInstance(project).settings.clone() + val buildRunnable = runClientSideBuild(targetDir, mvnSettings, transformMvnRunner, logger, project) + buildRunnable.await() + // write build output to a new text file and open it + val buildLogOutput = buildRunnable.getOutput().toString() + // first line is a long Maven String showing the build command; not useful or needed + val outputWithoutFirstLine = buildLogOutput.lines().drop(1).joinToString("\n") + val buildLogOutputFile = Files.createTempFile("build-logs-", ".txt") + Files.write(buildLogOutputFile, outputWithoutFirstLine.toByteArray()) + val buildLogOutputVirtualFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(buildLogOutputFile.toFile()) + runInEdt { + if (buildLogOutputVirtualFile != null) { + FileEditorManager.getInstance(project).openFile(buildLogOutputVirtualFile, true) + } + } + return buildRunnable.getExitCode() to buildRunnable.getOutput().toString() } private fun runClientSideBuild( @@ -245,70 +174,79 @@ private fun runClientSideBuild( return buildTransformRunnable } -private fun runMavenClean( +// TODO: all functions below are for HIL; consider removing once client-side build released + +fun runHilMavenCopyDependency( + context: CodeModernizerSessionContext, sourceFolder: File, - buildlogBuilder: StringBuilder, - mvnSettings: MavenRunnerSettings, - transformMavenRunner: TransformMavenRunner, + destinationDir: File, + logBuilder: StringBuilder, logger: Logger, - destinationDir: Path, -): TransformRunnable { - buildlogBuilder.appendLine("Command Run: IntelliJ IDEA bundled Maven clean") - val cleanParams = MavenRunnerParameters( - false, - sourceFolder.absolutePath, - null, - listOf("-Dmaven.repo.local=$destinationDir", "clean"), - null, - null - ) - val cleanTransformRunnable = TransformRunnable() - runInEdt { - try { - transformMavenRunner.run(cleanParams, mvnSettings, cleanTransformRunnable) - } catch (t: Throwable) { - logger.error { "Maven Clean: Unexpected error when executing bundled Maven clean" } - cleanTransformRunnable.setExitCode(Integer.MIN_VALUE) // to stop looking for the exitCode - buildlogBuilder.appendLine("IntelliJ bundled Maven clean failed: ${t.message}") + project: Project, +): MavenCopyCommandsResult { + logger.info { "Executing IntelliJ bundled Maven" } + try { + // Create shared parameters + val transformMvnRunner = TransformMavenRunner(project) + context.mavenRunnerQueue.add(transformMvnRunner) + val mvnSettings = MavenRunner.getInstance(project).settings.clone() // clone required to avoid editing user settings + + // run copy dependencies + val copyDependenciesRunnable = + runMavenCopyDependencies(sourceFolder, logBuilder, mvnSettings, transformMvnRunner, destinationDir.toPath(), logger) + copyDependenciesRunnable.await() + logBuilder.appendLine(copyDependenciesRunnable.getOutput()) + if (copyDependenciesRunnable.isComplete()) { + val successMsg = "IntelliJ IDEA bundled Maven copy-dependencies executed successfully" + logger.info { successMsg } + logBuilder.appendLine(successMsg) + } else if (copyDependenciesRunnable.isTerminated()) { + return MavenCopyCommandsResult.Cancelled } + } catch (t: Throwable) { + logger.error(t) { "IntelliJ bundled Maven copy-dependencies failed" } + return MavenCopyCommandsResult.Failure } - return cleanTransformRunnable + // When all commands executed successfully, show the transformation hub + return MavenCopyCommandsResult.Success(destinationDir) } -private fun runMavenInstall( +private fun runMavenCopyDependencies( sourceFolder: File, logBuilder: StringBuilder, mvnSettings: MavenRunnerSettings, transformMavenRunner: TransformMavenRunner, - logger: Logger, destinationDir: Path, - shouldSkipTests: Boolean, + logger: Logger, ): TransformRunnable { - logBuilder.appendLine("Command Run: IntelliJ IDEA bundled Maven install") - val flags = if (shouldSkipTests) { - listOf("-Dmaven.repo.local=$destinationDir", "install", "-DskipTests") - } else { - listOf("-Dmaven.repo.local=$destinationDir", "install") - } - val installParams = MavenRunnerParameters( + logBuilder.appendLine("Command Run: IntelliJ IDEA bundled Maven dependency:copy-dependencies") + val copyCommandList = listOf( + "dependency:copy-dependencies", + "-DoutputDirectory=$destinationDir", + "-Dmdep.useRepositoryLayout=true", + "-Dmdep.copyPom=true", + "-Dmdep.addParentPoms=true", + ) + val copyParams = MavenRunnerParameters( false, sourceFolder.absolutePath, null, - flags, - null, + copyCommandList, + emptyList(), null ) - val installTransformRunnable = TransformRunnable() + val copyTransformRunnable = TransformRunnable() runInEdt { try { - transformMavenRunner.run(installParams, mvnSettings, installTransformRunnable) + transformMavenRunner.run(copyParams, mvnSettings, copyTransformRunnable) } catch (t: Throwable) { - logger.error(t) { "Maven Install: Unexpected error when executing bundled Maven install" } - installTransformRunnable.setExitCode(Integer.MIN_VALUE) // to stop looking for the exitCode - logBuilder.appendLine("IntelliJ bundled Maven install failed: ${t.message}") + val error = "Maven Copy: Unexpected error when executing bundled Maven copy dependencies" + copyTransformRunnable.setExitCode(Integer.MIN_VALUE) // to stop looking for the exitCode + logger.info(t) { error } + logBuilder.appendLine("IntelliJ bundled Maven copy dependencies failed: ${t.message}") } } - return installTransformRunnable + return copyTransformRunnable } private fun runMavenDependencyUpdatesReport( diff --git a/plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/ideMaven/TransformMavenRunner.kt b/plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/ideMaven/TransformMavenRunner.kt index 4590c52979..338d465aca 100644 --- a/plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/ideMaven/TransformMavenRunner.kt +++ b/plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/ideMaven/TransformMavenRunner.kt @@ -38,7 +38,7 @@ class TransformMavenRunner(val project: Project) { override fun onTextAvailable(event: ProcessEvent, outputType: Key<*>) { // IntelliJ includes some unneeded lines in stdout; exclude those from build logs - if (!event.text.startsWith("[IJ]")) { + if (!event.text.startsWith("[IJ]") && !event.text.startsWith("Progress (")) { output += event.text } } diff --git a/plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/model/CodeModernizerSessionContext.kt b/plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/model/CodeModernizerSessionContext.kt index 93bf8a20b1..39b6dbfa19 100644 --- a/plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/model/CodeModernizerSessionContext.kt +++ b/plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/model/CodeModernizerSessionContext.kt @@ -44,8 +44,7 @@ import kotlin.io.path.pathString const val MANIFEST_PATH = "manifest.json" const val ZIP_SOURCES_PATH = "sources" const val ZIP_DEPENDENCIES_PATH = "dependencies" -const val BUILD_LOG_PATH = "build-logs.txt" -const val CUSTOM_DEPENDENCY_VERSIONS_FILE_PATH = "custom-upgrades.yaml" +const val CUSTOM_DEPENDENCY_VERSIONS_FILE_PATH = "dependency_upgrade.yml" const val UPLOAD_ZIP_MANIFEST_VERSION = "1.0" const val HIL_1P_UPGRADE_CAPABILITY = "HIL_1pDependency_VersionUpgrade" const val EXPLAINABILITY_V1 = "EXPLAINABILITY_V1" @@ -110,8 +109,7 @@ data class CodeModernizerSessionContext( fun executeMavenCopyCommands(sourceFolder: File, buildLogBuilder: StringBuilder): MavenCopyCommandsResult { if (isDisposed) return MavenCopyCommandsResult.Cancelled - val shouldSkipTests = customBuildCommand == MAVEN_BUILD_SKIP_UNIT_TESTS - return runMavenCopyCommands(this, sourceFolder, buildLogBuilder, LOG, project, shouldSkipTests) + return runMavenCopyCommands(this, sourceFolder, buildLogBuilder, LOG, project) } private fun executeHilMavenCopyDependency(sourceFolder: File, destinationFolder: File, buildLogBuilder: StringBuilder) = runHilMavenCopyDependency( @@ -209,7 +207,6 @@ data class CodeModernizerSessionContext( fun createZipWithModuleFiles(copyResult: MavenCopyCommandsResult?): ZipCreationResult { val root = configurationFile?.parent val sourceFolder = File(root?.path) - val buildLogBuilder = StringBuilder("Starting Build Log...\n") val depDirectory = if (copyResult is MavenCopyCommandsResult.Success) { showTransformationHub() copyResult.dependencyDirectory @@ -248,6 +245,9 @@ data class CodeModernizerSessionContext( ) ) } + if (customDependencyVersionsFile != null) { + manifest.dependencyUpgradeConfigFile = CUSTOM_DEPENDENCY_VERSIONS_FILE_PATH + } mapper.writeValueAsString(manifest) .byteInputStream() .use { @@ -258,14 +258,13 @@ data class CodeModernizerSessionContext( if (depDirectory != null) { dependencyFiles.forEach { depFile -> val relativePath = File(depFile.path).relativeTo(depDirectory) - val paddedPath = depSources.resolve(relativePath) - var paddedPathString = paddedPath.toPath().toString() + var relativePathString = relativePath.toPath().toString() // Convert Windows file path to work on Linux if (File.separatorChar != '/') { - paddedPathString = paddedPathString.replace('\\', '/') + relativePathString = relativePathString.replace('\\', '/') } depFile.inputStream().use { - zip.putNextEntry(paddedPathString, it) + zip.putNextEntry(relativePathString, it) } } } @@ -273,10 +272,13 @@ data class CodeModernizerSessionContext( LOG.info { "Dependency files size = ${dependencyFiles.sumOf { it.length().toInt() }}" } // 3) Custom YAML file - // TODO: where to put this? VS Code puts it in custom-upgrades/dependency-versions.yaml; here we put it at the root if (customDependencyVersionsFile != null) { + var yamlPath = "$ZIP_SOURCES_PATH/$CUSTOM_DEPENDENCY_VERSIONS_FILE_PATH" + if (File.separatorChar != '/') { + yamlPath = yamlPath.replace('\\', '/') + } customDependencyVersionsFile?.inputStream?.use { - zip.putNextEntry(Path(CUSTOM_DEPENDENCY_VERSIONS_FILE_PATH).toString(), it) + zip.putNextEntry(yamlPath, it) } } @@ -285,7 +287,6 @@ data class CodeModernizerSessionContext( val relativePath = File(file.path).relativeTo(sourceFolder) val paddedPath = zipSources.resolve(relativePath) var paddedPathString = paddedPath.toPath().toString() - // Convert Windows file path to work on Linux if (File.separatorChar != '/') { paddedPathString = paddedPathString.replace('\\', '/') } @@ -300,11 +301,6 @@ data class CodeModernizerSessionContext( } LOG.info { "Source code files size = ${files?.sumOf { it.length.toInt() }}" } - - // 5) Initial Maven copy-deps / install build log - buildLogBuilder.toString().byteInputStream().use { - zip.putNextEntry(Path(BUILD_LOG_PATH).toString(), it) - } }.toFile() // depDirectory should never be null if (depDirectory != null) ZipCreationResult.Succeeded(outputFile) else ZipCreationResult.Missing1P(outputFile) diff --git a/plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/model/ZipManifest.kt b/plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/model/ZipManifest.kt index e65b08f7e1..4d131eda2f 100644 --- a/plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/model/ZipManifest.kt +++ b/plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/model/ZipManifest.kt @@ -3,17 +3,15 @@ package software.aws.toolkits.jetbrains.services.codemodernizer.model -// TODO: include custom yaml file path in manifest.json? data class ZipManifest( val sourcesRoot: String = ZIP_SOURCES_PATH, val dependenciesRoot: String = ZIP_DEPENDENCIES_PATH, - val buildLogs: String = BUILD_LOG_PATH, val version: String = UPLOAD_ZIP_MANIFEST_VERSION, val hilCapabilities: List = listOf(HIL_1P_UPGRADE_CAPABILITY), - // TODO: add CLIENT_SIDE_BUILD to transformCapabilities when releasing CSB - val transformCapabilities: List = listOf(EXPLAINABILITY_V1), + val transformCapabilities: List = listOf(EXPLAINABILITY_V1, CLIENT_SIDE_BUILD), val customBuildCommand: String = MAVEN_BUILD_RUN_UNIT_TESTS, val requestedConversions: RequestedConversions? = null, // only used for SQL conversions for now + var dependencyUpgradeConfigFile: String? = null, ) data class RequestedConversions( diff --git a/plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/utils/CodeTransformApiUtils.kt b/plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/utils/CodeTransformApiUtils.kt index 6495508328..75c3f2c3d7 100644 --- a/plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/utils/CodeTransformApiUtils.kt +++ b/plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/utils/CodeTransformApiUtils.kt @@ -66,8 +66,6 @@ data class PollingResult( val transformationPlan: TransformationPlan?, ) -private const val IS_CLIENT_SIDE_BUILD_ENABLED = false - /** * Wrapper around [waitUntil] that polls the API DescribeMigrationJob to check the migration job status. */ @@ -121,8 +119,7 @@ suspend fun JobId.pollTransformationStatusAndPlan( delay(sleepDurationMillis) newPlan = clientAdaptor.getCodeModernizationPlan(this).transformationPlan() } - // TODO: remove flag when releasing CSB - if (IS_CLIENT_SIDE_BUILD_ENABLED && newStatus == TransformationStatus.TRANSFORMING && newPlan != null) { + if (newStatus == TransformationStatus.TRANSFORMING && newPlan != null) { attemptLocalBuild(newPlan, this, project) } if (newStatus != state) { @@ -229,6 +226,7 @@ suspend fun processClientInstructions(clientInstructionsPath: Path, jobId: JobId "Error applying intermediate diff.patch for job ${jobId.id} and artifact $artifactId located at " + "$clientInstructionsPath: $e" } + throw e } finally { runWriteAction { ModuleManager.getInstance(project).disposeModule(tempModule) @@ -249,10 +247,14 @@ suspend fun processClientInstructions(clientInstructionsPath: Path, jobId: JobId CodeModernizerManager.getInstance(project).codeTransformationSession?.uploadPayload(uploadZip, uploadContext) getLogger().info { "Upload succeeded; about to call ResumeTransformation for job ${jobId.id} and artifact $artifactId now" } CodeModernizerManager.getInstance(project).codeTransformationSession?.resumeTransformation() + getLogger().info { "ResumeTransformation succeeded for job ${jobId.id}" } + } catch (e: Exception) { + getLogger().error { "Upload / resume job failed for job ${jobId.id} and artifact $artifactId: $e" } + throw e } finally { uploadZip.deleteRecursively() copyOfProjectSources.toFile().deleteRecursively() - getLogger().info { "Deleted copy of project sources and client-side build upload ZIP" } + getLogger().info { "Deleted uploadZip and copyOfProjectSources" } } // switch back to Transformation Hub view runInEdt { @@ -267,6 +269,7 @@ suspend fun downloadClientInstructions(jobId: JobId, artifactId: String, project val downloadBytes = client.downloadExportResultArchive(jobId, artifactId) val downloadZipPath = zipToPath(downloadBytes, exportZipPath.toPath()).first.toAbsolutePath() unzipFile(downloadZipPath, exportZipPath.toPath()) + downloadZipPath.toFile().deleteRecursively() return exportZipPath.toPath().resolve("diff.patch") } diff --git a/plugins/amazonq/codetransform/jetbrains-community/tst/software/aws/toolkits/jetbrains/services/codemodernizer/CodeWhispererCodeModernizerSessionTest.kt b/plugins/amazonq/codetransform/jetbrains-community/tst/software/aws/toolkits/jetbrains/services/codemodernizer/CodeWhispererCodeModernizerSessionTest.kt index 72fef62a11..5e4916453a 100644 --- a/plugins/amazonq/codetransform/jetbrains-community/tst/software/aws/toolkits/jetbrains/services/codemodernizer/CodeWhispererCodeModernizerSessionTest.kt +++ b/plugins/amazonq/codetransform/jetbrains-community/tst/software/aws/toolkits/jetbrains/services/codemodernizer/CodeWhispererCodeModernizerSessionTest.kt @@ -166,12 +166,11 @@ class CodeWhispererCodeModernizerSessionTest : CodeWhispererCodeModernizerTestBa assertThat(fileContent).contains(MAVEN_BUILD_SKIP_UNIT_TESTS) } Path("sources/src/tmp.txt") -> assertThat(fileContent).isEqualTo(fileText) - Path("build-logs.txt") -> assertThat(fileContent).isNotNull() else -> fail("Unexpected entry in zip file: $entry") } } zipFile.close() - assert(numEntries == 3) + assert(numEntries == 2) } } @@ -205,7 +204,6 @@ class CodeWhispererCodeModernizerSessionTest : CodeWhispererCodeModernizerTestBa Path("manifest.json") -> assertThat(fileContent).isNotNull() Path("sources/src/tmp.java") -> assertThat(fileContent).isEqualTo(fileText) Path("sources/pom.xml") -> assertThat(fileContent).isEqualTo(fileText) - Path("build-logs.txt") -> assertThat(fileContent).isNotNull() else -> fail("Unexpected entry in zip file: $entry") } } @@ -242,7 +240,6 @@ class CodeWhispererCodeModernizerSessionTest : CodeWhispererCodeModernizerTestBa Path("manifest.json") -> assertThat(fileContent).isNotNull() Path("sources/src/tmp.java") -> assertThat(fileContent).isEqualTo(fileText) Path("sources/pom.xml") -> assertThat(fileContent).isEqualTo(fileText) - Path("build-logs.txt") -> assertThat(fileContent).isNotNull() else -> fail("Unexpected entry in zip file: $entry") } } @@ -282,7 +279,6 @@ class CodeWhispererCodeModernizerSessionTest : CodeWhispererCodeModernizerTestBa Path("sources/pom.xml") -> assertThat(fileContent).isEqualTo("pom.xml") Path("sources/someModule/src/helloworld.java") -> assertThat(fileContent).isEqualTo("someModule/src/helloworld.java") Path("sources/someModule/pom.xml") -> assertThat(fileContent).isEqualTo("someModule/pom.xml") - Path("build-logs.txt") -> assertThat(fileContent).isNotNull() else -> fail("Unexpected entry in zip file: $entry") } } @@ -322,7 +318,6 @@ class CodeWhispererCodeModernizerSessionTest : CodeWhispererCodeModernizerTestBa Path("sources/pom.xml") -> assertThat(fileContent).isEqualTo("pom.xml") Path("sources/someModule/src/helloworld.java") -> assertThat(fileContent).isEqualTo("someModule\\src\\helloworld.java") Path("sources/someModule/pom.xml") -> assertThat(fileContent).isEqualTo("someModule\\pom.xml") - Path("build-logs.txt") -> assertThat(fileContent).isNotNull() else -> fail("Unexpected entry in zip file: $entry") } } @@ -360,7 +355,6 @@ class CodeWhispererCodeModernizerSessionTest : CodeWhispererCodeModernizerTestBa Path("sources/pom.xml") -> assertThat(fileContent).isEqualTo("pom.xml") Path("sources/src/tmp.java") -> assertThat(fileContent).isEqualTo("src/tmp.java") Path("sources/someModule/pom.xml") -> assertThat(fileContent).isEqualTo("someModule/pom.xml") - Path("build-logs.txt") -> assertThat(fileContent).isNotNull() else -> throw AssertionError("Unexpected entry in zip file: $entry") } } diff --git a/plugins/amazonq/codetransform/jetbrains-community/tst/software/aws/toolkits/jetbrains/services/codemodernizer/CodeWhispererCodeModernizerUtilsTest.kt b/plugins/amazonq/codetransform/jetbrains-community/tst/software/aws/toolkits/jetbrains/services/codemodernizer/CodeWhispererCodeModernizerUtilsTest.kt index 3748266943..e1319dcf81 100644 --- a/plugins/amazonq/codetransform/jetbrains-community/tst/software/aws/toolkits/jetbrains/services/codemodernizer/CodeWhispererCodeModernizerUtilsTest.kt +++ b/plugins/amazonq/codetransform/jetbrains-community/tst/software/aws/toolkits/jetbrains/services/codemodernizer/CodeWhispererCodeModernizerUtilsTest.kt @@ -329,7 +329,7 @@ class CodeWhispererCodeModernizerUtilsTest : CodeWhispererCodeModernizerTestBase @Test fun `WHEN validateCustomVersionsFile on fully valid yaml file THEN passes validation`() { - val sampleFileContents = """name: "custom-dependency-management" + val sampleFileContents = """name: "dependency-upgrade" description: "Custom dependency version management for Java migration from JDK 8/11/17 to JDK 17/21" dependencyManagement: dependencies: @@ -338,7 +338,7 @@ dependencyManagement: versionProperty: "library1.version" originType: "FIRST_PARTY" plugins: - - identifier: "com.example.plugin" + - identifier: "com.example:plugin" targetVersion: "1.2.0" versionProperty: "plugin.version" """.trimIndent() @@ -350,7 +350,7 @@ dependencyManagement: @Test fun `WHEN validateCustomVersionsFile on invalid yaml file THEN fails validation`() { - val sampleFileContents = """name: "custom-dependency-management" + val sampleFileContents = """name: "dependency-upgrade" description: "Custom dependency version management for Java migration from JDK 8/11/17 to JDK 17/21" invalidKey: dependencies: @@ -359,7 +359,7 @@ invalidKey: versionProperty: "library1.version" originType: "FIRST_PARTY" plugins: - - identifier: "com.example.plugin" + - identifier: "com.example:plugin" targetVersion: "1.2.0" versionProperty: "plugin.version" """.trimIndent() @@ -371,7 +371,7 @@ invalidKey: @Test fun `WHEN validateCustomVersionsFile on non-yaml file THEN fails validation`() { - val sampleFileContents = """name: "custom-dependency-management" + val sampleFileContents = """name: "dependency-upgrade" description: "Custom dependency version management for Java migration from JDK 8/11/17 to JDK 17/21" dependencyManagement: dependencies: @@ -380,7 +380,7 @@ dependencyManagement: versionProperty: "library1.version" originType: "FIRST_PARTY" plugins: - - identifier: "com.example.plugin" + - identifier: "com.example:plugin" targetVersion: "1.2.0" versionProperty: "plugin.version" """.trimIndent() diff --git a/plugins/amazonq/contrib/QCT-Maven.jar b/plugins/amazonq/contrib/QCT-Maven.jar new file mode 100644 index 0000000000..1d134b2918 Binary files /dev/null and b/plugins/amazonq/contrib/QCT-Maven.jar differ diff --git a/plugins/core/resources/resources/software/aws/toolkits/resources/MessagesBundle.properties b/plugins/core/resources/resources/software/aws/toolkits/resources/MessagesBundle.properties index 3720c69650..7367b74173 100644 --- a/plugins/core/resources/resources/software/aws/toolkits/resources/MessagesBundle.properties +++ b/plugins/core/resources/resources/software/aws/toolkits/resources/MessagesBundle.properties @@ -670,7 +670,7 @@ codemodernizer.chat.message.hil.start_message=I was not able to upgrade all depe codemodernizer.chat.message.hil.trying_resume=Trying to resume transformation with your selected version. codemodernizer.chat.message.hil.user_rejected=I'll continue upgrading your module. When I'm done, you can review the dependency error in the Transformation summary. codemodernizer.chat.message.local_build_begin=I'm building your module. This can take up to 10 minutes, depending on the size of your module. -codemodernizer.chat.message.local_build_failed=Sorry, I couldn't run the Maven clean install command to build your module. +codemodernizer.chat.message.local_build_failed=Sorry, I couldn't run the Maven clean test-compile command to build your module. codemodernizer.chat.message.local_build_success=I was able to build your module and will start uploading your code. codemodernizer.chat.message.one_or_multiple_diffs=If you would like to update and test your code with fewer changes at a time, I can divide the transformation results into separate diff patches. If applicable to your application, I can split up the diffs up into the following groups of upgrades. Here are the upgrades included in each diff:\n\n\ - Minimal Compatible Library Upgrade to Java {0}: Dependencies to the minimum compatible versions in Java {0}, including Springboot, JUnit, and PowerMockito.\n\n\ - Popular Enterprise Specifications Application Frameworks: Popular enterprise and application frameworks like Jakarta EE, Hibernate, and Micronaut 3.\n\n\ - HTTP Client Utilities Web Frameworks: HTTP client libraries, Apache Commons utilities, and Struts frameworks.\n\n\ - Testing Tools Frameworks: Testing tools like ArchUnit, Mockito, and TestContainers and build tools like Jenkins and Maven Wrapper.\n\n\ - Miscellaneous Processing Documentation: Diverse set spanning ORMs, XML processing, and API documentation like Swagger to SpringDoc/OpenAPI.\n\n\ - Deprecated API replacement, dependency upgrades, and formatting: Replaces deprecated APIs, makes additional dependency version upgrades, and formats code changes. codemodernizer.chat.message.one_or_multiple_diffs_form.multiple_diffs=Multiple diffs @@ -686,7 +686,7 @@ codemodernizer.chat.message.result.success=I successfully completed your transfo codemodernizer.chat.message.result.success.multiple_diffs=I successfully completed your transformation. You will be able to accept changes from one diff at a time. If you reject changes in one diff, you will not be able to view or accept changes in the other diffs. The transformation summary has details about the changes I'm proposing. codemodernizer.chat.message.result.zip_too_large=Sorry, your project size exceeds the Amazon Q Code Transformation upload limit of 2GB. codemodernizer.chat.message.resume_ongoing=I'm still transforming your code. It can take 10 to 30 minutes to upgrade your code, depending on the size of your module. To monitor progress, go to the Transformation Hub. -codemodernizer.chat.message.skip_tests=I will build your project using `mvn clean test` by default. If you would like me to build your project without running unit tests, I will use `mvn clean test-compile`. +codemodernizer.chat.message.skip_tests=I will build generated code in your local environment, not on the server side. For information on how I scan code to reduce security risks associated with building the code in your local environment, see the [Amazon Q Developer documentation](https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/code-transformation.html#java-local-builds).\n\nI will build your project using `mvn clean test` by default. If you would like me to build your project without running unit tests, I will use `mvn clean test-compile`. codemodernizer.chat.message.skip_tests_form.response=Okay, I will {0} when building your module. codemodernizer.chat.message.skip_tests_form.run_tests=Run unit tests codemodernizer.chat.message.skip_tests_form.skip=Skip unit tests @@ -791,7 +791,7 @@ codemodernizer.notification.warn.expired_credentials.title=Your connection to Q codemodernizer.notification.warn.invalid_project.description.reason.missing_content_roots=None of your open modules are supported for code transformation with Amazon Q. Amazon Q can upgrade Java 8, Java 11, Java 17, and Java 21 projects built on Maven, with content roots configured. codemodernizer.notification.warn.invalid_project.description.reason.not_logged_in=Amazon Q cannot start the transformation as you are not logged in with Identity Center or Builder ID. Also ensure that you are not using IntelliJ version 232.8660.185 and that you are not developing on a remote host (uncommon). codemodernizer.notification.warn.invalid_project.description.reason.remote_backend=None of your open modules are supported for code transformation with Amazon Q. Amazon Q cannot transform modules running on a remote host. -codemodernizer.notification.warn.maven_failed.content=Amazon Q could not run the Maven clean install command to build your module. +codemodernizer.notification.warn.maven_failed.content=Amazon Q could not run the Maven clean test-compile command to build your module. codemodernizer.notification.warn.maven_failed.title=Amazon Q Code Transform unable to zip dependencies codemodernizer.notification.warn.on_resume.unknown_status_response.content=We received data from Amazon Q in a format that the plugin cannot handle. You may need to update the plugin and then try again. codemodernizer.notification.warn.on_resume.unknown_status_response.title=Unable to resume job diff --git a/ui-tests-starter/tst-243+/software/aws/toolkits/jetbrains/uitests/transformTests/TransformChatTest.kt b/ui-tests-starter/tst-243+/software/aws/toolkits/jetbrains/uitests/transformTests/TransformChatTest.kt index 82951c2273..1735055b0b 100644 --- a/ui-tests-starter/tst-243+/software/aws/toolkits/jetbrains/uitests/transformTests/TransformChatTest.kt +++ b/ui-tests-starter/tst-243+/software/aws/toolkits/jetbrains/uitests/transformTests/TransformChatTest.kt @@ -81,7 +81,6 @@ async function testNavigation() { const button = document.querySelector('button[action-id="codetransform-input-confirm-one-or-multiple-diffs"]') button.click() }) -/* const selectCustomVersionsForm = await page.waitForSelector('button[action-id="codetransform-input-confirm-custom-dependency-versions"]', { timeout: 5000 }) @@ -98,11 +97,6 @@ async function testNavigation() { const errorMessage = await page.waitForSelector('text/I could not find "dummy-target-jdk-name-here" in File > Project Structure > Platform Settings > SDKs.', { timeout: 5000 }) -*/ - // TODO: delete errorMessage below, and uncomment the above when releasing CSB - const errorMessage = await page.waitForSelector('text/Sorry, I couldn\'t run the Maven clean install command', { - timeout: 5000 - }) console.log('Error message:', await errorMessage.evaluate(el => el.textContent)) } } finally { @@ -166,10 +160,8 @@ class TransformChatTest { "Choose the target code version", "Skip tests form appeared: true", "One or multiple diffs form appeared: true", - "couldn't run the Maven clean install command" - // TODO: delete line above, and uncomment lines below when releasing CSB - // "I could not find \"dummy-target-jdk-name-here\"", - // "Custom dependency versions file form appeared: true", + "I could not find \"dummy-target-jdk-name-here\"", + "Custom dependency versions file form appeared: true", ) } }