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 { buildscript {
ext.rootBuildDirectory = "$rootDir/.." val rootBuildDirectory = "$rootDir/.."
apply from: "$rootBuildDirectory/gradle/loadRootProperties.gradle" extra["rootBuildDirectory"] = rootBuildDirectory
apply from: "$rootBuildDirectory/gradle/kotlinGradlePlugin.gradle" 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 { allprojects {
repositories { repositories {
maven { repos.forEach { repoUrl ->
url buildKotlinCompilerRepo maven { setUrl(repoUrl) }
}
maven {
url 'https://cache-redirector.jetbrains.com/maven-central'
}
maven {
url "https://kotlin.bintray.com/kotlinx"
}
maven {
url sharedRepo
} }
} }
} }
dependencies { dependencies {
runtime project(':plugins') runtime(project(":plugins"))
} }
@@ -14,8 +14,19 @@
* limitations under the License. * limitations under the License.
*/ */
include 'plugins' import java.util.*
if (hasProperty("sharedProjectPath")) { include(":plugins")
include 'shared'
// 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")
} }