From f96dedd70e6fc677a618dcbc2d06cd5ea1c3c5a7 Mon Sep 17 00:00:00 2001 From: Nikolay Rykunov Date: Tue, 10 Oct 2023 14:43:37 +0200 Subject: [PATCH] Support different IJ versions (232 and 233) for now --- .github/workflows/build.yml | 18 ++++++++++--- buildSrc/src/main/kotlin/IdeaConfiguration.kt | 25 +++++++++++++++++++ buildSrc/src/main/kotlin/LocalProperties.kt | 12 +++++++++ gradle/libs.versions.toml | 17 +++++++++---- ide-laf-bridge/build.gradle.kts | 16 ++++++++++-- .../ide-laf-bridge-232/build.gradle.kts | 14 +++++++++++ .../ide-laf-bridge-233/build.gradle.kts | 14 +++++++++++ settings.gradle.kts | 3 +++ 8 files changed, 109 insertions(+), 10 deletions(-) create mode 100644 buildSrc/src/main/kotlin/IdeaConfiguration.kt create mode 100644 buildSrc/src/main/kotlin/LocalProperties.kt create mode 100644 ide-laf-bridge/ide-laf-bridge-232/build.gradle.kts create mode 100644 ide-laf-bridge/ide-laf-bridge-233/build.gradle.kts diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dc763b0f10..2289703bc3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 @@ -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 @@ -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 diff --git a/buildSrc/src/main/kotlin/IdeaConfiguration.kt b/buildSrc/src/main/kotlin/IdeaConfiguration.kt new file mode 100644 index 0000000000..993ccf047d --- /dev/null +++ b/buildSrc/src/main/kotlin/IdeaConfiguration.kt @@ -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')" + ) + } + } +} \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/LocalProperties.kt b/buildSrc/src/main/kotlin/LocalProperties.kt new file mode 100644 index 0000000000..526aa08f36 --- /dev/null +++ b/buildSrc/src/main/kotlin/LocalProperties.kt @@ -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) +} \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 7f2bf8610a..dc6761c1ca 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -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" @@ -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" } @@ -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" } diff --git a/ide-laf-bridge/build.gradle.kts b/ide-laf-bridge/build.gradle.kts index 7c8b3446cc..952ccdbe41 100644 --- a/ide-laf-bridge/build.gradle.kts +++ b/ide-laf-bridge/build.gradle.kts @@ -1,3 +1,5 @@ +import SupportedIJVersion.* + plugins { jewel `jewel-publish` @@ -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") } -} +} \ No newline at end of file diff --git a/ide-laf-bridge/ide-laf-bridge-232/build.gradle.kts b/ide-laf-bridge/ide-laf-bridge-232/build.gradle.kts new file mode 100644 index 0000000000..3a8d6f7127 --- /dev/null +++ b/ide-laf-bridge/ide-laf-bridge-232/build.gradle.kts @@ -0,0 +1,14 @@ +plugins { + jewel + `jewel-publish` + alias(libs.plugins.composeDesktop) +} + +dependencies { + api(projects.intUi.intUiStandalone) + compileOnly(libs.bundles.idea232) +} + +tasks.withType().configureEach { + enabled = supportedIJVersion() == SupportedIJVersion.IJ_232 +} \ No newline at end of file diff --git a/ide-laf-bridge/ide-laf-bridge-233/build.gradle.kts b/ide-laf-bridge/ide-laf-bridge-233/build.gradle.kts new file mode 100644 index 0000000000..1e17d8916d --- /dev/null +++ b/ide-laf-bridge/ide-laf-bridge-233/build.gradle.kts @@ -0,0 +1,14 @@ +plugins { + jewel + `jewel-publish` + alias(libs.plugins.composeDesktop) +} + +dependencies { + api(projects.intUi.intUiStandalone) + compileOnly(libs.bundles.idea233) +} + +tasks.withType().configureEach { + enabled = supportedIJVersion() == SupportedIJVersion.IJ_233 +} \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index 2ef0906ccc..0d8e601fff 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -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() } @@ -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",