Build: Take parent directory as rootProject directory in case of buildSrc
This commit is contained in:
@@ -20,7 +20,7 @@ buildscript {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.2")
|
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.3")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = "org.jetbrains.kotlin"
|
group = "org.jetbrains.kotlin"
|
||||||
version = "0.0.2"
|
version = "0.0.3"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|||||||
@@ -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.Project
|
||||||
import org.gradle.api.initialization.Settings
|
import org.gradle.api.initialization.Settings
|
||||||
import org.gradle.api.internal.DynamicObjectAware
|
import org.gradle.api.internal.DynamicObjectAware
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.*
|
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 {
|
interface PropertiesProvider {
|
||||||
val rootProjectDir: File
|
val rootProjectDir: File
|
||||||
fun getProperty(key: String): Any?
|
fun getProperty(key: String): Any?
|
||||||
@@ -93,7 +94,7 @@ private const val extensionName = "kotlinBuildProperties"
|
|||||||
|
|
||||||
class ProjectProperties(val project: Project) : PropertiesProvider {
|
class ProjectProperties(val project: Project) : PropertiesProvider {
|
||||||
override val rootProjectDir: File
|
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)
|
override fun getProperty(key: String): Any? = project.findProperty(key)
|
||||||
}
|
}
|
||||||
@@ -106,7 +107,7 @@ val Project.kotlinBuildProperties: KotlinBuildProperties
|
|||||||
|
|
||||||
class SettingsProperties(val settings: Settings) : PropertiesProvider {
|
class SettingsProperties(val settings: Settings) : PropertiesProvider {
|
||||||
override val rootProjectDir: File
|
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? {
|
override fun getProperty(key: String): Any? {
|
||||||
val obj = (settings as DynamicObjectAware).asDynamicObject
|
val obj = (settings as DynamicObjectAware).asDynamicObject
|
||||||
|
|||||||
+1
-1
@@ -31,7 +31,7 @@ buildscript {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.2")
|
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.3")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user