Build: Take parent directory as rootProject directory in case of buildSrc

This commit is contained in:
Vyacheslav Gerasimov
2019-12-02 21:13:28 +03:00
parent 462d6ac5b6
commit 6ef3831f14
4 changed files with 11 additions and 10 deletions

View File

@@ -20,7 +20,7 @@ buildscript {
}
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.2")
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.3")
}
}

View File

@@ -4,7 +4,7 @@ plugins {
}
group = "org.jetbrains.kotlin"
version = "0.0.2"
version = "0.0.3"
repositories {
mavenCentral()

View File

@@ -1,14 +1,15 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@file:Suppress("unused", "MemberVisibilityCanBePrivate")
import org.gradle.api.Project
import org.gradle.api.initialization.Settings
import org.gradle.api.internal.DynamicObjectAware
import java.io.File
import java.util.*
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
interface PropertiesProvider {
val rootProjectDir: File
fun getProperty(key: String): Any?
@@ -93,7 +94,7 @@ private const val extensionName = "kotlinBuildProperties"
class ProjectProperties(val project: Project) : PropertiesProvider {
override val rootProjectDir: File
get() = project.projectDir
get() = project.rootProject.projectDir.let { if (it.name == "buildSrc") it.parentFile else it }
override fun getProperty(key: String): Any? = project.findProperty(key)
}
@@ -106,7 +107,7 @@ val Project.kotlinBuildProperties: KotlinBuildProperties
class SettingsProperties(val settings: Settings) : PropertiesProvider {
override val rootProjectDir: File
get() = settings.rootDir
get() = settings.rootDir.let { if (it.name == "buildSrc") it.parentFile else it }
override fun getProperty(key: String): Any? {
val obj = (settings as DynamicObjectAware).asDynamicObject

View File

@@ -31,7 +31,7 @@ buildscript {
}
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.2")
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.3")
}
}