From 45d894ee6ebd09c8954394d47f8c501b09c05a62 Mon Sep 17 00:00:00 2001 From: Dmitriy Dolovov Date: Tue, 24 Dec 2019 19:10:04 +0700 Subject: [PATCH] K/N: remove unused code --- .../kotlin/konan/util/ProfilingUtils.kt | 23 ------------- .../kotlin/konan/util/Substitution.kt | 33 ------------------- 2 files changed, 56 deletions(-) delete mode 100644 konan/library-reader/src/org/jetbrains/kotlin/konan/util/ProfilingUtils.kt delete mode 100644 konan/library-reader/src/org/jetbrains/kotlin/konan/util/Substitution.kt diff --git a/konan/library-reader/src/org/jetbrains/kotlin/konan/util/ProfilingUtils.kt b/konan/library-reader/src/org/jetbrains/kotlin/konan/util/ProfilingUtils.kt deleted file mode 100644 index 06405b376c5..00000000000 --- a/konan/library-reader/src/org/jetbrains/kotlin/konan/util/ProfilingUtils.kt +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2010-2018 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.util - -import kotlin.system.measureTimeMillis - -fun printMillisec(message: String, body: () -> Unit) { - val msec = measureTimeMillis { - body() - } - println("$message: $msec msec") -} - -fun profile(message: String, body: () -> Unit) = profileIf( - System.getProperty("konan.profile")?.equals("true") ?: false, - message, body -) - -fun profileIf(condition: Boolean, message: String, body: () -> Unit) = - if (condition) printMillisec(message, body) else body() diff --git a/konan/library-reader/src/org/jetbrains/kotlin/konan/util/Substitution.kt b/konan/library-reader/src/org/jetbrains/kotlin/konan/util/Substitution.kt deleted file mode 100644 index a3436db5289..00000000000 --- a/konan/library-reader/src/org/jetbrains/kotlin/konan/util/Substitution.kt +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2010-2018 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.util - -import org.jetbrains.kotlin.konan.target.KonanTarget -import java.util.* - -fun defaultTargetSubstitutions(target: KonanTarget) = - mapOf( - "target" to target.visibleName, - "arch" to target.architecture.visibleName, - "family" to target.family.visibleName - ) - -// Performs substitution similar to: -// foo = ${foo} ${foo.${arch}} ${foo.${os}} -fun substitute(properties: Properties, substitutions: Map) { - for (key in properties.stringPropertyNames()) { - for (substitution in substitutions.values) { - val suffix = ".$substitution" - if (key.endsWith(suffix)) { - val baseKey = key.removeSuffix(suffix) - val oldValue = properties.getProperty(baseKey, "") - val appendedValue = properties.getProperty(key, "") - val newValue = if (oldValue != "") "$oldValue $appendedValue" else appendedValue - properties.setProperty(baseKey, newValue) - } - } - } -}