Skip to content

Commit

Permalink
Initial support for 243
Browse files Browse the repository at this point in the history
  • Loading branch information
l2dy committed Sep 25, 2024
1 parent 1e9d225 commit 7d96373
Show file tree
Hide file tree
Showing 8 changed files with 89 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
strategy:
fail-fast: true
matrix:
platform-version: [ 241, 242 ]
platform-version: [ 241, 242, 243 ]
env:
ORG_GRADLE_PROJECT_buildNumber: ${{ needs.generate-build-number.outputs.build_number }}
ORG_GRADLE_PROJECT_platformVersion: ${{ matrix.platform-version }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ jobs:
# Make sequence from two outputs with version is not possible here.
rust-version: ${{ fromJSON(needs.get-rust-versions.outputs.matrix) }}
base-ide: [ IU ]
platform-version: [ 241, 242 ]
platform-version: [ 241, 242, 243 ]
# it's enough to verify plugin structure only once per platform version
verify-plugin: [ false ]
default-edition-for-tests: [ 2021 ]
Expand Down
30 changes: 26 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ val ideToRun = prop("ideToRun").ifEmpty { baseIDE }
val ideaVersion = prop("ideaVersion")
val baseVersion = versionForIde(baseIDE)
val baseVersionForRun = versionForIde(ideToRun)
val useInstaller = !baseVersion.contains("-EAP-")

val tomlPlugin: String by project
val graziePlugin: String by project
Expand All @@ -34,6 +35,7 @@ val copyrightPlugin = "com.intellij.copyright"
val javaPlugin = "com.intellij.java"
val javaIdePlugin = "com.intellij.java.ide"
val javaScriptPlugin = "JavaScript"
val jsonPlugin = "com.intellij.modules.json"
val mlCompletionPlugin = "com.intellij.completion.ml.ranking"

val compileNativeCodeTaskName = "compileNativeCode"
Expand Down Expand Up @@ -72,6 +74,9 @@ allprojects {
mavenCentral()
intellijPlatform {
defaultRepositories()
if (!useInstaller) {
jetbrainsRuntime()
}
}
}

Expand Down Expand Up @@ -192,10 +197,18 @@ allprojects {

dependencies {
intellijPlatform {
create(baseIDE, baseVersion)
create(baseIDE, baseVersion, useInstaller)
if (!useInstaller) {
jetbrainsRuntime()
}

pluginVerifier()
instrumentationTools()
// BACKCOMPAT: 2024.2. Always include jsonPlugin.
// Also move rust-toml.xml with explicit dependency on JSON plugin back to src.
if (baseVersion.startsWith("243.") || baseVersion.startsWith("2024.3")) {
bundledPlugin(jsonPlugin)
}

// used in MacroExpansionManager.kt and ResolveCommonThreadPool.kt
testFramework(TestFrameworkType.Platform, configurationName = Configurations.INTELLIJ_PLATFORM_DEPENDENCIES)
Expand Down Expand Up @@ -304,7 +317,10 @@ project(":plugin") {
javaPlugin,
)
}
create(baseIDE, baseVersionForRun)
create(baseIDE, baseVersionForRun, useInstaller)
if (!useInstaller) {
jetbrainsRuntime()
}
plugins(pluginList)
bundledPlugins(bundledPluginList)

Expand Down Expand Up @@ -474,7 +490,10 @@ project(":") {
project(":idea") {
dependencies {
intellijPlatform {
create(baseIDE, baseVersion)
create(baseIDE, baseVersion, useInstaller)
if (!useInstaller) {
jetbrainsRuntime()
}

bundledPlugins(listOf(
javaPlugin,
Expand All @@ -491,7 +510,10 @@ project(":idea") {
project(":copyright") {
dependencies {
intellijPlatform {
create(baseIDE, baseVersion)
create(baseIDE, baseVersion, useInstaller)
if (!useInstaller) {
jetbrainsRuntime()
}

bundledPlugins(listOf(copyrightPlugin))
}
Expand Down
15 changes: 15 additions & 0 deletions gradle-243.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Existent IDE versions can be found in the following repos:
# https://www.jetbrains.com/intellij-repository/releases/
# https://www.jetbrains.com/intellij-repository/snapshots/
ideaVersion=243.16718-EAP-CANDIDATE-SNAPSHOT

# https://plugins.jetbrains.com/plugin/8195-toml/versions
tomlPlugin=org.toml.lang:243.15521.25
# https://plugins.jetbrains.com/plugin/12175-grazie-lite/versions
graziePlugin=tanvd.grazi:243.15521.28
# https://plugins.jetbrains.com/plugin/227-psiviewer/versions
psiViewerPlugin=PsiViewer:243.7768

# please see https://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/build_number_ranges.html for description
sinceBuild=243
untilBuild=243.*
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
propertiesPluginEnvironmentNameProperty=platformVersion
# Supported platforms: 241, 242
# Supported platforms: 241, 242, 243
platformVersion=242
# Supported IDEs: IU
baseIDE=IU
Expand Down
42 changes: 42 additions & 0 deletions src/243/test/kotlin/org/rust/TestCompat.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Use of this source code is governed by the MIT license that can be
* found in the LICENSE file.
*/

package org.rust

import com.intellij.ide.util.treeView.smartTree.Sorter
import com.intellij.openapi.actionSystem.DataContext
import com.intellij.platform.navbar.NavBarItemPresentationData
import com.intellij.platform.navbar.backend.NavBarItem
import com.intellij.platform.navbar.backend.impl.pathToItem
import com.intellij.util.concurrency.annotations.RequiresReadLock
import org.jetbrains.annotations.TestOnly

// BACKCOMPAT 2024.1: use directly in RsCombinedVisibilityAlphaSorterTest
val alphaSorterId = Sorter.getAlphaSorterId()

// BACKCOMPAT 2024.1: move to RsNavBarTest
@Suppress("UnstableApiUsage")
@TestOnly
@RequiresReadLock
fun contextNavBarPathStrings(ctx: DataContext): List<String> {
// Navigation bar implementation was split into several modules, which made `navbar.testFramework` test scope only.
//
// See https://youtrack.jetbrains.com/issue/IJPL-850/Split-navigation-bar-implementation-into-several-modules,
// https://github.com/JetBrains/intellij-community/commit/a9e1406257b330d17d2a3f78f47b2d2113eca97c and
// https://github.com/JetBrains/intellij-community/commit/bfa6619891699658f86a7bf8bdf7726a67bc6efd

// Code copied from [platform/navbar/testFramework/src/testFramework.kt](https://github.com/JetBrains/intellij-community/blob/d161fd043392998e10c4551df92634dbda5a06b5/platform/navbar/testFramework/src/testFramework.kt#L34).
val contextItem = NavBarItem.NAVBAR_ITEM_KEY.getData(ctx)
?.dereference()
?: return emptyList()
return contextItem.pathToItem().map {
(it.presentation() as NavBarItemPresentationData).text
}
}

// BACKCOMPAT 2024.1: unwrap to contextNavBarPathStrings
fun contextNavBarPathStringsCompat(ctx: DataContext): List<String> {
return contextNavBarPathStrings(ctx)
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ abstract class RsBuildTaskProvider<T : RsBuildTaskProvider.BuildTask<T>> : Befor

val result = CompletableFuture<Boolean>()
ProjectTaskManager.getInstance(environment.project).build(buildableElement).onProcessed {
result.complete(!it.hasErrors() && !it.isAborted)
result.complete(it != null && !it.hasErrors() && !it.isAborted)
}
return result.get()
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/META-INF/rust-toml.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<idea-plugin>
<depends>com.intellij.modules.json</depends>

<extensions defaultExtensionNs="com.intellij">
<psi.referenceContributor language="TOML"
implementation="org.rust.toml.resolve.CargoTomlReferenceContributor"/>
Expand Down

0 comments on commit 7d96373

Please sign in to comment.