From 2a6ef9c471ee708c2a0359d772ac02adac2bd381 Mon Sep 17 00:00:00 2001 From: Art Pinch Date: Tue, 15 Feb 2022 18:03:08 +0300 Subject: [PATCH] Simplify building with different Intellij Platform dependencies versions --- build.gradle.kts | 1 + buildSrc/build.gradle.kts | 21 +++++++++++++++++++++ projector-util-loading/build.gradle.kts | 12 +++++++++++- 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 3eecc7e25..4bdfbdc89 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -40,6 +40,7 @@ subprojects { repositories { mavenCentral() maven("https://www.jetbrains.com/intellij-repository/releases") + maven("https://www.jetbrains.com/intellij-repository/snapshots") maven("https://cache-redirector.jetbrains.com/intellij-dependencies") } diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index cffaec99e..41a630794 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -21,12 +21,33 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ + +import java.util.* + plugins { `kotlin-dsl` } repositories { mavenCentral() + maven("https://www.jetbrains.com/intellij-repository/releases") + maven("https://www.jetbrains.com/intellij-repository/snapshots") + maven("https://cache-redirector.jetbrains.com/intellij-dependencies") +} + + +val gradleProperties = Properties() +val gradlePropertiesFile = project.file("../gradle.properties") +if (gradlePropertiesFile.canRead()) { + gradleProperties.load(gradlePropertiesFile.inputStream()) +} + +val intellijPlatformVersion: String by gradleProperties + +dependencies { + implementation("com.jetbrains.intellij.platform:core:$intellijPlatformVersion") { + exclude(group = "org.jetbrains.kotlin") // cannot find these dependencies + } } kotlin { diff --git a/projector-util-loading/build.gradle.kts b/projector-util-loading/build.gradle.kts index 79a53e72c..baadc89cb 100644 --- a/projector-util-loading/build.gradle.kts +++ b/projector-util-loading/build.gradle.kts @@ -21,6 +21,8 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ +import com.intellij.openapi.util.BuildNumber + plugins { kotlin("jvm") `maven-publish` @@ -38,13 +40,21 @@ publishToSpace("java") val coroutinesVersion: String by project val intellijPlatformVersion: String by project +val intelliJVersionRemovedSuffix = intellijPlatformVersion.takeWhile { it.isDigit() || it == '.' } // in case of EAP +val intellijPlatformBuildNumber = BuildNumber.fromString(intelliJVersionRemovedSuffix)!! + dependencies { api(project(":projector-util-logging")) implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion") compileOnly("com.jetbrains.intellij.platform:bootstrap:$intellijPlatformVersion") - compileOnly("com.jetbrains.intellij.platform:util-base:$intellijPlatformVersion") + + if (intellijPlatformBuildNumber >= BuildNumber.fromString("213.6461.77")!!) { + compileOnly("com.jetbrains.intellij.platform:util-base:$intellijPlatformVersion") + } else { + compileOnly("com.jetbrains.intellij.platform:util-diagnostic:$intellijPlatformVersion") + } testImplementation(kotlin("test")) }