[KLIB tool] Drop useless arg: -target
This commit is contained in:
committed by
Space Team
parent
b0c1cbff32
commit
447b0eddac
@@ -36,7 +36,6 @@ import org.jetbrains.kotlin.konan.file.File
|
|||||||
import org.jetbrains.kotlin.konan.library.KonanLibrary
|
import org.jetbrains.kotlin.konan.library.KonanLibrary
|
||||||
import org.jetbrains.kotlin.konan.library.resolverByName
|
import org.jetbrains.kotlin.konan.library.resolverByName
|
||||||
import org.jetbrains.kotlin.konan.target.Distribution
|
import org.jetbrains.kotlin.konan.target.Distribution
|
||||||
import org.jetbrains.kotlin.konan.target.PlatformManager
|
|
||||||
import org.jetbrains.kotlin.konan.util.DependencyDirectories
|
import org.jetbrains.kotlin.konan.util.DependencyDirectories
|
||||||
import org.jetbrains.kotlin.konan.util.KonanHomeProvider
|
import org.jetbrains.kotlin.konan.util.KonanHomeProvider
|
||||||
import org.jetbrains.kotlin.library.*
|
import org.jetbrains.kotlin.library.*
|
||||||
@@ -72,7 +71,6 @@ fun printUsage() {
|
|||||||
|
|
||||||
and the options are:
|
and the options are:
|
||||||
-repository <path> Work with the specified repository
|
-repository <path> Work with the specified repository
|
||||||
-target <name> Inspect specifics of the given target
|
|
||||||
-print-signatures {true|false}
|
-print-signatures {true|false}
|
||||||
Print IR signature for every declaration (only for "contents" and "dump-ir" commands)
|
Print IR signature for every declaration (only for "contents" and "dump-ir" commands)
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
@@ -145,7 +143,7 @@ open class ModuleDeserializer(val library: ByteArray) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class Library(val libraryNameOrPath: String, val requestedRepository: String?, val target: String) {
|
class Library(val libraryNameOrPath: String, val requestedRepository: String?) {
|
||||||
|
|
||||||
val repository = requestedRepository?.File() ?: defaultRepository
|
val repository = requestedRepository?.File() ?: defaultRepository
|
||||||
fun info() {
|
fun info() {
|
||||||
@@ -313,14 +311,10 @@ fun libraryInRepoOrCurrentDir(repository: File, name: String) =
|
|||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
val command = Command(args)
|
val command = Command(args)
|
||||||
|
|
||||||
val targetManager = PlatformManager(KonanHomeProvider.determineKonanHome())
|
|
||||||
.targetManager(command.options["-target"]?.last())
|
|
||||||
val target = targetManager.targetName
|
|
||||||
|
|
||||||
val repository = command.options["-repository"]?.last()
|
val repository = command.options["-repository"]?.last()
|
||||||
val printSignatures = command.options["-print-signatures"]?.last()?.toBoolean() == true
|
val printSignatures = command.options["-print-signatures"]?.last()?.toBoolean() == true
|
||||||
|
|
||||||
val library = Library(command.library, repository, target)
|
val library = Library(command.library, repository)
|
||||||
|
|
||||||
when (command.verb) {
|
when (command.verb) {
|
||||||
"dump-ir" -> library.ir(System.out, printSignatures)
|
"dump-ir" -> library.ir(System.out, printSignatures)
|
||||||
|
|||||||
+2
-2
@@ -18,7 +18,7 @@ class ContentsTest {
|
|||||||
|
|
||||||
private fun klibContents(library: String, printOutput: Boolean = false, expected: () -> String) {
|
private fun klibContents(library: String, printOutput: Boolean = false, expected: () -> String) {
|
||||||
val output = StringBuilder()
|
val output = StringBuilder()
|
||||||
val lib = Library(library, null, "host")
|
val lib = Library(library, null)
|
||||||
lib.contents(output, false)
|
lib.contents(output, false)
|
||||||
if (printOutput) {
|
if (printOutput) {
|
||||||
println(output.trim().toString())
|
println(output.trim().toString())
|
||||||
@@ -34,7 +34,7 @@ class ContentsTest {
|
|||||||
fun `Stdlib content should be printed without exceptions`() {
|
fun `Stdlib content should be printed without exceptions`() {
|
||||||
val output = StringBuilder()
|
val output = StringBuilder()
|
||||||
val distributionPath = System.getProperty("konan.home")
|
val distributionPath = System.getProperty("konan.home")
|
||||||
Library(Distribution(distributionPath).stdlib, null, "host").contents(output, false)
|
Library(Distribution(distributionPath).stdlib, null).contents(output, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
+2
-2
@@ -11,8 +11,8 @@ import java.io.File
|
|||||||
private fun invokeKlibTool(kotlinNativeClassLoader: ClassLoader, klibFile: File, functionName: String, vararg args: Any): String {
|
private fun invokeKlibTool(kotlinNativeClassLoader: ClassLoader, klibFile: File, functionName: String, vararg args: Any): String {
|
||||||
val libraryClass = Class.forName("org.jetbrains.kotlin.cli.klib.Library", true, kotlinNativeClassLoader)
|
val libraryClass = Class.forName("org.jetbrains.kotlin.cli.klib.Library", true, kotlinNativeClassLoader)
|
||||||
val entryPoint = libraryClass.declaredMethods.single { it.name == functionName }
|
val entryPoint = libraryClass.declaredMethods.single { it.name == functionName }
|
||||||
val lib = libraryClass.getDeclaredConstructor(String::class.java, String::class.java, String::class.java)
|
val lib = libraryClass.getDeclaredConstructor(String::class.java, String::class.java)
|
||||||
.newInstance(klibFile.canonicalPath, null, "host")
|
.newInstance(klibFile.canonicalPath, null)
|
||||||
|
|
||||||
val output = StringBuilder()
|
val output = StringBuilder()
|
||||||
entryPoint.invoke(lib, output, *args)
|
entryPoint.invoke(lib, output, *args)
|
||||||
|
|||||||
Reference in New Issue
Block a user