KT-58862: Remove cinterop -mode option
metadata cinterop libraries perform pretty well for years, so we can drop this flag.
This commit is contained in:
committed by
Space Team
parent
807e7f1c28
commit
d433d1eb3f
-6
@@ -53,8 +53,6 @@ open class CommonInteropArguments(val argParser: ArgParser) {
|
||||
.default("unspecified")
|
||||
val repo by argParser.option(ArgType.String, shortName = "r", description = "repository to resolve dependencies")
|
||||
.multiple()
|
||||
val mode by argParser.option(ArgType.Choice<GenerationMode>(), description = "the way interop library is generated")
|
||||
.default(DEFAULT_MODE)
|
||||
val nodefaultlibs by argParser.option(ArgType.Boolean, NODEFAULTLIBS,
|
||||
description = "don't link the libraries from dist/klib automatically").default(false)
|
||||
val nodefaultlibsDeprecated by argParser.option(ArgType.Boolean, NODEFAULTLIBS_DEPRECATED,
|
||||
@@ -76,10 +74,6 @@ open class CommonInteropArguments(val argParser: ArgParser) {
|
||||
fullName = "Xoverride-konan-properties",
|
||||
description = "Override konan.properties.values"
|
||||
).multiple().delimiter(";")
|
||||
|
||||
companion object {
|
||||
val DEFAULT_MODE = GenerationMode.METADATA
|
||||
}
|
||||
}
|
||||
|
||||
open class CInteropArguments(argParser: ArgParser =
|
||||
|
||||
+4
-12
@@ -291,17 +291,6 @@ private fun processCLib(
|
||||
|
||||
val outKtPkg = fqParts.joinToString(".")
|
||||
|
||||
val mode = run {
|
||||
val providedMode = cinteropArguments.mode
|
||||
|
||||
if (providedMode == GenerationMode.METADATA && flavor == KotlinPlatform.JVM) {
|
||||
warn("Metadata mode isn't supported for Kotlin/JVM! Falling back to sourcecode.")
|
||||
GenerationMode.SOURCE_CODE
|
||||
} else {
|
||||
providedMode
|
||||
}
|
||||
}
|
||||
|
||||
val resolver = getLibraryResolver(cinteropArguments, tool.target)
|
||||
|
||||
val allLibraryDependencies = when (flavor) {
|
||||
@@ -349,7 +338,10 @@ private fun processCLib(
|
||||
} else {
|
||||
{}
|
||||
}
|
||||
|
||||
val mode = when (flavor) {
|
||||
KotlinPlatform.JVM -> GenerationMode.SOURCE_CODE
|
||||
KotlinPlatform.NATIVE -> GenerationMode.METADATA
|
||||
}
|
||||
val stubIrContext = StubIrContext(logger, configuration, nativeIndex, imports, flavor, mode, libName, plugin)
|
||||
val stubIrOutput = run {
|
||||
val outKtFileCreator = {
|
||||
|
||||
-3
@@ -228,9 +228,6 @@ class NamedNativeInteropConfig implements Named {
|
||||
args '-natives', nativeLibsDir
|
||||
args '-Xtemporary-files-dir', temporaryFilesDir
|
||||
args '-flavor', this.flavor
|
||||
if (flavor == "jvm") {
|
||||
args '-mode', 'sourcecode'
|
||||
}
|
||||
// Uncomment to debug.
|
||||
// args '-verbose', 'true'
|
||||
|
||||
|
||||
+1
-12
@@ -16,9 +16,7 @@ import org.jetbrains.kotlin.konan.target.*
|
||||
import org.jetbrains.kotlin.konan.util.KonanHomeProvider
|
||||
import org.jetbrains.kotlin.konan.util.PlatformLibsInfo
|
||||
import org.jetbrains.kotlin.konan.util.visibleName
|
||||
import org.jetbrains.kotlin.native.interop.gen.jvm.GenerationMode
|
||||
import org.jetbrains.kotlin.native.interop.gen.jvm.parseKeyValuePairs
|
||||
import org.jetbrains.kotlin.native.interop.tool.CommonInteropArguments.Companion.DEFAULT_MODE
|
||||
import org.jetbrains.kotlin.native.interop.tool.SHORT_MODULE_NAME
|
||||
import java.io.PrintWriter
|
||||
import java.io.StringWriter
|
||||
@@ -66,7 +64,7 @@ private enum class CacheKind(val outputKind: CompilerOutputKind) {
|
||||
STATIC_CACHE(CompilerOutputKind.STATIC_CACHE)
|
||||
}
|
||||
|
||||
private class CInteropOptions(val mode: GenerationMode, val additionalArguments: List<String>)
|
||||
private class CInteropOptions(val additionalArguments: List<String>)
|
||||
|
||||
// TODO: Use Distribution's paths after compiler update.
|
||||
fun generatePlatformLibraries(args: Array<String>) = usingNativeMemoryAllocator {
|
||||
@@ -101,13 +99,6 @@ fun generatePlatformLibraries(args: Array<String>) = usingNativeMemoryAllocator
|
||||
val cacheDirectoryPath by argParser.option(
|
||||
ArgType.String, "cache-directory", "c", "Cache output directory")
|
||||
|
||||
val mode by argParser.option(
|
||||
ArgType.Choice<GenerationMode>(),
|
||||
fullName = "mode",
|
||||
shortName = "m",
|
||||
description = "The way interop library is generated."
|
||||
).default(DEFAULT_MODE)
|
||||
|
||||
val verbose by argParser.option(
|
||||
ArgType.Boolean,
|
||||
"verbose", "v",
|
||||
@@ -167,7 +158,6 @@ fun generatePlatformLibraries(args: Array<String>) = usingNativeMemoryAllocator
|
||||
}
|
||||
|
||||
val cinteropOptions = CInteropOptions(
|
||||
mode,
|
||||
additionalArguments = buildList {
|
||||
if (overrideKonanProperties.isNotEmpty()) {
|
||||
add("-Xoverride-konan-properties")
|
||||
@@ -270,7 +260,6 @@ private fun generateLibrary(
|
||||
"-compiler-option", "-fmodules-cache-path=${tmpDirectory.child("clangModulesCache").absolutePath}",
|
||||
"-repo", outputDirectory.absolutePath,
|
||||
"-no-default-libs", "-no-endorsed-libs", "-Xpurge-user-libs", "-nopack",
|
||||
"-mode", cinteropOptions.mode.modeName,
|
||||
*cinteropOptions.additionalArguments.toTypedArray(),
|
||||
"-$SHORT_MODULE_NAME", def.shortLibraryName,
|
||||
*def.depends.flatMap { listOf("-l", "$outputDirectory/${it.libraryName}") }.toTypedArray()
|
||||
|
||||
-14
@@ -173,20 +173,6 @@ class NativeDownloadAndPlatformLibsIT : BaseGradleIT() {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testSettingGenerationMode() = with(platformLibrariesProject("linuxX64")) {
|
||||
// Check that user can change generation mode used by the cinterop tool.
|
||||
buildWithLightDist("tasks", "-Pkotlin.native.platform.libraries.mode=metadata") {
|
||||
assertSuccessful()
|
||||
assertTrue(
|
||||
extractNativeCompilerCommandLineArguments(
|
||||
taskOutput = output,
|
||||
toolName = NativeToolKind.GENERATE_PLATFORM_LIBRARIES
|
||||
).containsSequentially("-mode", "metadata")
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testCompilerReinstallation() = with(platformLibrariesProject("linuxX64")) {
|
||||
// Install the compiler at the first time. Don't build to reduce execution time.
|
||||
|
||||
-4
@@ -73,7 +73,6 @@ data class BuildOptions(
|
||||
val cocoapodsArchs: String? = null,
|
||||
val distributionType: String? = null,
|
||||
val distributionDownloadFromMaven: Boolean? = null,
|
||||
val platformLibrariesMode: String? = null,
|
||||
val reinstall: Boolean? = null,
|
||||
val restrictedDistribution: Boolean? = null,
|
||||
val useXcodeMessageStyle: Boolean? = null,
|
||||
@@ -219,9 +218,6 @@ data class BuildOptions(
|
||||
nativeOptions.distributionType?.let {
|
||||
arguments.add("-Pkotlin.native.distribution.type=${it}")
|
||||
}
|
||||
nativeOptions.platformLibrariesMode?.let {
|
||||
arguments.add("-Pkotlin.native.platform.libraries.mode=${it}")
|
||||
}
|
||||
nativeOptions.reinstall?.let {
|
||||
arguments.add("-Pkotlin.native.reinstall=${it}")
|
||||
}
|
||||
|
||||
-7
@@ -303,13 +303,6 @@ internal class PropertiesProvider private constructor(private val project: Proje
|
||||
val nativeDownloadFromMaven: Boolean
|
||||
get() = this.booleanProperty("kotlin.native.distribution.downloadFromMaven") ?: false
|
||||
|
||||
/**
|
||||
* Allows a user to force a particular cinterop mode for platform libraries generation. Available modes: sourcecode, metadata.
|
||||
* A main purpose of this property is working around potential problems with the metadata mode.
|
||||
*/
|
||||
val nativePlatformLibrariesMode: String?
|
||||
get() = this.property("kotlin.native.platform.libraries.mode")
|
||||
|
||||
/**
|
||||
* Allows a user to provide a local Kotlin/Native distribution instead of a downloaded one.
|
||||
*/
|
||||
|
||||
-9
@@ -46,10 +46,6 @@ internal class PlatformLibrariesGenerator(val project: Project, val konanTarget:
|
||||
private val shouldBuildCaches: Boolean =
|
||||
konanPropertiesService.cacheWorksFor(konanTarget) && konanCacheKind != NativeCacheKind.NONE
|
||||
|
||||
private val mode: String? by lazy {
|
||||
PropertiesProvider(project).nativePlatformLibrariesMode
|
||||
}
|
||||
|
||||
private val presentDefs: Set<String> by lazy {
|
||||
defDirectory
|
||||
.listFiles { file -> file.extension == "def" }.orEmpty()
|
||||
@@ -126,11 +122,6 @@ internal class PlatformLibrariesGenerator(val project: Project, val konanTarget:
|
||||
args.addArg("-cache-arg", it)
|
||||
}
|
||||
}
|
||||
|
||||
mode?.let {
|
||||
args.addArg("-mode", it)
|
||||
}
|
||||
|
||||
KotlinNativeLibraryGenerationRunner.fromProject(this).run(args)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user