Allow setting path to shared in the root gradle.properties

This commit is contained in:
Ilya Matveev
2019-03-15 15:36:48 +07:00
committed by Nikolay Igotti
parent feabe3b271
commit 4d17460e75
2 changed files with 32 additions and 19 deletions
@@ -15,29 +15,31 @@
*/
buildscript {
ext.rootBuildDirectory = "$rootDir/.."
apply from: "$rootBuildDirectory/gradle/loadRootProperties.gradle"
apply from: "$rootBuildDirectory/gradle/kotlinGradlePlugin.gradle"
val rootBuildDirectory = "$rootDir/.."
extra["rootBuildDirectory"] = rootBuildDirectory
apply(from = "$rootBuildDirectory/gradle/loadRootProperties.gradle")
apply(from = "$rootBuildDirectory/gradle/kotlinGradlePlugin.gradle")
}
val buildKotlinCompilerRepo: String by project
val sharedRepo: String by project
val repos = listOf(
buildKotlinCompilerRepo,
"https://cache-redirector.jetbrains.com/maven-central",
"https://kotlin.bintray.com/kotlinx",
sharedRepo
)
allprojects {
repositories {
maven {
url buildKotlinCompilerRepo
}
maven {
url 'https://cache-redirector.jetbrains.com/maven-central'
}
maven {
url "https://kotlin.bintray.com/kotlinx"
}
maven {
url sharedRepo
repos.forEach { repoUrl ->
maven { setUrl(repoUrl) }
}
}
}
dependencies {
runtime project(':plugins')
runtime(project(":plugins"))
}
@@ -14,8 +14,19 @@
* limitations under the License.
*/
include 'plugins'
import java.util.*
if (hasProperty("sharedProjectPath")) {
include 'shared'
include(":plugins")
// Read properties from the root gradle.properties to allow setting path to K/N shared there.
// We cannot store these properties here so we have to read them once more during configuration of projects.
val rootProperties = Properties().apply {
file("../gradle.properties").inputStream().use { load(it) }
}
// Property specified using a command line option.
val sharedProjectPath: String? by settings
if (sharedProjectPath != null || rootProperties.containsKey("sharedProjectPath")) {
include(":shared")
}