[K/N] CInterop ExceptionPrettifier

Add a wrapper around cinterop invocation that tracks exceptions.
Wrapper has a set of handlers. Each handler checks exception for some
pattern and if it matches, throws another exception with a more
user-friendly message.
The first such case is compilation error due to missing -fmodules flag.
This commit is contained in:
Sergey Bogolepov
2022-12-06 14:47:43 +02:00
committed by Space Team
parent 256764f012
commit 233b01f341
4 changed files with 95 additions and 5 deletions
@@ -0,0 +1,20 @@
/*
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.konan.util
// We store pretty cinterop messages because we want to access them in test infra as well.
object CInteropHints {
// It would be nice to mark this property as const when `trimIndent` becomes constexpr.
val fmodulesHint = """
It seems that library is using clang modules. Try adding `-compiler-option -fmodules` to cinterop.
For example, in case of cocoapods plugin:
pod("PodName") {
// Add these lines
extraOpts += listOf("-compiler-option", "-fmodules")
}
""".trimIndent()
}