[gradle-plugin] Allow relative paths in CONFIGURATION_BUILD_DIR

This commit is contained in:
Ilya Matveev
2018-04-12 15:42:28 +07:00
committed by ilmat192
parent 2bf307f823
commit 89e8d43055
2 changed files with 3 additions and 20 deletions
@@ -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
@@ -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: