Skip to content

Commit

Permalink
JGiven-10: migrate to new gradle provider
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Oertel <christian.oertel@partner.bmwgroup.com>
  • Loading branch information
Christian Oertel committed Sep 20, 2024
1 parent d67117e commit 58756dc
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 14 deletions.
42 changes: 29 additions & 13 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
import org.jetbrains.intellij.platform.gradle.TestFrameworkType
import org.jetbrains.kotlin.gradle.plugin.getKotlinPluginVersion
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

val jetbrainsPublishUsername: String? by project
val jetbrainsPublishToken: String? by project

plugins {
id("org.jetbrains.intellij") version "1.17.4"
id("org.jetbrains.intellij.platform") version "2.0.1"
id("org.jetbrains.intellij.platform.migration") version "2.0.1"
kotlin("jvm") version "2.0.20"
}
val kotlinVersion = project.getKotlinPluginVersion()
//val kotlinVersion = project.getKotlinPluginVersion()

configure<JavaPluginExtension> {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}

tasks {
withType<KotlinCompile> {
kotlinOptions.jvmTarget = "17"
kotlinOptions.jvmTarget = "21"
}
buildSearchableOptions {
enabled = false
Expand All @@ -26,22 +28,36 @@ tasks {

repositories {
mavenCentral()
intellijPlatform {
defaultRepositories()
}
}

intellij {
version.set("IC-2023.3")
pluginName.set("jgiven-intellij-plugin")
plugins.set(listOf("java"))
}
//intellij {
// version.set("IC-2024.2")
// pluginName.set("jgiven-intellij-plugin")
// plugins.set(listOf("java"))
//}

dependencies {
implementation(kotlin("stdlib", kotlinVersion))
intellijPlatform {
intellijIdeaCommunity("2024.2.2")
bundledPlugin("com.intellij.java")
instrumentationTools()

testFramework(TestFrameworkType.Plugin.Java)
}

//implementation(kotlin("stdlib", kotlinVersion))

testImplementation(kotlin("stdlib-jdk7", kotlinVersion))
testImplementation("com.tngtech.jgiven:jgiven-junit:1.2.5")
//testImplementation(kotlin("stdlib-jdk7", kotlinVersion))
testImplementation("com.tngtech.jgiven:jgiven-junit:1.3.0")
testImplementation("com.tngtech.junit.dataprovider:junit4-dataprovider:2.10")
testImplementation("org.assertj:assertj-core:3.24.2")
testImplementation("org.mockito:mockito-core:5.13.0")
testImplementation("org.opentest4j:opentest4j:1.3.0")

//testRuntimeOnly("junit:junit:4.13.2")
}

inline operator fun <T : Task> T.invoke(a: T.() -> Unit): T = apply(a)
9 changes: 8 additions & 1 deletion src/test/java/com/tngtech/jgiven/LibraryTestUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,19 @@ import com.intellij.openapi.util.Ref
import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess
import com.intellij.testFramework.PsiTestUtil
import com.tngtech.jgiven.annotation.ScenarioState
import org.junit.Ignore
import java.io.File

class LibraryTestUtil constructor(private val myModule: Module) {
@Ignore
class LibraryTestUtil {

private lateinit var myModule: Module
private val references = ArrayList<Ref<Library>>()

fun setModule(module: Module) {
myModule = module
}

private fun addJarContaining(clazz: Class<*>): LibraryTestUtil {
val path = getJarPath(clazz)
addLibraryAt(path)
Expand Down

0 comments on commit 58756dc

Please sign in to comment.