[K/N] Disable debug info in runtime by default

Bundle grows 200mb if debug info is enabled, it's too much.
But probably, this can be useful for debug, so we need gradle option.
This commit is contained in:
Pavel Kunyavskiy
2021-10-08 15:05:03 +03:00
committed by Space
parent 9a5058849e
commit 0bd4dbc0c1
4 changed files with 22 additions and 4 deletions
@@ -16,6 +16,8 @@ import org.jetbrains.kotlin.konan.target.KonanTarget
import org.jetbrains.kotlin.konan.target.SanitizerKind
import java.io.File
import javax.inject.Inject
import kotlinBuildProperties
import isNativeRuntimeDebugInfoEnabled
open class CompileToBitcode @Inject constructor(
@Internal val srcRoot: File,
@@ -85,7 +87,9 @@ open class CompileToBitcode @Inject constructor(
@get:Input
val compilerFlags: List<String>
get() {
val commonFlags = listOf("-gdwarf-2", "-c", "-emit-llvm") + headersDirs.map { "-I$it" }
val commonFlags = listOfNotNull(
"-gdwarf-2".takeIf { project.kotlinBuildProperties.isNativeRuntimeDebugInfoEnabled },
"-c", "-emit-llvm") + headersDirs.map { "-I$it" }
val sanitizerFlags = when (sanitizer) {
null -> listOf()
SanitizerKind.ADDRESS -> listOf("-fsanitize=address")