From 58bf5adb9afc8cca8240c5cab96335a5d1eefb1c Mon Sep 17 00:00:00 2001 From: Ting-Yuan Huang Date: Wed, 13 Nov 2024 13:28:45 -0800 Subject: [PATCH] KSP2 command line tool: exit with exit code --- .../main/kotlin/com/google/devtools/ksp/cmdline/KSPJvmMain.kt | 4 +++- .../com/google/devtools/ksp/impl/KotlinSymbolProcessing.kt | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/kotlin-analysis-api/src/main/kotlin/com/google/devtools/ksp/cmdline/KSPJvmMain.kt b/kotlin-analysis-api/src/main/kotlin/com/google/devtools/ksp/cmdline/KSPJvmMain.kt index a3672f79bd..871391c9a3 100644 --- a/kotlin-analysis-api/src/main/kotlin/com/google/devtools/ksp/cmdline/KSPJvmMain.kt +++ b/kotlin-analysis-api/src/main/kotlin/com/google/devtools/ksp/cmdline/KSPJvmMain.kt @@ -6,6 +6,7 @@ import com.google.devtools.ksp.processing.KspGradleLogger import com.google.devtools.ksp.processing.SymbolProcessorProvider import com.google.devtools.ksp.processing.kspJvmArgParser import com.google.devtools.ksp.processing.kspJvmArgParserHelp +import kotlin.system.exitProcess import java.io.File import java.net.URLClassLoader import java.util.ServiceLoader @@ -45,5 +46,6 @@ internal fun runWithArgs(args: Array, parse: (Array) -> Pair - KotlinSymbolProcessing(config, processorProviders, logger).execute() + val exitCode = KotlinSymbolProcessing(config, processorProviders, logger).execute() + exitProcess(exitCode.code) } diff --git a/kotlin-analysis-api/src/main/kotlin/com/google/devtools/ksp/impl/KotlinSymbolProcessing.kt b/kotlin-analysis-api/src/main/kotlin/com/google/devtools/ksp/impl/KotlinSymbolProcessing.kt index b226345d07..083d4fcda3 100644 --- a/kotlin-analysis-api/src/main/kotlin/com/google/devtools/ksp/impl/KotlinSymbolProcessing.kt +++ b/kotlin-analysis-api/src/main/kotlin/com/google/devtools/ksp/impl/KotlinSymbolProcessing.kt @@ -126,7 +126,7 @@ class KotlinSymbolProcessing( val logger: KSPLogger ) { enum class ExitCode( - @Suppress("UNUSED_PARAMETER") code: Int + val code: Int ) { OK(0),