Move everything under kotlin-native folder

I was forced to manually do update the following files, because otherwise
they would be ignored according .gitignore settings. Probably they
should be deleted from repo.

Interop/.idea/compiler.xml
Interop/.idea/gradle.xml
Interop/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_3.xml
Interop/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_3.xml
Interop/.idea/modules.xml
Interop/.idea/modules/Indexer/Indexer.iml
Interop/.idea/modules/Runtime/Runtime.iml
Interop/.idea/modules/StubGenerator/StubGenerator.iml
backend.native/backend.native.iml
backend.native/bc.frontend/bc.frontend.iml
backend.native/cli.bc/cli.bc.iml
backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2Native.kt
backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2NativeCompilerArguments.kt
backend.native/tests/link/lib/foo.kt
backend.native/tests/link/lib/foo2.kt
backend.native/tests/teamcity-test.property
This commit is contained in:
Stanislav Erokhin
2020-10-27 21:00:28 +03:00
parent 91e4162dad
commit f624800b84
2830 changed files with 0 additions and 0 deletions
+295
View File
@@ -0,0 +1,295 @@
import org.jetbrains.kotlin.RegressionsReporter
import org.jetbrains.kotlin.RegressionsSummaryReporter
import org.jetbrains.kotlin.BuildRegister
import org.jetbrains.kotlin.MPPTools
buildscript {
apply from: "$rootProject.projectDir/gradle/kotlinGradlePlugin.gradle"
repositories {
maven {
url 'https://cache-redirector.jetbrains.com/jcenter'
}
jcenter()
}
}
def rootBuildDirectory = rootProject.projectDir
task konanRun {
subprojects.each {
dependsOn "${it.path}:konanRun"
}
}
task jvmRun {
subprojects.each {
dependsOn "${it.path}:jvmRun"
}
}
task clean {
subprojects.each {
dependsOn "${it.path}:clean"
}
doLast {
delete "${buildDir.absolutePath}"
}
}
defaultTasks 'konanRun'
private static String getAnalyzerTargetName() {
// Copy-pasted from tools/benchmarksAnalyzer/build.gradle.
String target = System.getProperty("os.name")
if (target == 'Linux') return 'linux'
if (target.startsWith('Windows')) return 'windows'
if (target.startsWith('Mac')) return 'macos'
return 'unknown'
}
private String findAnalyzerBinary() {
String result = "${rootProject.projectDir}/${analyzerToolDirectory}/${getAnalyzerTargetName()}/" +
"${analyzerTool}ReleaseExecutable/${analyzerTool}${MPPTools.getNativeProgramExtension()}"
if (file(result).exists()) return result
else return null
}
// Produce and send slack report.
task slackReport(type: RegressionsReporter) {
def analyzerBinary = MPPTools.findFile("${analyzerTool}${MPPTools.getNativeProgramExtension()}",
"${rootBuildDirectory}/${analyzerToolDirectory}")
def teamcityConfig = System.getenv("TEAMCITY_BUILD_PROPERTIES_FILE")
if (teamcityConfig && analyzerBinary != null) {
// Create folder for report (root Kotlin project settings make create report in separate folder).
def reportDirectory = new File(outputReport).parentFile
mkdir reportDirectory
def targetsResults = new File(new File("${rootBuildDirectory}"), "targetsResults").toString()
mkdir targetsResults
currentBenchmarksReportFile = "${buildDir.absolutePath}/${nativeJson}"
analyzer = analyzerBinary
htmlReport = outputReport
defaultBranch = project.findProperty('kotlin.native.default.branch') ?: "master"
def target = System.getProperty("os.name")
summaryFile = "${targetsResults}/${target}.txt"
bundleBuild = project.findProperty('kotlin.bundleBuild') == null ? false : true
}
}
task slackSummary(type: RegressionsSummaryReporter) {
targetsResultFiles = ['Linux': "${rootBuildDirectory}/targetsResults/Linux.txt".toString(),
'MacOSX': "${rootBuildDirectory}/targetsResults/Mac OS X.txt".toString(),
'Windows': "${rootBuildDirectory}/targetsResults/Windows 10.txt".toString()]
}
private String getUploadedFile(String fileName) {
def teamcityConfig = System.getenv("TEAMCITY_BUILD_PROPERTIES_FILE")
if (teamcityConfig) {
def buildProperties = new Properties()
buildProperties.load(new FileInputStream(teamcityConfig))
def buildNumber = buildProperties.getProperty("build.number")
def target = System.getProperty("os.name").replaceAll("\\s", "")
return "${target}/${buildNumber}/${fileName}"
}
return null
}
private def uploadBenchmarkResultToArtifactory(String fileName) {
def teamcityConfig = System.getenv("TEAMCITY_BUILD_PROPERTIES_FILE")
if (teamcityConfig) {
def uploadedFile = getUploadedFile(fileName)
def buildProperties = new Properties()
buildProperties.load(new FileInputStream(teamcityConfig))
def password = buildProperties.getProperty("artifactory.apikey")
MPPTools.uploadFileToArtifactory("${artifactoryUrl}", "${artifactoryRepo}",
uploadedFile, "${buildDir.absolutePath}/${fileName}", password)
}
}
// Register external benchmarks reports (e.g. results of libraries benchmarks)
task registerExternalBenchmarks {
doLast {
def reports = externalReports.split(';')
def jsonReports = []
reports.each {
def reportFile = new File(buildDir, it)
if (!reportFile.exists())
return
def lines = reportFile.readLines()
if (lines.size < 4) {
project.logger.warn("Couldn't use report to register benchmarks. Wrong format.")
return
}
def name = lines[0]
def options = lines[1]
if (!options.startsWith("OPTIONS")) {
project.logger.warn("Couldn't use report to register benchmarks. Wrong format in options description.")
return
}
def optionsList = options.replace("OPTIONS ", "").replaceAll("\\[|\\]", "").split(",\\s*").toList()
def status = lines[2]
def compileTime = null
def codeSize = null
lines.drop(3).each {
if (it.startsWith("COMPILE_TIME")) {
compileTime = it
}
if (it.startsWith("CODE_SIZE")) {
codeSize = it
}
}
// Create benchmarks report.
def properties = [
"cpu": System.getProperty("os.arch"),
"os": System.getProperty("os.name"),
"jdkVersion": System.getProperty("java.version"),
"jdkVendor": System.getProperty("java.vendor"),
"kotlinVersion": kotlinVersion,
"type": "native",
"compilerVersion": konanVersion,
"flags": optionsList,
"benchmarks": "[]"]
if (compileTime != null) {
def compileBenchmark = MPPTools.toCompileBenchmark(compileTime, status, name)
properties += ["compileTime": [compileBenchmark]]
}
if (codeSize != null) {
properties += ["codeSize": MPPTools.toCodeSizeBenchmark(codeSize, status, name)]
}
def output = MPPTools.createJsonReport(properties)
def jsonFile = new File(buildDir, it.replace(".txt", ".json"))
jsonFile.write(output)
jsonReports.add(jsonFile)
}
def merged = MPPTools.mergeReports(jsonReports)
if (!merged.isEmpty()) {
mkdir buildDir.absolutePath
new File(buildDir, externalBenchmarksReport).write(merged)
uploadBenchmarkResultToArtifactory(externalBenchmarksReport)
}
}
}
task registerBuild(type: BuildRegister) {
onlyBranch = project.findProperty('kotlin.register.branch')
def uploadedFile = getUploadedFile(nativeJson)
if (uploadedFile != null) {
println("Use file from Artifacrory $uploadedFile")
fileWithResult = uploadedFile
}
// Get bundle size.
bundleSize = null
if (project.findProperty('kotlin.bundleBuild') != null) {
def dist = findProperty('kotlin.native.home') ?: 'dist'
dist = (new File(dist)).isAbsolute() ? dist : "${project.getProjectDir()}/$dist"
bundleSize = (new File(dist)).directorySize()
}
}
task registerExternalBuild(type: BuildRegister) {
onlyBranch = project.findProperty('kotlin.register.branch')
def uploadedFile = getUploadedFile(externalBenchmarksReport)
if (uploadedFile != null) {
println("Use file from Artifacrory $uploadedFile")
fileWithResult = uploadedFile
} else {
fileWithResult = externalBenchmarksReport
}
}
registerExternalBenchmarks.finalizedBy registerExternalBuild
def mergeReports(String fileName) {
def reports = []
subprojects.each {
def reportFile = new File("${it.buildDir.absolutePath}/${fileName}")
if (reportFile.exists()) {
reports.add(reportFile)
}
}
def output = MPPTools.mergeReports(reports)
mkdir buildDir.absolutePath
new File("${buildDir.absolutePath}/${fileName}").write(output)
}
task mergeNativeReports {
doLast {
mergeReports(nativeJson)
uploadBenchmarkResultToArtifactory(nativeJson)
}
}
task mergeJvmReports {
doLast {
mergeReports(jvmJson)
uploadBenchmarkResultToArtifactory(jvmJson)
}
}
subprojects.each {
it.afterEvaluate {
it.jvmJsonReport.finalizedBy mergeJvmReports
it.konanJsonReport.finalizedBy mergeNativeReports
}
}
task teamCityStat(type:Exec) {
def analyzer = findAnalyzerBinary()
if (analyzer != null) {
commandLine "${analyzer}", "-r", "teamcity", "${buildDir.absolutePath}/${nativeJson}"
} else {
println("No analyzer $analyzerTool found in subdirectories of ${rootBuildDirectory}/${analyzerToolDirectory}")
}
}
task cinterop {
dependsOn 'clean'
dependsOn 'cinterop:konanRun'
}
task framework {
dependsOn 'clean'
dependsOn 'framework:konanRun'
}
task helloworld {
dependsOn 'clean'
dependsOn 'helloworld:konanRun'
}
task objcinterop {
dependsOn 'clean'
dependsOn 'objcinterop:konanRun'
}
task ring {
dependsOn 'clean'
dependsOn 'ring:konanRun'
}
task numerical {
dependsOn 'clean'
dependsOn 'numerical:konanRun'
}
task startup {
dependsOn 'clean'
dependsOn 'startup:konanRun'
}
task swiftinterop {
dependsOn 'clean'
dependsOn 'swiftinterop:konanRun'
}
task videoplayer {
dependsOn 'clean'
dependsOn 'videoplayer:konanRun'
}
task KotlinVsSwift {
dependsOn 'clean'
dependsOn 'KotlinVsSwift:konanRun'
}