[K/N][perf] Move benchmarks related code to performance subdir
This commit is contained in:
committed by
Space Team
parent
0089517b25
commit
71f2c3cf9b
@@ -9,6 +9,9 @@ package org.jetbrains.kotlin
|
|||||||
import com.google.gson.GsonBuilder
|
import com.google.gson.GsonBuilder
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.api.Task
|
import org.gradle.api.Task
|
||||||
|
import org.gradle.api.file.FileCollection
|
||||||
|
import org.gradle.api.plugins.ExtraPropertiesExtension
|
||||||
|
import org.gradle.api.provider.Provider
|
||||||
import org.jetbrains.kotlin.konan.properties.loadProperties
|
import org.jetbrains.kotlin.konan.properties.loadProperties
|
||||||
import org.jetbrains.kotlin.konan.properties.propertyList
|
import org.jetbrains.kotlin.konan.properties.propertyList
|
||||||
import org.jetbrains.kotlin.konan.properties.saveProperties
|
import org.jetbrains.kotlin.konan.properties.saveProperties
|
||||||
@@ -313,37 +316,6 @@ fun Array<String>.runCommand(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun String.splitCommaSeparatedOption(optionName: String) =
|
|
||||||
split("\\s*,\\s*".toRegex()).map {
|
|
||||||
if (it.isNotEmpty()) listOf(optionName, it) else listOf(null)
|
|
||||||
}.flatten().filterNotNull()
|
|
||||||
|
|
||||||
data class Commit(val revision: String, val developer: String, val webUrlWithDescription: String)
|
|
||||||
|
|
||||||
val teamCityUrl = "https://buildserver.labs.intellij.net"
|
|
||||||
|
|
||||||
fun buildsUrl(buildLocator: String) =
|
|
||||||
"$teamCityUrl/app/rest/builds/?locator=$buildLocator"
|
|
||||||
|
|
||||||
fun getBuild(buildLocator: String, user: String, password: String) =
|
|
||||||
try {
|
|
||||||
sendGetRequest(buildsUrl(buildLocator), user, password)
|
|
||||||
} catch (t: Throwable) {
|
|
||||||
error("Try to get build! TeamCity is unreachable!")
|
|
||||||
}
|
|
||||||
|
|
||||||
fun sendGetRequest(url: String, username: String? = null, password: String? = null): String {
|
|
||||||
val connection = URL(url).openConnection() as HttpURLConnection
|
|
||||||
if (username != null && password != null) {
|
|
||||||
val auth = Base64.getEncoder().encode(("$username:$password").toByteArray()).toString(Charsets.UTF_8)
|
|
||||||
connection.addRequestProperty("Authorization", "Basic $auth")
|
|
||||||
}
|
|
||||||
connection.setRequestProperty("Accept", "application/json");
|
|
||||||
connection.connect()
|
|
||||||
return connection.inputStream.use { it.reader().use { reader -> reader.readText() } }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@JvmOverloads
|
@JvmOverloads
|
||||||
fun compileSwift(
|
fun compileSwift(
|
||||||
project: Project, target: KonanTarget, sources: List<String>, options: List<String>,
|
project: Project, target: KonanTarget, sources: List<String>, options: List<String>,
|
||||||
@@ -484,3 +456,11 @@ internal val Project.testTargetConfigurables: Configurables
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal val gson = GsonBuilder().excludeFieldsWithoutExposeAnnotation().create()!!
|
internal val gson = GsonBuilder().excludeFieldsWithoutExposeAnnotation().create()!!
|
||||||
|
|
||||||
|
internal val Project.ext: ExtraPropertiesExtension
|
||||||
|
get() = extensions.getByName("ext") as ExtraPropertiesExtension
|
||||||
|
|
||||||
|
internal val FileCollection.isNotEmpty: Boolean
|
||||||
|
get() = !isEmpty
|
||||||
|
|
||||||
|
internal fun Provider<File>.resolve(child: String): Provider<File> = map { it.resolve(child) }
|
||||||
|
|||||||
@@ -8,3 +8,33 @@ fun Project.kotlinInit(cacheRedirectorEnabled: Boolean) {
|
|||||||
extensions.extraProperties["defaultSnapshotVersion"] = kotlinBuildProperties.defaultSnapshotVersion
|
extensions.extraProperties["defaultSnapshotVersion"] = kotlinBuildProperties.defaultSnapshotVersion
|
||||||
extensions.extraProperties["kotlinVersion"] = findProperty("kotlinVersion")
|
extensions.extraProperties["kotlinVersion"] = findProperty("kotlinVersion")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun String.splitCommaSeparatedOption(optionName: String) =
|
||||||
|
split("\\s*,\\s*".toRegex()).map {
|
||||||
|
if (it.isNotEmpty()) listOf(optionName, it) else listOf(null)
|
||||||
|
}.flatten().filterNotNull()
|
||||||
|
|
||||||
|
data class Commit(val revision: String, val developer: String, val webUrlWithDescription: String)
|
||||||
|
|
||||||
|
val teamCityUrl = "https://buildserver.labs.intellij.net"
|
||||||
|
|
||||||
|
fun buildsUrl(buildLocator: String) =
|
||||||
|
"$teamCityUrl/app/rest/builds/?locator=$buildLocator"
|
||||||
|
|
||||||
|
fun getBuild(buildLocator: String, user: String, password: String) =
|
||||||
|
try {
|
||||||
|
sendGetRequest(buildsUrl(buildLocator), user, password)
|
||||||
|
} catch (t: Throwable) {
|
||||||
|
error("Try to get build! TeamCity is unreachable!")
|
||||||
|
}
|
||||||
|
|
||||||
|
fun sendGetRequest(url: String, username: String? = null, password: String? = null): String {
|
||||||
|
val connection = URL(url).openConnection() as HttpURLConnection
|
||||||
|
if (username != null && password != null) {
|
||||||
|
val auth = Base64.getEncoder().encode(("$username:$password").toByteArray()).toString(Charsets.UTF_8)
|
||||||
|
connection.addRequestProperty("Authorization", "Basic $auth")
|
||||||
|
}
|
||||||
|
connection.setRequestProperty("Accept", "application/json");
|
||||||
|
connection.connect()
|
||||||
|
return connection.inputStream.use { it.reader().use { reader -> reader.readText() } }
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2023 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
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.konan.target.*
|
||||||
|
|
||||||
|
object PlatformInfo {
|
||||||
|
@JvmStatic
|
||||||
|
fun isMac() = HostManager.hostIsMac
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun isWindows() = HostManager.hostIsMingw
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun isLinux() = HostManager.hostIsLinux
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user