Skip to content

Commit

Permalink
Merge pull request #92 from witspirit/1670
Browse files Browse the repository at this point in the history
v1.67.0
  • Loading branch information
picimako authored Sep 22, 2024
2 parents fb2dc45 + 43506dc commit 9411c92
Show file tree
Hide file tree
Showing 40 changed files with 439 additions and 278 deletions.
16 changes: 7 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,16 @@ jobs:
gradle-home-cache-cleanup: true

# Run tests
- name: Run Tests
run: ./gradlew check
- name: Run JUnit 5 Tests
run: ./gradlew runTestsInIJCommunity

# Run tests
- name: Run JUnit 5 Tests with K2
run: ./gradlew runTestsWithK2InIJCommunity

# Run tests
- name: Run JUnit 3 Tests
run: ./gradlew testWithJunit3 -Pidea.home.path=./intellij-community
run: ./gradlew runJUnit3TestsInIJCommunity -Pidea.home.path=./intellij-community

# Collect Tests Result of failed tests
- name: Collect Tests Result
Expand All @@ -135,12 +139,6 @@ jobs:
name: tests-result
path: ${{ github.workspace }}/build/reports/tests

# Upload the Kover report to CodeCov
- name: Upload Code Coverage Report
uses: codecov/codecov-action@v4
with:
files: ${{ github.workspace }}/build/reports/kover/report.xml

# Run plugin structure verification along with IntelliJ Plugin Verifier
verify:
name: Verify plugin
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ IntelliJBehave.zip
*.ipr
*.iws
.idea
.intellijPlatform

# Atlassian Plugin Configuration
atlassian-ide-plugin.xml
Expand Down
25 changes: 25 additions & 0 deletions .run/Run Tests - JUnit3.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run Tests - JUnit3" type="GradleRunConfiguration" factoryName="Gradle">
<log_file alias="idea.log" path="$PROJECT_DIR$/build/idea-sandbox/system/log/idea.log" />
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="runJUnit3TestsInIJCommunity" />
</list>
</option>
<option name="vmOptions" value="" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>false</RunAsTest>
<method v="2" />
</configuration>
</component>
25 changes: 25 additions & 0 deletions .run/Run Tests - JUnit5 - K2.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run Tests - JUnit5 - K2" type="GradleRunConfiguration" factoryName="Gradle">
<log_file alias="idea.log" path="$PROJECT_DIR$/build/idea-sandbox/system/log/idea.log" />
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="runTestsWithK2InIJCommunity" />
</list>
</option>
<option name="vmOptions" value="" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>false</RunAsTest>
<method v="2" />
</configuration>
</component>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run Tests" type="GradleRunConfiguration" factoryName="Gradle">
<configuration default="false" name="Run Tests - JUnit5" type="GradleRunConfiguration" factoryName="Gradle">
<log_file alias="idea.log" path="$PROJECT_DIR$/build/idea-sandbox/system/log/idea.log" />
<ExternalSystemSettings>
<option name="executionName" />
Expand All @@ -11,14 +11,15 @@
</option>
<option name="taskNames">
<list>
<option value="test" />
<option value="runTestsInIJCommunity" />
</list>
</option>
<option name="vmOptions" value="" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>false</RunAsTest>
<method v="2" />
</configuration>
</component>
</component>
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@

## [Unreleased]

## [1.67.0]
### Changed
- New supported IDE version range: 2024.2.1 - 2024.3.*.
The previous version, 1.66.0 (and bugfixes of it) of JBehave Support will remain to support IDEs up to version 2024.2.0.2.
- Updated the project to use the IntelliJ Platform Gradle Plugin 2.0.
- Updated the project to use JDK 21.
- Updated project configuration to make sure the plugin works when the K2 Kotlin compiler is enabled.
- Removed a couple of deprecated API usage.

### Fixed
- Fixed the listener that tracks modifications of JBehave step def classes. It no longer fails when it encounters invalid files.
- Fixed a potential exception during highlighting undefined steps.

## [1.66.0]
### Changed
- New supported IDE version range: 2023.2.8 - 2024.2.0.2
Expand Down
166 changes: 117 additions & 49 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,72 +1,83 @@
import org.jetbrains.changelog.Changelog
import org.jetbrains.changelog.markdownToHTML

fun properties(key: String) = providers.gradleProperty(key)
fun environment(key: String) = providers.environmentVariable(key)
import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
import org.jetbrains.intellij.platform.gradle.TestFrameworkType

plugins {
id("java") // Java support
alias(libs.plugins.kotlin) // Kotlin support
alias(libs.plugins.gradleIntelliJPlugin) // Gradle IntelliJ Plugin
alias(libs.plugins.intelliJPlatform) // IntelliJ Platform Gradle Plugin
alias(libs.plugins.changelog) // Gradle Changelog Plugin
}

group = properties("pluginGroup").get()
version = properties("pluginVersion").get()
group = providers.gradleProperty("pluginGroup").get()
version = providers.gradleProperty("pluginVersion").get()

// Set the JVM language level used to build the project. Use Java 11 for 2020.3+, and Java 17 for 2022.2+.
kotlin {
jvmToolchain(21)
}

// Configure project's dependencies
repositories {
mavenCentral()
}

// Set the JVM language level used to build the project. Use Java 11 for 2020.3+, and Java 17 for 2022.2+.
kotlin {
jvmToolchain(17)
// IntelliJ Platform Gradle Plugin Repositories Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-repositories-extension.html
intellijPlatform {
defaultRepositories()
}
}

dependencies {
//https://kotlinlang.org/docs/reflection.html#jvm-dependency
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.9.25")
//JBehave

implementation("org.jbehave:jbehave-core:5.2.0")
testImplementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.25")
testImplementation("org.assertj:assertj-core:3.25.3")

//Testing

//Required for 'junit.framework.TestCase' referenced in 'com.intellij.testFramework.UsefulTestCase'
testImplementation(libs.junit)
testImplementation("org.assertj:assertj-core:3.26.3")
testImplementation("org.junit.jupiter:junit-jupiter-params:5.11.0")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.11.0")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.11.0")
}

// Configure Gradle IntelliJ Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
intellij {
pluginName = properties("pluginName")
version = properties("platformVersion")
type = properties("platformType")
//Others

// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file.
plugins = properties("platformPlugins").map { it.split(',').map(String::trim).filter(String::isNotEmpty) }
}
implementation("org.apache.commons:commons-text:1.12.0")

// Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
changelog {
groups.empty()
repositoryUrl = properties("pluginRepositoryUrl")
}
// IntelliJ Platform Gradle Plugin Dependencies Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html

tasks {
wrapper {
gradleVersion = properties("gradleVersion").get()
intellijPlatform {
create(providers.gradleProperty("platformType"), providers.gradleProperty("platformVersion"))

// Plugin Dependencies. Uses `platformBundledPlugins` property from the gradle.properties file for bundled IntelliJ Platform plugins.
bundledPlugins(providers.gradleProperty("platformBundledPlugins").map { it.split(',') })

// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file for plugin from JetBrains Marketplace.
plugins(providers.gradleProperty("platformPlugins").map { it.split(',') })

instrumentationTools()
pluginVerifier()
zipSigner()
testFramework(TestFrameworkType.Platform)
//Required for 'LightJavaCodeInsightFixtureTestCase5'
testFramework(TestFrameworkType.Plugin.Java)
//Required for the 'com.intellij.testFramework.junit5' package
testFramework(TestFrameworkType.JUnit5)
}
}

patchPluginXml {
version = properties("pluginVersion")
sinceBuild = properties("pluginSinceBuild")
untilBuild = properties("pluginUntilBuild")
// Configure IntelliJ Platform Gradle Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-extension.html
intellijPlatform {
pluginConfiguration {
version = providers.gradleProperty("pluginVersion")

// Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
pluginDescription = providers.fileContents(layout.projectDirectory.file("README.md")).asText.map {
description = providers.fileContents(layout.projectDirectory.file("README.md")).asText.map {
val start = "<!-- Plugin description -->"
val end = "<!-- Plugin description end -->"

with (it.lines()) {
with(it.lines()) {
if (!containsAll(listOf(start, end))) {
throw GradleException("Plugin description section not found in README.md:\n$start ... $end")
}
Expand All @@ -76,7 +87,7 @@ tasks {

val changelog = project.changelog // local variable for configuration cache compatibility
// Get the latest available change notes from the changelog file
changeNotes = properties("pluginVersion").map { pluginVersion ->
changeNotes = providers.gradleProperty("pluginVersion").map { pluginVersion ->
with(changelog) {
renderItem(
(getOrNull(pluginVersion) ?: getUnreleased())
Expand All @@ -86,19 +97,76 @@ tasks {
)
}
}

ideaVersion {
sinceBuild = providers.gradleProperty("pluginSinceBuild")
untilBuild = providers.gradleProperty("pluginUntilBuild")
}
}

test {
useJUnitPlatform()
//Required for running tests in 2021.3 due to it not finding test classes properly.
//See https://app.slack.com/client/T5P9YATH9/C5U8BM1MK/thread/C5U8BM1MK-1639934273.054400
isScanForTestClasses = false
include("**/codeInspector/*Test.class", "**/resolver/*Test.class", "**/utility/*Test.class", "**/service/*Test.class", "**/jbehave/core/steps/*Test.class")
exclude("**/highlighter/*Test.class", "**/parser/*Test.class", "**/spellchecker/*Test.class", "**/structure/*Test.class")
pluginVerification {
ides {
recommended()
}
}
}

tasks.register<Test>("testWithJunit3") {
include("**/highlighter/*Test.class", "**/parser/*Test.class", "**/spellchecker/*Test.class", "**/structure/*Test.class")
exclude("**/highlighter/StoryLocalizedLexer_FrenchTest.class")
intellijPlatformTesting {
val runTestsInIJCommunity by intellijPlatformTesting.testIde.registering {
type = IntelliJPlatformType.IntellijIdeaCommunity
version = "2024.2.1"
task {
useJUnitPlatform {
isScanForTestClasses = false
include("**/codeInspector/*Test.class", "**/resolver/*Test.class", "**/utility/*Test.class", "**/service/*Test.class", "**/jbehave/core/steps/*Test.class")
exclude("**/highlighter/*Test.class", "**/parser/*Test.class", "**/spellchecker/*Test.class", "**/structure/*Test.class")
}
}
}

val runTestsWithK2InIJCommunity by intellijPlatformTesting.testIde.registering {
type = IntelliJPlatformType.IntellijIdeaCommunity
version = "2024.2.1"
task {
//See https://kotlin.github.io/analysis-api/testing-in-k2-locally.html
jvmArgumentProviders += CommandLineArgumentProvider {
listOf("-Didea.kotlin.plugin.use.k2=true")
}
useJUnitPlatform {
isScanForTestClasses = false
include("**/codeInspector/*Test.class", "**/resolver/*Test.class", "**/utility/*Test.class", "**/service/*Test.class", "**/jbehave/core/steps/*Test.class")
exclude("**/highlighter/*Test.class", "**/parser/*Test.class", "**/spellchecker/*Test.class", "**/structure/*Test.class")
}
}
}

val runJUnit3TestsInIJCommunity by intellijPlatformTesting.testIde.registering {
type = IntelliJPlatformType.IntellijIdeaCommunity
version = "2024.2.1"
task {
useJUnit {
include("**/highlighter/*Test.class", "**/parser/*Test.class", "**/spellchecker/*Test.class", "**/structure/*Test.class")
exclude("**/highlighter/StoryLocalizedLexer_FrenchTest.class")
}
}
}
}

//Uncomment this to start the IDE with the K2 Kotlin compiler enabled
//tasks.named<RunIdeTask>("runIde") {
// jvmArgumentProviders += CommandLineArgumentProvider {
// listOf("-Didea.kotlin.plugin.use.k2=true")
// }
//}

// Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
changelog {
groups.empty()
repositoryUrl = providers.gradleProperty("pluginRepositoryUrl")
}

tasks {
wrapper {
gradleVersion = providers.gradleProperty("gradleVersion").get()
}
}
14 changes: 8 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,22 @@ pluginGroup = com.github.kumaraman21.intellijbehave
pluginName = JBehave Support
pluginRepositoryUrl = https://github.com/witspirit/IntelliJBehave
# SemVer format -> https://semver.org
pluginVersion = 1.66.0
pluginVersion = 1.67.0

# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
pluginSinceBuild = 232.10335.12
# 2024.2.0.2
pluginUntilBuild = 242.20224.419
pluginSinceBuild = 242.21829.142
pluginUntilBuild = 243.*

# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension
platformType = IC
platformVersion = 2023.2.8
platformVersion = 2024.2.1

# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22
platformPlugins = java,Kotlin
platformPlugins =

# Example: platformBundledPlugins = com.intellij.java
platformBundledPlugins = com.intellij.java,org.jetbrains.kotlin

# Gradle Releases -> https://github.com/gradle/gradle/releases
gradleVersion = 8.9
Expand Down
Loading

0 comments on commit 9411c92

Please sign in to comment.