Commonizing klib metadata between native and js
This commit is contained in:
committed by
alexander-gorshenev
parent
f38123e78c
commit
c227c13799
@@ -5,13 +5,12 @@
|
||||
|
||||
package org.jetbrains.kotlin.konan.file
|
||||
|
||||
import org.jetbrains.kotlin.konan.util.removeSuffixIfPresent
|
||||
import org.jetbrains.kotlin.util.removeSuffixIfPresent
|
||||
import java.io.BufferedReader
|
||||
import java.io.InputStream
|
||||
import java.io.InputStreamReader
|
||||
import java.io.RandomAccessFile
|
||||
import java.lang.Exception
|
||||
import java.net.URI
|
||||
import java.nio.MappedByteBuffer
|
||||
import java.nio.channels.FileChannel
|
||||
import java.nio.file.*
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
package org.jetbrains.kotlin.konan.properties
|
||||
|
||||
import org.jetbrains.kotlin.konan.file.*
|
||||
import org.jetbrains.kotlin.konan.util.parseSpaceSeparatedArgs
|
||||
import org.jetbrains.kotlin.util.parseSpaceSeparatedArgs
|
||||
import java.io.ByteArrayOutputStream
|
||||
|
||||
typealias Properties = java.util.Properties
|
||||
|
||||
+3
-2
@@ -3,7 +3,7 @@
|
||||
* 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.util
|
||||
package org.jetbrains.kotlin.util
|
||||
|
||||
import kotlin.system.measureTimeMillis
|
||||
import org.jetbrains.kotlin.konan.file.*
|
||||
@@ -20,7 +20,8 @@ fun <T> printMillisec(message: String, body: () -> T): T {
|
||||
|
||||
fun profile(message: String, body: () -> Unit) = profileIf(
|
||||
System.getProperty("konan.profile")?.equals("true") ?: false,
|
||||
message, body)
|
||||
message, body
|
||||
)
|
||||
|
||||
fun profileIf(condition: Boolean, message: String, body: () -> Unit) =
|
||||
if (condition) printMillisec(message, body) else body()
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.jetbrains.kotlin.util
|
||||
|
||||
import kotlin.system.exitProcess
|
||||
|
||||
interface Logger {
|
||||
fun log(message: String)
|
||||
fun error(message: String)
|
||||
fun warning(message: String)
|
||||
fun fatal(message: String): Nothing
|
||||
}
|
||||
|
||||
interface WithLogger {
|
||||
val logger: Logger
|
||||
}
|
||||
|
||||
object DummyLogger : Logger {
|
||||
override fun log(message: String) = println(message)
|
||||
override fun error(message: String) = println("e: $message")
|
||||
override fun warning(message: String) = println("w: $message")
|
||||
override fun fatal(message: String): Nothing {
|
||||
println("e: $message")
|
||||
exitProcess(1)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user