1 /* 2 * Copyright 2016-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. 3 */ 4 5 package kotlinx.atomicfu.gradle.plugin.test.framework.runner 6 7 import java.io.File 8 9 internal const val ATOMICFU_VERSION = "atomicfu_version" 10 internal const val KOTLIN_VERSION = "kotlin_version" 11 internal const val ENABLE_JVM_IR_TRANSFORMATION = "kotlinx.atomicfu.enableJvmIrTransformation" 12 internal const val ENABLE_JS_IR_TRANSFORMATION = "kotlinx.atomicfu.enableJsIrTransformation" 13 internal const val ENABLE_NATIVE_IR_TRANSFORMATION = "kotlinx.atomicfu.enableNativeIrTransformation" 14 internal const val DUMMY_VERSION = "DUMMY_VERSION" 15 16 internal val atomicfuVersion = System.getProperty("atomicfuVersion") 17 internal val kotlinVersion = System.getProperty("kotlinVersion") 18 19 internal val gradleWrapperDir = File("..") 20 21 internal val projectExamplesDir = File("examples") 22 getLocalRepoDirnull23internal fun getLocalRepoDir(targetDir: File): File = 24 targetDir.resolve("build/.m2/").also { 25 require(it.exists() && it.isDirectory) { "Could not find local repository `build/.m2/` in the project directory: ${targetDir.path}" } 26 } 27 28 // The project is published in the local repo directory /build/.m2/ with DUMMY_VERSION getSampleProjectJarModuleFilenull29internal fun getSampleProjectJarModuleFile(targetDir: File, projectName: String): File = 30 getLocalRepoDir(targetDir).resolve("kotlinx/atomicfu/examples/$projectName/$DUMMY_VERSION").walkBottomUp() 31 .singleOrNull { it.name.endsWith(".module") } ?: error("Could not find jar module file in local repository of the project $projectName: ${getLocalRepoDir(targetDir)}") 32