diff --git a/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/EnvironmentVariables.kt b/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/EnvironmentVariables.kt index 6c032aa0865..a2a3d539361 100644 --- a/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/EnvironmentVariables.kt +++ b/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/EnvironmentVariables.kt @@ -23,7 +23,7 @@ import java.io.File /** * The plugin allows an IDE to specify some building parameters. These parameters * are passed to the plugin via environment variables. Two variables are supported: - * - CONFIGURATION_BUILD_DIR - An absolute path to a destination directory for all compilation tasks. + * - CONFIGURATION_BUILD_DIR - A path to a destination directory for all compilation tasks. * The IDE should take care about specifying different directories * for different targets. This setting has less priority than * an explicitly specified destination directory in the build script. @@ -57,10 +57,10 @@ internal class EnvironmentVariablesUnused: EnvironmentVariables { get() = false } -internal class EnvironmentVariablesImpl: EnvironmentVariables { +internal class EnvironmentVariablesImpl(val project: Project): EnvironmentVariables { override val configurationBuildDir: File? get() = System.getenv("CONFIGURATION_BUILD_DIR")?.let { - File(it).apply { check(isAbsolute) { "A path passed using CONFIGURATION_BUILD_DIR should be absolute" } } + project.file(it) } override val debuggingSymbols: Boolean diff --git a/tools/kotlin-native-gradle-plugin/src/test/groovy/org/jetbrains/kotlin/gradle/plugin/test/EnvVariableSpecification.groovy b/tools/kotlin-native-gradle-plugin/src/test/groovy/org/jetbrains/kotlin/gradle/plugin/test/EnvVariableSpecification.groovy index 43fb1ad8275..2ea5cd99a5d 100644 --- a/tools/kotlin-native-gradle-plugin/src/test/groovy/org/jetbrains/kotlin/gradle/plugin/test/EnvVariableSpecification.groovy +++ b/tools/kotlin-native-gradle-plugin/src/test/groovy/org/jetbrains/kotlin/gradle/plugin/test/EnvVariableSpecification.groovy @@ -199,23 +199,6 @@ class EnvVariableSpecification extends BaseKonanSpecification { } } - @Ignore("The plugin doesn't use env vars until https://github.com/gradle/gradle/issues/3468 is fixed.") - def 'Plugin should throw an exception if CONFIGURATION_BUILD_DIR contains a relative path'() { - when: - def project = createProjectWithWrapper() - project.buildFile.append("""\ - apply plugin: 'konan' - konanArtifacts { - library('main') - } - """.stripIndent()) - def wrapperResult = runWrapper(project, "tasks", ["CONFIGURATION_BUILD_DIR": "some_relative_path"]) - - then: - wrapperResult.getExitValue() != 0 - wrapperResult.getStderr().contains("A path passed using CONFIGURATION_BUILD_DIR should be absolute") - } - @Ignore("The plugin doesn't use env vars until https://github.com/gradle/gradle/issues/3468 is fixed.") def 'Plugin should rerun tasks if CONFIGURATION_BUILD_DIR has been changed'() { when: