Files
kotlin-fork/performance/framework/build.gradle
T
Ilya Matveev 127ba155c7 Build: Replace buildSrc with a separate included build (#3104)
Gradle doesn't allow us to substitute dependencies of buildSrc
with artifacts provided by a composite build. But our buildSrc
depends on kotlin-native-utils provided by the Big Kotlin repo.
Thus we cannot make changes in kotlin-native-utils and use them
in buildSrc during a development process.

This patch fixes the issue by transforming buildSrc into a separate
included build.
2019-06-27 17:20:53 +07:00

109 lines
3.6 KiB
Groovy

import org.jetbrains.kotlin.MPPTools
import org.jetbrains.kotlin.PlatformInfo
import org.jetbrains.kotlin.RunJvmTask
buildscript {
apply from: "$rootProject.projectDir/gradle/kotlinGradlePlugin.gradle"
repositories {
maven {
url 'https://cache-redirector.jetbrains.com/jcenter'
}
}
}
apply plugin: 'kotlin-multiplatform'
repositories {
maven {
url 'https://cache-redirector.jetbrains.com/jcenter'
}
maven {
url kotlinCompilerRepo
}
maven {
url buildKotlinCompilerRepo
}
}
def toolsPath = '../../tools'
def frameworkName = 'benchmarksAnalyzer'
kotlin {
sourceSets {
macosMain {
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-common:$kotlinVersion"
}
kotlin.srcDir "$toolsPath/benchmarks/shared/src"
kotlin.srcDir "$toolsPath/benchmarksAnalyzer/src/main/kotlin"
kotlin.srcDir "$toolsPath/kliopt"
kotlin.srcDir "$toolsPath/benchmarksAnalyzer/src/main/kotlin-native"
}
}
configure([macosX64("macos")]) {
compilations.main.cinterops {
libcurl {
defFile "$toolsPath/benchmarksAnalyzer/src/nativeInterop/cinterop/libcurl.def"
}
}
}
macosX64("macos").binaries {
framework(frameworkName, [RELEASE])
}
}
MPPTools.addTimeListener(project)
task konanRun {
if (PlatformInfo.isMac()) {
dependsOn 'build'
}
}
task jvmRun(type: RunJvmTask) {
doLast {
println("JVM run is unsupported")
}
}
task konanJsonReport {
doLast {
if (PlatformInfo.isMac()) {
def applicationName = "FrameworkBenchmarksAnalyzer"
def frameworkPath = kotlin.macosX64("macos").binaries.
getFramework(frameworkName, kotlin.macosX64("macos").binaries.RELEASE).outputFile.absolutePath
def nativeExecutable = new File("$frameworkPath/$frameworkName").canonicalPath
def nativeCompileTime = MPPTools.getNativeCompileTime(applicationName, ['compileKotlinMacos',
'linkBenchmarksAnalyzerReleaseFrameworkMacos',
'cinteropLibcurlMacos'])
def properties = getCommonProperties() + ['type' : 'native',
'compilerVersion': "${konanVersion}".toString(),
'flags' : [],
'benchmarks' : '[]',
'compileTime' : [nativeCompileTime],
'codeSize' : MPPTools.getCodeSizeBenchmark(applicationName, nativeExecutable)]
def output = MPPTools.createJsonReport(properties)
new File("${buildDir.absolutePath}/${nativeJson}").write(output)
}
}
}
task jvmJsonReport {
doLast {
println("JVM run is unsupported")
}
}
jvmRun.finalizedBy jvmJsonReport
konanRun.finalizedBy konanJsonReport
private def getCommonProperties() {
return ['cpu': System.getProperty("os.arch"),
'os': System.getProperty("os.name"), // OperatingSystem.current().getName()
'jdkVersion': System.getProperty("java.version"), // org.gradle.internal.jvm.Jvm.current().javaVersion
'jdkVendor': System.getProperty("java.vendor"),
'kotlinVersion': "${kotlinVersion}".toString()]
}