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