Skip to content
This repository was archived by the owner on Mar 26, 2024. It is now read-only.

Commit 1178d53

Browse files
committed
Simplify building with different Intellij Platform dependencies versions
1 parent 3f07c02 commit 1178d53

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed

build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ subprojects {
4040
repositories {
4141
mavenCentral()
4242
maven("https://www.jetbrains.com/intellij-repository/releases")
43+
maven("https://www.jetbrains.com/intellij-repository/snapshots")
4344
maven("https://cache-redirector.jetbrains.com/intellij-dependencies")
4445
}
4546

buildSrc/build.gradle.kts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,33 @@
2121
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2222
* SOFTWARE.
2323
*/
24+
25+
import java.util.*
26+
2427
plugins {
2528
`kotlin-dsl`
2629
}
2730

2831
repositories {
2932
mavenCentral()
33+
maven("https://www.jetbrains.com/intellij-repository/releases")
34+
maven("https://www.jetbrains.com/intellij-repository/snapshots")
35+
maven("https://cache-redirector.jetbrains.com/intellij-dependencies")
36+
}
37+
38+
39+
val gradleProperties = Properties()
40+
val gradlePropertiesFile = project.file("../gradle.properties")
41+
if (gradlePropertiesFile.canRead()) {
42+
gradleProperties.load(gradlePropertiesFile.inputStream())
43+
}
44+
45+
val intellijPlatformVersion: String by gradleProperties
46+
47+
dependencies {
48+
implementation("com.jetbrains.intellij.platform:core:$intellijPlatformVersion") {
49+
exclude(group = "org.jetbrains.kotlin") // cannot find these dependencies
50+
}
3051
}
3152

3253
kotlin {

projector-util-loading/build.gradle.kts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2222
* SOFTWARE.
2323
*/
24+
import com.intellij.openapi.util.BuildNumber
25+
2426
plugins {
2527
kotlin("jvm")
2628
`maven-publish`
@@ -38,13 +40,21 @@ publishToSpace("java")
3840
val coroutinesVersion: String by project
3941
val intellijPlatformVersion: String by project
4042

43+
val intelliJVersionRemovedSuffix = intellijPlatformVersion.takeWhile { it.isDigit() || it == '.' } // in case of EAP
44+
val intellijPlatformBuildNumber = BuildNumber.fromString(intelliJVersionRemovedSuffix)!!
45+
4146
dependencies {
4247
api(project(":projector-util-logging"))
4348

4449
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion")
4550

4651
compileOnly("com.jetbrains.intellij.platform:bootstrap:$intellijPlatformVersion")
47-
compileOnly("com.jetbrains.intellij.platform:util-base:$intellijPlatformVersion")
52+
53+
if (intellijPlatformBuildNumber >= BuildNumber.fromString("213.6461.77")!!) {
54+
compileOnly("com.jetbrains.intellij.platform:util-base:$intellijPlatformVersion")
55+
} else {
56+
compileOnly("com.jetbrains.intellij.platform:util-diagnostic:$intellijPlatformVersion")
57+
}
4858

4959
testImplementation(kotlin("test"))
5060
}

0 commit comments

Comments
 (0)