Skip to content

Commit

Permalink
Support different IJ versions (232 and 233) for now
Browse files Browse the repository at this point in the history
  • Loading branch information
Walingar committed Oct 10, 2023
1 parent 89934c1 commit f96dedd
Show file tree
Hide file tree
Showing 8 changed files with 109 additions and 10 deletions.
18 changes: 15 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ jobs:
assemble:
runs-on: ubuntu-latest

strategy:
matrix:
supported-ij-version:
- 232
- 233

steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
Expand All @@ -20,11 +26,17 @@ jobs:
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Run :assemble task
run: ./gradlew assemble
run: ./gradlew assemble -Psupported.ij.version=${{ matrix.supported-ij-version }}

checks:
runs-on: ubuntu-latest

strategy:
matrix:
supported-ij-version:
- 232
- 233

steps:
- uses: actions/checkout@v3

Expand All @@ -39,11 +51,11 @@ jobs:
run: chmod +x gradlew

- name: Run :check task
run: ./gradlew check --continue
run: ./gradlew check -Psupported.ij.version=${{ matrix.supported-ij-version }} --continue

- name: Merge SARIF reports
# Necessary because upload-sarif only takes up to 15 SARIF files and we have more
run: ./gradlew :mergeSarifReports
run: ./gradlew :mergeSarifReports -Psupported.ij.version=${{ matrix.supported-ij-version }}
if: ${{ always() }}

- uses: github/codeql-action/upload-sarif@v2
Expand Down
25 changes: 25 additions & 0 deletions buildSrc/src/main/kotlin/IdeaConfiguration.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import org.gradle.api.Project

enum class SupportedIJVersion {
IJ_232,
IJ_233
}

fun Project.supportedIJVersion(): SupportedIJVersion {
val prop = localProperty("supported.ij.version")
?: error(
"'supported.ij.version' gradle property is missing. " +
"Please, provide it using local.properties file or -Psupported.ij.version argument in CLI"
)

return when (prop) {
"232" -> SupportedIJVersion.IJ_232
"233" -> SupportedIJVersion.IJ_233
else -> {
error(
"Invalid 'supported.ij.version' with value '$prop' is provided. " +
"It should be in set of these values: ('232', '233')"
)
}
}
}
12 changes: 12 additions & 0 deletions buildSrc/src/main/kotlin/LocalProperties.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import org.gradle.api.Project
import java.util.Properties

internal fun Project.localProperty(propertyName: String): String? {
val localPropertiesFile = rootProject.file("local.properties")
if (!localPropertiesFile.exists()) {
return null
}
val properties = Properties()
localPropertiesFile.inputStream().use { properties.load(it) }
return properties.getProperty(propertyName)
}
17 changes: 12 additions & 5 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
composeDesktop = "1.5.2"
coroutines = "1.7.3"
detekt = "1.23.1"
idea = "232.8660.185"
idea232 = "232.8660.185"
idea233 = "233.9102.97-EAP-SNAPSHOT"
ideaGradlePlugin = "1.15.0"
javaSarif = "2.0"
kotlinSarif = "0.4.0"
Expand All @@ -17,9 +18,14 @@ javaSarif = { module = "com.contrastsecurity:java-sarif", version.ref = "javaSar
kotlinSarif = { module = "io.github.detekt.sarif4k:sarif4k", version.ref = "kotlinSarif" }
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinxSerialization" }
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" }
ij-platform-ide-core = { module = "com.jetbrains.intellij.platform:ide-core", version.ref = "idea" }
ij-platform-ide-impl = { module = "com.jetbrains.intellij.platform:ide-impl", version.ref = "idea" }
ij-platform-core-ui = { module = "com.jetbrains.intellij.platform:core-ui", version.ref = "idea" }

ij-platform-ide-core-232 = { module = "com.jetbrains.intellij.platform:ide-core", version.ref = "idea232" }
ij-platform-ide-impl-232 = { module = "com.jetbrains.intellij.platform:ide-impl", version.ref = "idea232" }
ij-platform-core-ui-232 = { module = "com.jetbrains.intellij.platform:core-ui", version.ref = "idea232" }

ij-platform-ide-core-233 = { module = "com.jetbrains.intellij.platform:ide-core", version.ref = "idea233" }
ij-platform-ide-impl-233 = { module = "com.jetbrains.intellij.platform:ide-impl", version.ref = "idea233" }
ij-platform-core-ui-233 = { module = "com.jetbrains.intellij.platform:core-ui", version.ref = "idea233" }

# Plugin libraries for build-logic's convention plugins to use to resolve the types/tasks coming from these plugins
detekt-gradlePlugin = { module = "io.gitlab.arturbosch.detekt:detekt-gradle-plugin", version.ref = "detekt" }
Expand All @@ -29,7 +35,8 @@ dokka-gradlePlugin = { module = "org.jetbrains.dokka:dokka-gradle-plugin", versi
kotlinpoet = { module = "com.squareup:kotlinpoet", version.ref = "kotlinpoet" }

[bundles]
idea = ["ij-platform-ide-core", "ij-platform-ide-impl", "ij-platform-core-ui"]
idea232 = ["ij-platform-ide-core-232", "ij-platform-ide-impl-232", "ij-platform-core-ui-232"]
idea233 = ["ij-platform-ide-core-233", "ij-platform-ide-impl-233", "ij-platform-core-ui-233"]

[plugins]
composeDesktop = { id = "org.jetbrains.compose", version.ref = "composeDesktop" }
Expand Down
16 changes: 14 additions & 2 deletions ide-laf-bridge/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import SupportedIJVersion.*

plugins {
jewel
`jewel-publish`
Expand All @@ -6,10 +8,20 @@ plugins {

dependencies {
api(projects.intUi.intUiStandalone)
compileOnly(libs.bundles.idea)
when (supportedIJVersion()) {
IJ_232 -> {
api(projects.ideLafBridge.ideLafBridge232)
compileOnly(libs.bundles.idea232)
}

IJ_233 -> {
api(projects.ideLafBridge.ideLafBridge233)
compileOnly(libs.bundles.idea233)
}
}

testImplementation(compose.desktop.uiTestJUnit4)
testImplementation(compose.desktop.currentOs) {
exclude(group = "org.jetbrains.compose.material")
}
}
}
14 changes: 14 additions & 0 deletions ide-laf-bridge/ide-laf-bridge-232/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
plugins {
jewel
`jewel-publish`
alias(libs.plugins.composeDesktop)
}

dependencies {
api(projects.intUi.intUiStandalone)
compileOnly(libs.bundles.idea232)
}

tasks.withType<AbstractPublishToMaven>().configureEach {
enabled = supportedIJVersion() == SupportedIJVersion.IJ_232
}
14 changes: 14 additions & 0 deletions ide-laf-bridge/ide-laf-bridge-233/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
plugins {
jewel
`jewel-publish`
alias(libs.plugins.composeDesktop)
}

dependencies {
api(projects.intUi.intUiStandalone)
compileOnly(libs.bundles.idea233)
}

tasks.withType<AbstractPublishToMaven>().configureEach {
enabled = supportedIJVersion() == SupportedIJVersion.IJ_233
}
3 changes: 3 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ dependencyResolutionManagement {
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
maven("https://androidx.dev/storage/compose-compiler/repository/")
maven("https://www.jetbrains.com/intellij-repository/releases")
maven("https://www.jetbrains.com/intellij-repository/snapshots")
maven("https://cache-redirector.jetbrains.com/intellij-dependencies")
mavenCentral()
}
Expand All @@ -27,6 +28,8 @@ dependencyResolutionManagement {
include(
":core",
":ide-laf-bridge",
":ide-laf-bridge:ide-laf-bridge-232",
":ide-laf-bridge:ide-laf-bridge-233",
":samples:standalone",
":samples:ide-plugin",
":int-ui:int-ui-core",
Expand Down

0 comments on commit f96dedd

Please sign in to comment.