[K/N][gradle] Set klib version from gradle
This commit is contained in:
+2
@@ -48,6 +48,8 @@ open class CommonInteropArguments(val argParser: ArgParser) {
|
||||
.multiple().delimiter(",")
|
||||
val library by argParser.option(ArgType.String, shortName = "l", description = "library to use for building")
|
||||
.multiple()
|
||||
val libraryVersion by argParser.option(ArgType.String, shortName = "lv", description = "resulting interop library version")
|
||||
.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")
|
||||
|
||||
+2
-1
@@ -29,6 +29,7 @@ fun createInteropLibrary(
|
||||
metadata: KlibModuleMetadata,
|
||||
outputPath: String,
|
||||
moduleName: String,
|
||||
libraryVersion: String,
|
||||
nativeBitcodeFiles: List<String>,
|
||||
target: KonanTarget,
|
||||
manifest: Properties,
|
||||
@@ -38,7 +39,7 @@ fun createInteropLibrary(
|
||||
staticLibraries: List<String>
|
||||
) {
|
||||
val version = KotlinLibraryVersioning(
|
||||
libraryVersion = null,
|
||||
libraryVersion = libraryVersion,
|
||||
abiVersion = KotlinAbiVersion.CURRENT,
|
||||
compilerVersion = CompilerVersion.CURRENT.toString(),
|
||||
metadataVersion = KlibMetadataVersion.INSTANCE.toString(),
|
||||
|
||||
+1
@@ -445,6 +445,7 @@ private fun processCLib(
|
||||
nativeBitcodeFiles = compiledFiles + nativeOutputPath,
|
||||
target = tool.target,
|
||||
moduleName = moduleName,
|
||||
libraryVersion = cinteropArguments.libraryVersion,
|
||||
outputPath = outputPath,
|
||||
manifest = def.manifestAddendProperties,
|
||||
dependencies = stdlibDependency + imports.requiredLibraries.toList(),
|
||||
|
||||
+1
@@ -74,6 +74,7 @@ fun invokeInterop(flavor: String, args: Array<String>, runFromDaemon: Boolean):
|
||||
(if (nopack) arrayOf("-$NOPACK") else emptyArray()) +
|
||||
moduleName?.let { arrayOf("-module-name", it) }.orEmpty() +
|
||||
shortModuleName?.let { arrayOf("${K2NativeCompilerArguments.SHORT_MODULE_NAME_ARG}=$it") }.orEmpty() +
|
||||
"-library-version=${arguments.libraryVersion}" +
|
||||
arguments.kotlincOption
|
||||
}
|
||||
|
||||
|
||||
+5
@@ -28,6 +28,7 @@ internal class SharedCompilationData(
|
||||
val refinesPaths: FileCollection
|
||||
)
|
||||
|
||||
@Suppress("UNUSED_PARAMETER")
|
||||
internal fun buildKotlinNativeKlibCompilerArgs(
|
||||
outFile: File,
|
||||
optimized: Boolean,
|
||||
@@ -43,6 +44,7 @@ internal fun buildKotlinNativeKlibCompilerArgs(
|
||||
moduleName: String,
|
||||
shortModuleName: String,
|
||||
friendModule: FileCollection,
|
||||
libraryVersion: String,
|
||||
sharedCompilationData: SharedCompilationData?,
|
||||
source: FileTree,
|
||||
commonSourcesTree: FileTree
|
||||
@@ -65,6 +67,9 @@ internal fun buildKotlinNativeKlibCompilerArgs(
|
||||
addArg("-friend-modules", friends.joinToString(File.pathSeparator) { it.absolutePath })
|
||||
}
|
||||
|
||||
// TODO: uncomment after advancing bootstrap.
|
||||
//add("-library-version=libraryVersion")
|
||||
|
||||
if (sharedCompilationData != null) {
|
||||
val refinesPaths = sharedCompilationData.refinesPaths.files
|
||||
if (refinesPaths.isNotEmpty()) {
|
||||
|
||||
+11
@@ -231,6 +231,9 @@ abstract class AbstractKotlinNativeCompile<
|
||||
val kotlinNativeVersion: String
|
||||
get() = project.konanVersion.toString()
|
||||
|
||||
@get:Input
|
||||
val artifactVersion = project.version.toString()
|
||||
|
||||
@get:Input
|
||||
internal val useEmbeddableCompilerJar: Boolean
|
||||
get() = project.nativeUseEmbeddableCompilerJar
|
||||
@@ -487,6 +490,7 @@ internal constructor(
|
||||
moduleName,
|
||||
shortModuleName,
|
||||
friendModule,
|
||||
artifactVersion,
|
||||
createSharedCompilationDataOrNull(),
|
||||
sources.asFileTree,
|
||||
commonSourcesTree
|
||||
@@ -987,6 +991,10 @@ open class CInteropProcess @Inject internal constructor(params: Params) : Defaul
|
||||
@get:Input
|
||||
val konanVersion: CompilerVersion = project.konanVersion
|
||||
|
||||
@Suppress("unused")
|
||||
@get:Input
|
||||
val libraryVersion = project.version.toString()
|
||||
|
||||
@Suppress("unused")
|
||||
@get:Input
|
||||
val interopName: String = params.settings.name
|
||||
@@ -1089,6 +1097,9 @@ open class CInteropProcess @Inject internal constructor(params: Params) : Defaul
|
||||
addArg("-Xmodule-name", moduleName)
|
||||
}
|
||||
|
||||
// TODO: uncomment after advancing bootstrap.
|
||||
//addArg("-libraryVersion", libraryVersion)
|
||||
|
||||
addAll(extraOpts)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user