Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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" : "/transform: skip running tests locally when user chooses to do so"
}
Original file line number Diff line number Diff line change
Expand Up @@ -204,14 +204,14 @@ private val selectSkipTestsFlagFormItem = FormItem(
title = message("codemodernizer.chat.form.user_selection.item.choose_skip_tests_option"),
mandatory = true,
options = listOf(
FormItemOption(
label = message("codemodernizer.chat.message.skip_tests_form.skip"),
value = message("codemodernizer.chat.message.skip_tests_form.skip"),
),
FormItemOption(
label = message("codemodernizer.chat.message.skip_tests_form.run_tests"),
value = message("codemodernizer.chat.message.skip_tests_form.run_tests"),
),
FormItemOption(
label = message("codemodernizer.chat.message.skip_tests_form.skip"),
value = message("codemodernizer.chat.message.skip_tests_form.skip"),
)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just switch the order of these 2 options so that "skip tests" is the default

)
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ class CodeTransformChatController(
else -> {
if (result is CodeModernizerJobCompletedResult.ZipUploadFailed && result.failureReason is UploadFailureReason.CREDENTIALS_EXPIRED) {
return
} else {
} else if (CodeModernizerSessionState.getInstance(context.project).currentJobId != null) {
val downloadResult = artifactHandler.downloadArtifact(
CodeModernizerSessionState.getInstance(context.project).currentJobId as JobId,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Before attempting download, make sure that a job ID exists (job may not have started otherwise, so nothing to download)

TransformationDownloadArtifactType.CLIENT_INSTRUCTIONS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ fun runHilMavenCopyDependency(
return MavenCopyCommandsResult.Success(destinationDir)
}

fun runMavenCopyCommands(sourceFolder: File, buildlogBuilder: StringBuilder, logger: Logger, project: Project): MavenCopyCommandsResult {
fun runMavenCopyCommands(sourceFolder: File, buildlogBuilder: 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)
Expand Down Expand Up @@ -112,7 +112,7 @@ fun runMavenCopyCommands(sourceFolder: File, buildlogBuilder: StringBuilder, log
}

// Run install
val installRunnable = runMavenInstall(sourceFolder, buildlogBuilder, mvnSettings, transformMvnRunner, logger, destinationDir)
val installRunnable = runMavenInstall(sourceFolder, buildlogBuilder, mvnSettings, transformMvnRunner, logger, destinationDir, shouldSkipTests)
installRunnable.await()
buildlogBuilder.appendLine(installRunnable.getOutput())
if (installRunnable.isComplete()) {
Expand Down Expand Up @@ -217,13 +217,16 @@ private fun runMavenInstall(
transformMavenRunner: TransformMavenRunner,
logger: Logger,
destinationDir: Path,
shouldSkipTests: Boolean,
): TransformRunnable {
buildlogBuilder.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(
false,
sourceFolder.absolutePath,
null,
listOf("-Dmaven.repo.local=$destinationDir", "install"),
flags,
emptyList<String>(),
null
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,10 @@ data class CodeModernizerSessionContext(
return excluded
}

fun executeMavenCopyCommands(sourceFolder: File, buildLogBuilder: StringBuilder) = runMavenCopyCommands(sourceFolder, buildLogBuilder, LOG, project)
fun executeMavenCopyCommands(sourceFolder: File, buildLogBuilder: StringBuilder): MavenCopyCommandsResult {
val shouldSkipTests = customBuildCommand == MAVEN_BUILD_SKIP_UNIT_TESTS
return runMavenCopyCommands(sourceFolder, buildLogBuilder, LOG, project, shouldSkipTests)
}

private fun executeHilMavenCopyDependency(sourceFolder: File, destinationFolder: File, buildLogBuilder: StringBuilder) = runHilMavenCopyDependency(
sourceFolder,
Expand Down
Loading