1- import org.jetbrains.kotlin.konan.target.*
2-
31plugins {
42 kotlin(" jvm" )
53}
@@ -10,75 +8,21 @@ repositories {
108
119evaluationDependsOn(" :kotlinx-benchmark-runtime" )
1210
13- val Gradle .isConfigurationCacheAvailable
14- get() = try {
15- val startParameters = gradle.startParameter
16- startParameters.javaClass.getMethod(" isConfigurationCache" )
17- .invoke(startParameters) as ? Boolean
18- } catch (_: Exception ) {
19- null
20- } ? : false
21-
22- fun Project.getSystemProperty (key : String ): String? {
23- return if (gradle.isConfigurationCacheAvailable) {
24- providers.systemProperty(key).forUseAtConfigurationTime().orNull
25- } else {
26- System .getProperty(key)
27- }
28- }
29-
30- val nativeTargetName
31- get() = when {
32- project.getSystemProperty(" idea.active" ) == " true" -> if (HostManager .hostIsMac) " darwin" else " native"
33- HostManager .hostIsLinux -> " linuxX64"
34- HostManager .hostIsMingw -> " mingwX64"
35- HostManager .host == KonanTarget .MACOS_X64 -> " macosX64"
36- HostManager .host == KonanTarget .MACOS_ARM64 -> " macosArm64"
37- else -> error(" Unknown host: ${HostManager .host} " )
38- }
39-
4011val runtime get() = project(" :kotlinx-benchmark-runtime" )
4112val plugin get() = gradle.includedBuild(" plugin" )
4213
43- val AbstractArchiveTask .archiveFilePath get() = archiveFile.get().asFile.path
44-
45- fun artifactsTask (artifact : String ) = runtime.tasks.getByName<AbstractArchiveTask >(" ${artifact} Jar" )
46- fun artifactsTaskNativeKlibs () = runtime.tasks.getByName(" compileKotlin${nativeTargetName.capitalize()} " )
47-
48- fun Task.klibs (): String = outputs.files.filter { it.extension == " klib" }.joinToString(" \n " )
49-
50- fun IncludedBuild.classpath () = projectDir.resolve(" build/createClasspathManifest" )
51-
52- val createClasspathManifest by tasks.registering {
53- dependsOn(plugin.task(" :createClasspathManifest" ))
54- dependsOn(artifactsTask(" jvm" ))
55- dependsOn(artifactsTask(" jsIr" ))
56- dependsOn(artifactsTask(" wasm" ))
57- dependsOn(artifactsTask(" allMetadata" ))
58- dependsOn(artifactsTaskNativeKlibs())
59-
60- val outputDir = file(" $buildDir /$name " )
61- outputs.dir(outputDir)
62- doLast {
63- outputDir.apply {
64- mkdirs()
65- resolve(" plugin-classpath.txt" ).writeText(plugin.classpath().resolve(" plugin-classpath.txt" ).readText())
66- resolve(" runtime-metadata.txt" ).writeText(artifactsTask(" allMetadata" ).archiveFilePath)
67- resolve(" runtime-jvm.txt" ).writeText(artifactsTask(" jvm" ).archiveFilePath)
68- resolve(" runtime-jsIr.txt" ).writeText(artifactsTask(" jsIr" ).archiveFilePath)
69- resolve(" runtime-wasm.txt" ).writeText(artifactsTask(" wasm" ).archiveFilePath)
70- resolve(" runtime-native.txt" ).writeText(artifactsTaskNativeKlibs().klibs())
71- }
72- }
73- }
74-
7514dependencies {
76- implementation(files(createClasspathManifest))
7715 implementation(gradleTestKit())
7816
7917 testImplementation(kotlin(" test-junit" ))
8018}
8119
8220tasks.test {
21+ dependsOn(plugin.task(" :publishToBuildLocal" ))
22+ dependsOn(runtime.tasks.getByName(" publishToBuildLocal" ))
23+
24+ systemProperty(" plugin_repo_url" , plugin.projectDir.resolve(" build/maven" ).absoluteFile.invariantSeparatorsPath)
25+ systemProperty(" runtime_repo_url" , rootProject.buildDir.resolve(" maven" ).absoluteFile.invariantSeparatorsPath)
8326 systemProperty(" kotlin_repo_url" , rootProject.properties[" kotlin_repo_url" ])
27+ systemProperty(" kotlin_version" , rootProject.properties[" kotlin_version" ]!! )
8428}
0 commit comments