Allow absent abiVersion and compilerVersion in library manifest, just… (#2061)
* Allow absent abiVersion and compilerVersion in library manifest, just treat them as mismatching. * Teach `klib info` to print more of library versioning.
This commit is contained in:
committed by
Nikolay Igotti
parent
c40396bf19
commit
15eb28a2a8
@@ -97,12 +97,16 @@ class Library(val name: String, val requestedRepository: String?, val target: St
|
|||||||
fun info() {
|
fun info() {
|
||||||
val library = libraryInRepoOrCurrentDir(repository, name)
|
val library = libraryInRepoOrCurrentDir(repository, name)
|
||||||
val headerAbiVersion = library.versions.abiVersion
|
val headerAbiVersion = library.versions.abiVersion
|
||||||
|
val headerCompilerVersion = library.versions.compilerVersion
|
||||||
|
val headerLibraryVersion = library.versions.libraryVersion
|
||||||
val moduleName = ModuleDeserializer(library.moduleHeaderData).moduleName
|
val moduleName = ModuleDeserializer(library.moduleHeaderData).moduleName
|
||||||
|
|
||||||
println("")
|
println("")
|
||||||
println("Resolved to: ${library.libraryName.File().absolutePath}")
|
println("Resolved to: ${library.libraryName.File().absolutePath}")
|
||||||
println("Module name: $moduleName")
|
println("Module name: $moduleName")
|
||||||
println("ABI version: $headerAbiVersion")
|
println("ABI version: $headerAbiVersion")
|
||||||
|
println("Compiler version: $headerCompilerVersion")
|
||||||
|
println("Library version: $headerLibraryVersion")
|
||||||
val targets = library.targetList.joinToString(", ")
|
val targets = library.targetList.joinToString(", ")
|
||||||
print("Available targets: $targets\n")
|
print("Available targets: $targets\n")
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-6
@@ -9,20 +9,20 @@ import org.jetbrains.kotlin.konan.parseKonanAbiVersion
|
|||||||
|
|
||||||
data class KonanLibraryVersioning(
|
data class KonanLibraryVersioning(
|
||||||
val libraryVersion: String?,
|
val libraryVersion: String?,
|
||||||
val compilerVersion: KonanVersion,
|
val compilerVersion: KonanVersion?,
|
||||||
val abiVersion: KonanAbiVersion
|
val abiVersion: KonanAbiVersion?
|
||||||
)
|
)
|
||||||
|
|
||||||
fun Properties.writeKonanLibraryVersioning(versions: KonanLibraryVersioning) {
|
fun Properties.writeKonanLibraryVersioning(versions: KonanLibraryVersioning) {
|
||||||
this.setProperty(KLIB_PROPERTY_ABI_VERSION, versions.abiVersion.toString())
|
versions.abiVersion ?. let { this.setProperty(KLIB_PROPERTY_ABI_VERSION, it.toString()) }
|
||||||
versions.libraryVersion ?. let { this.setProperty(KLIB_PROPERTY_LIBRARY_VERSION, it) }
|
versions.libraryVersion ?. let { this.setProperty(KLIB_PROPERTY_LIBRARY_VERSION, it) }
|
||||||
this.setProperty(KLIB_PROPERTY_COMPILER_VERSION, "${versions.compilerVersion}")
|
versions.compilerVersion ?. let { this.setProperty(KLIB_PROPERTY_COMPILER_VERSION, "${versions.compilerVersion}") }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Properties.readKonanLibraryVersioning(): KonanLibraryVersioning {
|
fun Properties.readKonanLibraryVersioning(): KonanLibraryVersioning {
|
||||||
val abiVersion = this.getProperty(KLIB_PROPERTY_ABI_VERSION)!!.parseKonanAbiVersion()
|
val abiVersion = this.getProperty(KLIB_PROPERTY_ABI_VERSION)?.parseKonanAbiVersion()
|
||||||
val libraryVersion = this.getProperty(KLIB_PROPERTY_LIBRARY_VERSION)
|
val libraryVersion = this.getProperty(KLIB_PROPERTY_LIBRARY_VERSION)
|
||||||
val compilerVersion = this.getProperty(KLIB_PROPERTY_COMPILER_VERSION)!!.parseKonanVersion()
|
val compilerVersion = this.getProperty(KLIB_PROPERTY_COMPILER_VERSION)?.parseKonanVersion()
|
||||||
|
|
||||||
return KonanLibraryVersioning(abiVersion = abiVersion, libraryVersion = libraryVersion, compilerVersion = compilerVersion)
|
return KonanLibraryVersioning(abiVersion = abiVersion, libraryVersion = libraryVersion, compilerVersion = compilerVersion)
|
||||||
}
|
}
|
||||||
@@ -172,27 +172,33 @@ internal fun SearchPathResolverWithTarget.libraryMatch(candidate: KonanLibraryIm
|
|||||||
val resolverTarget = this.target
|
val resolverTarget = this.target
|
||||||
val candidatePath = candidate.libraryFile.absolutePath
|
val candidatePath = candidate.libraryFile.absolutePath
|
||||||
|
|
||||||
|
val candidateCompilerVersion = candidate.versions.compilerVersion
|
||||||
|
val candidateAbiVersion = candidate.versions.abiVersion
|
||||||
|
val candidateLibraryVersion = candidate.versions.libraryVersion
|
||||||
|
|
||||||
if (resolverTarget != null && !candidate.targetList.contains(resolverTarget.visibleName)) {
|
if (resolverTarget != null && !candidate.targetList.contains(resolverTarget.visibleName)) {
|
||||||
logger("skipping $candidatePath. The target doesn't match. Expected '$resolverTarget', found ${candidate.targetList}")
|
logger("skipping $candidatePath. The target doesn't match. Expected '$resolverTarget', found ${candidate.targetList}")
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (knownCompilerVersions != null &&
|
if (candidateCompilerVersion == null ||
|
||||||
!knownCompilerVersions!!.contains(candidate.versions.compilerVersion)) {
|
knownCompilerVersions != null &&
|
||||||
logger("skipping $candidatePath. The compiler versions don't match. Expected '${knownCompilerVersions}', found '${candidate.versions.compilerVersion}'")
|
!knownCompilerVersions!!.contains(candidateCompilerVersion)) {
|
||||||
|
logger("skipping $candidatePath. The compiler versions don't match. Expected '${knownCompilerVersions}', found '${candidateCompilerVersion}'")
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (knownAbiVersions != null &&
|
if (candidateAbiVersion == null ||
|
||||||
!knownAbiVersions!!.contains(candidate.versions.abiVersion)) {
|
knownAbiVersions != null &&
|
||||||
logger("skipping $candidatePath. The abi versions don't match. Expected '${knownAbiVersions}', found '${candidate.versions.abiVersion}'")
|
!knownAbiVersions!!.contains(candidateAbiVersion)) {
|
||||||
|
logger("skipping $candidatePath. The abi versions don't match. Expected '${knownAbiVersions}', found '${candidateAbiVersion}'")
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (candidate.versions.libraryVersion != unresolved.libraryVersion &&
|
if (candidateLibraryVersion != unresolved.libraryVersion &&
|
||||||
candidate.versions.libraryVersion != null &&
|
candidateLibraryVersion != null &&
|
||||||
unresolved.libraryVersion != null) {
|
unresolved.libraryVersion != null) {
|
||||||
logger("skipping $candidatePath. The library versions don't match. Expected '${unresolved.libraryVersion}', found '${candidate.versions.libraryVersion}'")
|
logger("skipping $candidatePath. The library versions don't match. Expected '${unresolved.libraryVersion}', found '${candidateLibraryVersion}'")
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user