mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-04-24 15:52:46 +00:00
Build: Take parent directory as rootProject directory in case of buildSrc
This commit is contained in:
@@ -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")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ plugins {
|
||||
}
|
||||
|
||||
group = "org.jetbrains.kotlin"
|
||||
version = "0.0.2"
|
||||
version = "0.0.3"
|
||||
|
||||
repositories {
|
||||
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.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
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user