Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
Expand Up @@ -73,6 +73,7 @@ import javax.net.ssl.SSLHandshakeException

const val MAX_ZIP_SIZE = 2000000000 // 2GB
const val EXPLAINABILITY_V1 = "EXPLAINABILITY_V1"
const val SELECTIVE_TRANSFORMATION_V2 = "SELECTIVE_TRANSFORMATION_V2"

// constants for handling SDKClientException
const val CONNECTION_REFUSED_ERROR: String = "Connection refused"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ fun buildTransformResumingChatContent() = CodeTransformChatMessageContent(
type = CodeTransformChatMessageType.PendingAnswer,
)

fun buildTransformResultChatContent(result: CodeModernizerJobCompletedResult): CodeTransformChatMessageContent {
fun buildTransformResultChatContent(result: CodeModernizerJobCompletedResult, targetJdkVersion: String = ""): CodeTransformChatMessageContent {
val resultMessage = when (result) {
is CodeModernizerJobCompletedResult.JobAbortedZipTooLarge -> {
"${message(
Expand All @@ -568,7 +568,7 @@ fun buildTransformResultChatContent(result: CodeModernizerJobCompletedResult): C
buildZipUploadFailedChatMessage(result.failureReason)
}
is CodeModernizerJobCompletedResult.JobCompletedSuccessfully -> {
message("codemodernizer.chat.message.result.success")
message("codemodernizer.chat.message.result.success", targetJdkVersion)
}
is CodeModernizerJobCompletedResult.JobPartiallySucceeded -> {
message("codemodernizer.chat.message.result.partially_success")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import software.aws.toolkits.jetbrains.services.codemodernizer.CodeTransformTele
import software.aws.toolkits.jetbrains.services.codemodernizer.EXPLAINABILITY_V1
import software.aws.toolkits.jetbrains.services.codemodernizer.HilTelemetryMetaData
import software.aws.toolkits.jetbrains.services.codemodernizer.InboundAppMessagesHandler
import software.aws.toolkits.jetbrains.services.codemodernizer.SELECTIVE_TRANSFORMATION_V2
import software.aws.toolkits.jetbrains.services.codemodernizer.client.GumbyClient
import software.aws.toolkits.jetbrains.services.codemodernizer.commands.CodeTransformActionMessage
import software.aws.toolkits.jetbrains.services.codemodernizer.commands.CodeTransformCommand
Expand Down Expand Up @@ -415,7 +416,7 @@ class CodeTransformChatController(
it.sessionContext.customBuildCommand = customBuildCommand
}
// TODO: add CLIENT_SIDE_BUILD below when releasing CSB
val transformCapabilities = listOf(EXPLAINABILITY_V1)
val transformCapabilities = listOf(EXPLAINABILITY_V1, SELECTIVE_TRANSFORMATION_V2)
codeModernizerManager.codeTransformationSession?.let {
it.sessionContext.transformCapabilities = transformCapabilities
codeModernizerManager.runLocalMavenBuild(context.project, it)
Expand Down Expand Up @@ -476,7 +477,7 @@ dependencyManagement:
- identifier: "com.example:library1"
targetVersion: "2.1.0"
versionProperty: "library1.version" # Optional
originType: "FIRST_PARTY" # or "THIRD_PARTY" # Optional
originType: "FIRST_PARTY" # or "THIRD_PARTY"
- identifier: "com.example:library2"
targetVersion: "3.0.0"
originType: "THIRD_PARTY"
Expand Down Expand Up @@ -797,7 +798,10 @@ dependencyManagement:
is DownloadArtifactResult.Success -> {
if (downloadResult.artifact !is CodeModernizerArtifact) return artifactHandler.notifyUnableToApplyPatch("")
codeTransformChatHelper.updateLastPendingMessage(
buildTransformResultChatContent(result)
buildTransformResultChatContent(
result,
codeModernizerManager.codeTransformationSession?.sessionContext?.targetJavaVersion.toString()
)
)
}
is DownloadArtifactResult.DownloadFailure -> artifactHandler.notifyUnableToDownload(downloadResult.failureReason)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const val CUSTOM_DEPENDENCY_VERSIONS_FILE_PATH = "custom-upgrades.yaml"
const val UPLOAD_ZIP_MANIFEST_VERSION = "1.0"
const val HIL_1P_UPGRADE_CAPABILITY = "HIL_1pDependency_VersionUpgrade"
const val EXPLAINABILITY_V1 = "EXPLAINABILITY_V1"
const val SELECTIVE_TRANSFORMATION_V2 = "SELECTIVE_TRANSFORMATION_V2"
const val CLIENT_SIDE_BUILD = "CLIENT_SIDE_BUILD"
const val MAVEN_CONFIGURATION_FILE_NAME = "pom.xml"
const val MAVEN_BUILD_RUN_UNIT_TESTS = "clean test"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ data class ZipManifest(
val version: String = UPLOAD_ZIP_MANIFEST_VERSION,
val hilCapabilities: List<String> = listOf(HIL_1P_UPGRADE_CAPABILITY),
// TODO: add CLIENT_SIDE_BUILD to transformCapabilities when releasing CSB
// TODO: add AGENTIC_PLAN_V1 or something here AND in processCodeTransformSkipTests when backend allowlists everyone
val transformCapabilities: List<String> = listOf(EXPLAINABILITY_V1),
val transformCapabilities: List<String> = listOf(EXPLAINABILITY_V1, SELECTIVE_TRANSFORMATION_V2),
val noInteractiveMode: Boolean = true,
val customBuildCommand: String = MAVEN_BUILD_RUN_UNIT_TESTS,
val requestedConversions: RequestedConversions? = null, // only used for SQL conversions for now
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class CodeWhispererCodeModernizerSessionTest : CodeWhispererCodeModernizerTestBa
root.children[0],
JavaSdkVersion.JDK_1_8,
JavaSdkVersion.JDK_11,
listOf(EXPLAINABILITY_V1),
listOf(EXPLAINABILITY_V1, SELECTIVE_TRANSFORMATION_V2),
MAVEN_BUILD_SKIP_UNIT_TESTS
)
val mockFile = mock(File::class.java)
Expand All @@ -164,6 +164,8 @@ class CodeWhispererCodeModernizerSessionTest : CodeWhispererCodeModernizerTestBa
Path("manifest.json") -> {
assertThat(fileContent).isNotNull()
assertThat(fileContent).contains(MAVEN_BUILD_SKIP_UNIT_TESTS)
assertThat(fileContent).contains(SELECTIVE_TRANSFORMATION_V2)
assertThat(fileContent).contains("\"noInteractiveMode\":true")
}
Path("sources/src/tmp.txt") -> assertThat(fileContent).isEqualTo(fileText)
Path("build-logs.txt") -> assertThat(fileContent).isNotNull()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ codemodernizer.chat.message.result.fail_initial_build=I am having trouble buildi
codemodernizer.chat.message.result.fail_initial_build_no_build_log=I am having trouble building your project in the secure build environment: {0}.
codemodernizer.chat.message.result.fail_with_known_reason=Sorry, I couldn''t complete the transformation. {0}
codemodernizer.chat.message.result.partially_success=I transformed part of your code. You can review the diff to see my proposed changes and accept or reject them. The transformation summary has details about the files I updated and the errors that prevented a complete transformation.
codemodernizer.chat.message.result.success=I successfully completed your transformation. You can review the diff to see my proposed changes and accept or reject them. The transformation summary has details about the changes I'm proposing.
codemodernizer.chat.message.result.success=I successfully completed your transformation. You can review the diff to see my proposed changes and accept or reject them. The transformation summary has details about the changes I am proposing. If you want to upgrade additional libraries and other dependencies, run /transform with the transformed code and specify {0} as the source and target version.
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`.
Expand Down
Loading