From 7ecd1d8c41ca7841cc1f17fa0a818ce459f0ebf2 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 (cherry picked from commit e0154eac29cb883011a708c49dc6673902299b19) --- .../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..24a131aad2 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 @@ -9,6 +9,7 @@ import com.google.devtools.ksp.processing.kspJvmArgParserHelp import java.io.File import java.net.URLClassLoader import java.util.ServiceLoader +import kotlin.system.exitProcess class KSPJvmMain { companion object { @@ -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),