From ae45bbcead4b283c99615c33bfde1c5b1da97f93 Mon Sep 17 00:00:00 2001 From: Kirill Shmakov Date: Sat, 15 Jun 2019 12:47:56 +0300 Subject: [PATCH] Explicit misconfiguration signalization --- buildSrc/build.gradle.kts | 2 +- buildSrc/src/main/kotlin/buildProperties.kt | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index dc6804addbd..d155137de2c 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -122,7 +122,7 @@ allprojects { } } -// TODO: These classes should be omitted once Gradle plugin supports local.properties +// TODO: hide these classes in special gradle plugin for kotlin-ultimate which will support local.properties class LocalBuildPropertiesProvider(private val project: Project) { private val localProperties: Properties = Properties() diff --git a/buildSrc/src/main/kotlin/buildProperties.kt b/buildSrc/src/main/kotlin/buildProperties.kt index c6a17614cab..9e5c4fb1743 100644 --- a/buildSrc/src/main/kotlin/buildProperties.kt +++ b/buildSrc/src/main/kotlin/buildProperties.kt @@ -62,12 +62,19 @@ class KotlinBuildProperties( val isTeamcityBuild: Boolean = getBoolean("teamcity") || System.getenv("TEAMCITY_VERSION") != null - val intellijUltimateEnabled: Boolean = kotlinUltimateExists && (getBoolean("intellijUltimateEnabled") || isTeamcityBuild) + val intellijUltimateEnabled: Boolean + get() { + val explicitlyEnabled = getBoolean("intellijUltimateEnabled") + if (!kotlinUltimateExists && explicitlyEnabled) { + error("intellijUltimateEnabled property is set, while kotlin-ultimate repository is not provided") + } + return kotlinUltimateExists && (explicitlyEnabled || isTeamcityBuild) + } } private const val extensionName = "kotlinBuildFlags" -class ProjectProperties(val project: Project): PropertiesProvider { +class ProjectProperties(val project: Project) : PropertiesProvider { override val rootProjectDir: File get() = project.projectDir @@ -80,7 +87,7 @@ val Project.kotlinBuildProperties: KotlinBuildProperties rootProject.extensions.add(extensionName, it) } -class SettingsProperties(val settings: Settings): PropertiesProvider { +class SettingsProperties(val settings: Settings) : PropertiesProvider { override val rootProjectDir: File get() = settings.rootDir