diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle.kts similarity index 53% rename from buildSrc/build.gradle rename to buildSrc/build.gradle.kts index b4f4a6a0a9d..e40292be8ec 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle.kts @@ -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")) } diff --git a/buildSrc/settings.gradle b/buildSrc/settings.gradle.kts similarity index 52% rename from buildSrc/settings.gradle rename to buildSrc/settings.gradle.kts index 2c422c764d5..b0728b4268a 100644 --- a/buildSrc/settings.gradle +++ b/buildSrc/settings.gradle.kts @@ -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") } \ No newline at end of file