Move 'cidrPluginsEnabled' Gradle flag to local.properties
This commit is contained in:
@@ -4,5 +4,3 @@ cacheRedirectorEnabled=true
|
||||
|
||||
#buildSrc.kotlin.repo=https://jcenter.bintray.com
|
||||
#buildSrc.kotlin.version=1.1.50
|
||||
|
||||
#cidrPluginsEnabled=true
|
||||
|
||||
@@ -12,8 +12,52 @@ pluginManagement {
|
||||
|
||||
include "prepare-deps"
|
||||
|
||||
def includeCidrPlugins = hasProperty("cidrPluginsEnabled") && Boolean.parseBoolean(cidrPluginsEnabled) && file("../kotlin-ultimate").exists()
|
||||
if (includeCidrPlugins) {
|
||||
def flags = new LocalBuildProperties(settings as Settings)
|
||||
|
||||
if (flags.includeCidrPlugins) {
|
||||
logger.info("Including CIDR plugins in buildSrc/settings.gradle")
|
||||
include ":prepare-deps:kotlin-native-platform-deps"
|
||||
project(":prepare-deps:kotlin-native-platform-deps").projectDir = file("../kotlin-ultimate/buildSrc/prepare-deps/kotlin-native-platform-deps")
|
||||
project(":prepare-deps:kotlin-native-platform-deps").projectDir = file("${flags.propertiesProvider.rootProjectDir}/kotlin-ultimate/buildSrc/prepare-deps/kotlin-native-platform-deps")
|
||||
} else {
|
||||
logger.info("NOT including CIDR plugins in buildSrc/settings.gradle")
|
||||
}
|
||||
|
||||
class LocalBuildPropertiesProvider {
|
||||
private Settings settings
|
||||
private Properties localProperties = new Properties()
|
||||
|
||||
File rootProjectDir
|
||||
|
||||
LocalBuildPropertiesProvider(Settings settings) {
|
||||
this.settings = settings
|
||||
this.rootProjectDir = settings.rootProject.projectDir.parentFile
|
||||
|
||||
File propertiesFile = new File(rootProjectDir, 'local.properties')
|
||||
if (propertiesFile.isFile()) {
|
||||
propertiesFile.withInputStream { localProperties.load(it) }
|
||||
}
|
||||
}
|
||||
|
||||
String getString(String name) {
|
||||
if (settings.hasProperty(name)) {
|
||||
return settings[name]?.toString()
|
||||
} else {
|
||||
return localProperties[name]?.toString()
|
||||
}
|
||||
}
|
||||
|
||||
Boolean getBoolean(String name) {
|
||||
return Boolean.parseBoolean(getString(name))
|
||||
}
|
||||
}
|
||||
|
||||
class LocalBuildProperties {
|
||||
LocalBuildPropertiesProvider propertiesProvider
|
||||
|
||||
boolean includeCidrPlugins
|
||||
|
||||
LocalBuildProperties(Settings settings) {
|
||||
propertiesProvider = new LocalBuildPropertiesProvider(settings)
|
||||
includeCidrPlugins = propertiesProvider.getBoolean('cidrPluginsEnabled') && new File(propertiesProvider.rootProjectDir, 'kotlin-ultimate').exists()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ class KotlinBuildProperties(
|
||||
|
||||
private operator fun get(key: String): Any? = localProperties.getProperty(key) ?: propertiesProvider.getProperty(key)
|
||||
|
||||
private fun getBoolean(key: String): Boolean = this[key]?.toString() == "true"
|
||||
private fun getBoolean(key: String): Boolean = this[key]?.toString()?.toBoolean() == true
|
||||
|
||||
val isJpsBuildEnabled: Boolean = getBoolean("jpsBuild")
|
||||
|
||||
@@ -55,6 +55,9 @@ class KotlinBuildProperties(
|
||||
|
||||
val useBootstrapStdlib: Boolean
|
||||
get() = isInJpsBuildIdeaSync
|
||||
|
||||
val includeCidrPlugins: Boolean =
|
||||
getBoolean("cidrPluginsEnabled") && propertiesProvider.rootProjectDir.resolve("kotlin-ultimate").exists()
|
||||
}
|
||||
|
||||
private const val extensionName = "kotlinBuildFlags"
|
||||
|
||||
+2
-1
@@ -9,6 +9,7 @@ kotlin.compiler.newInferenceEnabled=true
|
||||
#bootstrap.kotlin.version=1.1.50-dev-1451
|
||||
#signingRequired=true
|
||||
|
||||
#jpsBuild=true
|
||||
## The following properties can be added to your local.properties file to customize the build:
|
||||
|
||||
#jpsBuild=true
|
||||
#cidrPluginsEnabled=true
|
||||
|
||||
+3
-4
@@ -222,8 +222,9 @@ include ":kotlin-build-common",
|
||||
":kotlin-serialization-unshaded",
|
||||
":kotlin-serialization:plugin-marker"
|
||||
|
||||
def includeCidrPlugins = hasProperty("cidrPluginsEnabled") && Boolean.parseBoolean(cidrPluginsEnabled) && file("kotlin-ultimate").exists()
|
||||
if (includeCidrPlugins) {
|
||||
def flags = BuildPropertiesKt.getKotlinBuildPropertiesForSettings(settings)
|
||||
|
||||
if (flags.includeCidrPlugins) {
|
||||
logger.info("Including CIDR plugins in settings.gradle")
|
||||
include ":kotlin-ultimate:ide:cidr-native",
|
||||
":kotlin-ultimate:ide:clion-native",
|
||||
@@ -244,8 +245,6 @@ if (isTeamcityBuild || includeUltimate) {
|
||||
)
|
||||
}
|
||||
|
||||
def flags = BuildPropertiesKt.getKotlinBuildPropertiesForSettings(settings)
|
||||
|
||||
if (flags.inJpsBuildIdeaSync) {
|
||||
include ":kotlin-stdlib:jps-build"
|
||||
project(":kotlin-stdlib:jps-build").projectDir = "$rootDir/libraries/stdlib/jps-build" as File
|
||||
|
||||
Reference in New Issue
Block a user