K/N: Drop unused part of "lite" KLIB API
This commit is contained in:
-15
@@ -1,15 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2019 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.library.lite
|
||||
|
||||
import org.jetbrains.kotlin.konan.CompilerVersion
|
||||
import java.io.File
|
||||
|
||||
class LiteKonanDistribution(
|
||||
val distributionHome: File,
|
||||
val konanVersion: CompilerVersion,
|
||||
val konanVersionString: String
|
||||
)
|
||||
-24
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2019 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.library.lite
|
||||
|
||||
import org.jetbrains.kotlin.konan.CompilerVersion
|
||||
import org.jetbrains.kotlin.konan.library.KONAN_STDLIB_NAME
|
||||
import org.jetbrains.kotlin.konan.library.konanCommonLibraryPath
|
||||
import java.io.File
|
||||
|
||||
object LiteKonanDistributionProvider {
|
||||
fun getDistribution(konanHomeDir: File): LiteKonanDistribution? {
|
||||
val stdlib = LiteKonanLibraryFacade.getDistributionLibraryProvider(konanHomeDir)
|
||||
.getLibrary(konanHomeDir.resolve(konanCommonLibraryPath(KONAN_STDLIB_NAME))) as? LiteKonanLibraryImpl ?: return null
|
||||
|
||||
return LiteKonanDistribution(
|
||||
konanHomeDir,
|
||||
CompilerVersion.fromString(stdlib.compilerVersion),
|
||||
stdlib.compilerVersion
|
||||
)
|
||||
}
|
||||
}
|
||||
+2
-5
@@ -40,12 +40,10 @@ private object DefaultLiteKonanLibraryProvider : LiteKonanLibraryProvider {
|
||||
val manifest = loadManifest(libraryPath) ?: return null
|
||||
|
||||
val name = manifest.getProperty(KLIB_PROPERTY_UNIQUE_NAME) ?: return null
|
||||
val compilerVersion = manifest.getProperty(KLIB_PROPERTY_COMPILER_VERSION) ?: return null
|
||||
|
||||
return LiteKonanLibraryImpl(
|
||||
path = libraryPath,
|
||||
name = name,
|
||||
compilerVersion = compilerVersion
|
||||
name = name
|
||||
)
|
||||
}
|
||||
|
||||
@@ -129,8 +127,7 @@ private class FromDistributionLiteKonanLibraryProvider(customKonanHomeDir: File?
|
||||
|
||||
internal class LiteKonanLibraryImpl(
|
||||
override val path: File,
|
||||
override val name: String,
|
||||
internal val compilerVersion: String
|
||||
override val name: String
|
||||
) : LiteKonanLibrary {
|
||||
override var platform: String? = null
|
||||
override var sourcePaths: Collection<File> = emptyList()
|
||||
|
||||
-30
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2019 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.library.lite
|
||||
|
||||
import org.jetbrains.kotlin.konan.CompilerVersion
|
||||
import org.junit.Test
|
||||
import org.junit.Assert.*
|
||||
|
||||
class LiteKonanDistributionTests {
|
||||
|
||||
@Test
|
||||
fun testDistribution() {
|
||||
val distribution = LiteKonanDistributionProvider.getDistribution(konanHomeDir)
|
||||
?: error("Could not load Kotlin/Native distribution info from $konanHomeDir")
|
||||
|
||||
assertEquals("Kotlin/Native distribution home", konanHomeDir, distribution.distributionHome)
|
||||
assertEquals("Kotlin/Native version string", expectedVersionString, distribution.konanVersionString)
|
||||
assertEquals("Kotlin/Native version", expectedVersion, distribution.konanVersion)
|
||||
}
|
||||
|
||||
private companion object {
|
||||
const val expectedVersionString = "1.2.3-release-5678"
|
||||
|
||||
val expectedVersion: CompilerVersion
|
||||
get() = CompilerVersion.fromString(expectedVersionString)
|
||||
}
|
||||
}
|
||||
@@ -1,2 +1 @@
|
||||
SPOILED_unique_name=anotherBroken
|
||||
compiler_version=1.2.3
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
unique_name=correct
|
||||
compiler_version=1.2.3-eap-45
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
unique_name=yetAnotherBroken
|
||||
compiler_version=1.2-eap-8879
|
||||
|
||||
-1
@@ -1,2 +1 @@
|
||||
unique_name=stdlib
|
||||
compiler_version=1.2.3-release-5678
|
||||
|
||||
-1
@@ -1,2 +1 @@
|
||||
unique_name=bar
|
||||
compiler_version=1.2-eap-8879
|
||||
|
||||
-1
@@ -1,2 +1 @@
|
||||
unique_name=baz
|
||||
compiler_version=1.3.1-dev-9301
|
||||
|
||||
+1
-2
@@ -1,2 +1 @@
|
||||
unique_name=broken
|
||||
SPOILED_compiler_version=1.2.3
|
||||
SPOILED_unique_name=broken
|
||||
|
||||
-1
@@ -1,2 +1 @@
|
||||
unique_name=foo
|
||||
compiler_version=1.3-release-1234
|
||||
|
||||
Reference in New Issue
Block a user