diff --git a/.github/workflows/check-pr-idea-plugin.yaml b/.github/workflows/check-pr-idea-plugin.yaml index 8acc25571..ec8f2739b 100644 --- a/.github/workflows/check-pr-idea-plugin.yaml +++ b/.github/workflows/check-pr-idea-plugin.yaml @@ -15,7 +15,7 @@ jobs: build: strategy: matrix: - ij_sdk: [IJ193, IJ201, IJ202, IJ203, IJ211, IJ212, IJ213] + ij_sdk: [IJ193, IJ201, IJ202, IJ203, IJ211, IJ212, IJ213, IJ233, IJ241] runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b18febbd4..57f22e2cf 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -45,7 +45,7 @@ jobs: strategy: fail-fast: false matrix: - ij_sdk: [IJ193, IJ201, IJ202, IJ203, IJ211, IJ212, IJ213] + ij_sdk: [IJ193, IJ201, IJ202, IJ203, IJ211, IJ212, IJ213, IJ233, IJ241] runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 diff --git a/build.gradle.kts b/build.gradle.kts index 7b002c634..c46459762 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -16,7 +16,6 @@ reckon { allprojects { repositories { mavenCentral() - jcenter() } if (Files.exists(Paths.get("$rootDir/local.properties"))) { @@ -37,8 +36,8 @@ allprojects { tasks.withType> { if (this is KotlinJvmCompile) { kotlinOptions { - apiVersion = "1.3" - jvmTarget = "1.8" + apiVersion = "1.4" + jvmTarget = JavaVersion.VERSION_17.toString() } } else { kotlinOptions { diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 15955a40c..3177ade8a 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -2,6 +2,7 @@ plugins { `java-gradle-plugin` `kotlin-dsl` `kotlin-dsl-precompiled-script-plugins` + id("com.github.johnrengelman.shadow") version "8.1.1" } repositories { @@ -10,9 +11,9 @@ repositories { } dependencies { - api(kotlin("gradle-plugin", version = "1.5.31")) + api(kotlin("gradle-plugin", version = "1.9.21")) api("org.jetbrains.dokka:dokka-gradle-plugin:0.9.17") - api("com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4") - api("org.jetbrains.intellij.plugins:gradle-intellij-plugin:1.4.0") - api("com.github.jengelman.gradle.plugins:shadow:4.0.2") + api("com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.5") + api("org.jetbrains.intellij.plugins:gradle-intellij-plugin:1.16.+") + api("org.apache.ant:ant:1.10.13") // needed for shadow jar zip } diff --git a/buildSrc/src/main/kotlin/ij/BuildConfig.kt b/buildSrc/src/main/kotlin/ij/BuildConfig.kt index d0407ac5c..f1d106998 100644 --- a/buildSrc/src/main/kotlin/ij/BuildConfig.kt +++ b/buildSrc/src/main/kotlin/ij/BuildConfig.kt @@ -1,5 +1,7 @@ package ij +import org.gradle.api.JavaVersion + data class VersionRange(val since: String, val until: String) data class BuildConfig( @@ -7,5 +9,6 @@ data class BuildConfig( val prefix: String, val extraSource: String, val version: VersionRange, - val deps: List = emptyList() + val deps: List = emptyList(), + val javaVersion: JavaVersion = JavaVersion.VERSION_17 ) diff --git a/gradle.properties b/gradle.properties index 2c4286833..dd9356e97 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,4 @@ kotlin.incremental=true org.gradle.parallel=true -reckon.scope=patch \ No newline at end of file +reckon.scope=patch +kotlin.stdlib.default.dependency=true diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 5c2d1cf01..7454180f2 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index be52383ef..a59520664 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 83f2acfdc..744e882ed 100755 --- a/gradlew +++ b/gradlew @@ -72,7 +72,7 @@ case "`uname`" in Darwin* ) darwin=true ;; - MINGW* ) + MSYS* | MINGW* ) msys=true ;; NONSTOP* ) @@ -82,6 +82,7 @@ esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then @@ -129,6 +130,7 @@ fi if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath @@ -154,19 +156,19 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $i + 1` done case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; esac fi @@ -175,14 +177,9 @@ save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } -APP_ARGS=$(save "$@") +APP_ARGS=`save "$@"` # Collect all arguments for the java command, following the shell quoting and substitution rules eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index 24467a141..ac1b06f93 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @@ -37,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if "%ERRORLEVEL%" == "0" goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -51,7 +54,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -61,28 +64,14 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell diff --git a/integration-test/build.gradle.kts b/integration-test/build.gradle.kts index 5b84c0cc9..87d2acb1b 100644 --- a/integration-test/build.gradle.kts +++ b/integration-test/build.gradle.kts @@ -17,7 +17,7 @@ kotlin { sourceSets { val commonMain by getting { dependencies { - implementation(kotlin("stdlib")) +// implementation(kotlin("stdlib")) } } @@ -32,7 +32,7 @@ kotlin { jvm { compilations["main"].defaultSourceSet { dependencies { - implementation(kotlin("stdlib-jdk8")) +// implementation(kotlin("stdlib-jdk8")) } } @@ -142,6 +142,6 @@ tasks { // the spek-runtime and compiler plugin projects, rather than trying to download the not-yet-published version from a Maven repository. configurations.forEach { it.resolutionStrategy.dependencySubstitution { - substitute(module("org.spekframework.spek2:spek-runtime")).with(project(":spek-runtime")) + substitute(module("org.spekframework.spek2:spek-runtime")).using(project(":spek-runtime")) } } diff --git a/settings.gradle.kts b/settings.gradle.kts index 07371ceb7..883d9774b 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,10 +1,8 @@ -enableFeaturePreview("GRADLE_METADATA") - rootProject.name = "spek" includeBuild("./spek-gradle-plugin") { dependencySubstitution { - substitute(module("org.spekframework.spek2:spek-gradle-plugin:0.1.0")).with(project(":")) + substitute(module("org.spekframework.spek2:spek-gradle-plugin:0.1.0")).using(project(":")) } } @@ -30,5 +28,7 @@ if (excludeIdePlugins == null) { include("spek-ide-plugin-intellij-base") include("spek-ide-plugin-intellij-base-jvm") include("spek-ide-plugin-intellij-idea") - include("spek-ide-plugin-android-studio") -} \ No newline at end of file +// include("spek-ide-plugin-android-studio") +} + + diff --git a/spek-dsl/build.gradle.kts b/spek-dsl/build.gradle.kts index 985b57367..5157a9d44 100644 --- a/spek-dsl/build.gradle.kts +++ b/spek-dsl/build.gradle.kts @@ -73,14 +73,14 @@ kotlin { sourceSets { val commonMain by getting { dependencies { - implementation(kotlin("stdlib-common")) +// implementation(kotlin("stdlib-common")) } } - + jvm { compilations["main"].defaultSourceSet { dependencies { - implementation(kotlin("stdlib-jdk8")) +// implementation(kotlin("stdlib-jdk8")) } } } @@ -88,7 +88,7 @@ kotlin { js { compilations["main"].defaultSourceSet { dependencies { - implementation(kotlin("stdlib-js")) +// implementation(kotlin("stdlib-js")) } } } diff --git a/spek-gradle-plugin/build.gradle.kts b/spek-gradle-plugin/build.gradle.kts index fb16959cf..d9b57cadc 100644 --- a/spek-gradle-plugin/build.gradle.kts +++ b/spek-gradle-plugin/build.gradle.kts @@ -7,12 +7,12 @@ plugins { buildscript { dependencies { - classpath(kotlin("gradle-plugin", version = "1.5.31")) + classpath(kotlin("gradle-plugin", version = "1.9.21")) } } repositories { - jcenter() + mavenCentral() } reckon { @@ -32,7 +32,7 @@ gradlePlugin { val autoService = "com.google.auto.service:auto-service:1.0-rc4" dependencies { - implementation(kotlin("stdlib")) +// implementation(kotlin("stdlib")) implementation(kotlin("gradle-plugin")) implementation(kotlin("gradle-plugin-api")) diff --git a/spek-gradle-plugin/src/main/kotlin/org/spekframework/spek2/gradle/kotlin/Subplugin.kt b/spek-gradle-plugin/src/main/kotlin/org/spekframework/spek2/gradle/kotlin/Subplugin.kt index dba79399f..338339200 100644 --- a/spek-gradle-plugin/src/main/kotlin/org/spekframework/spek2/gradle/kotlin/Subplugin.kt +++ b/spek-gradle-plugin/src/main/kotlin/org/spekframework/spek2/gradle/kotlin/Subplugin.kt @@ -1,23 +1,20 @@ package org.spekframework.spek2.gradle.kotlin -import com.google.auto.service.AutoService -import org.gradle.api.Project -import org.gradle.api.tasks.compile.AbstractCompile -import org.jetbrains.kotlin.gradle.dsl.KotlinCommonOptions +import org.gradle.api.provider.Provider import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation -import org.jetbrains.kotlin.gradle.plugin.KotlinGradleSubplugin +import org.jetbrains.kotlin.gradle.plugin.KotlinCompilerPluginSupportPlugin import org.jetbrains.kotlin.gradle.plugin.SubpluginArtifact import org.jetbrains.kotlin.gradle.plugin.SubpluginOption -import org.jetbrains.kotlin.gradle.tasks.KotlinNativeCompile -import org.jetbrains.kotlin.gradle.tasks.KotlinNativeLink -import org.spekframework.spek2.gradle.entry.MultiplatformPlugin import org.spekframework.spek2.gradle.domain.MultiplatformExtension +import org.spekframework.spek2.gradle.entry.MultiplatformPlugin -class Subplugin : KotlinGradleSubplugin { - override fun apply(project: Project, kotlinCompile: AbstractCompile, javaCompile: AbstractCompile?, variantData: Any?, androidProjectHandler: Any?, kotlinCompilation: KotlinCompilation?): List { - val extension = checkNotNull(project.extensions.findByType(MultiplatformExtension::class.java)) +class Subplugin : KotlinCompilerPluginSupportPlugin { + override fun applyToCompilation(kotlinCompilation: KotlinCompilation<*>): Provider> { + val extension = checkNotNull(kotlinCompilation.target.project.extensions.findByType(MultiplatformExtension::class.java)) - return listOf(SubpluginOption("enabled", extension.enabled.toString())) + return kotlinCompilation.target.project.provider { + listOf(SubpluginOption("enabled", extension.enabled.toString())) + } } override fun getCompilerPluginId(): String { @@ -35,14 +32,8 @@ class Subplugin : KotlinGradleSubplugin { ) } - override fun getNativeCompilerPluginArtifact(): SubpluginArtifact? { - return SubpluginArtifact( - MultiplatformPlugin.spekMavenGroup, - "spek-kotlin-compiler-plugin-native", - MultiplatformPlugin.spekVersion - ) + override fun isApplicable(kotlinCompilation: KotlinCompilation<*>): Boolean { + return kotlinCompilation.target.project.plugins.hasPlugin(MultiplatformPlugin::class.java) +// && (task is KotlinNativeCompile || task is KotlinNativeLink) } - - override fun isApplicable(project: Project, task: AbstractCompile): Boolean - = project.plugins.hasPlugin(MultiplatformPlugin::class.java) && (task is KotlinNativeCompile || task is KotlinNativeLink) } diff --git a/spek-ide-plugin-android-studio/build.gradle.kts b/spek-ide-plugin-android-studio/build.gradle.kts index 56c0207ce..acfc23fd1 100644 --- a/spek-ide-plugin-android-studio/build.gradle.kts +++ b/spek-ide-plugin-android-studio/build.gradle.kts @@ -1,5 +1,3 @@ -import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet - plugins { kotlin("jvm") id("org.jetbrains.intellij") @@ -47,21 +45,23 @@ intellij { sourceSets { main { - withConvention(KotlinSourceSet::class) { - kotlin.srcDirs("src/${settings.extraSource}/kotlin") + sourceSets { + kotlin { + srcDir("src/${settings.extraSource}/kotlin") + } } } } dependencies { - compile(project(":spek-ide-plugin-intellij-base-jvm")) - compileOnly(kotlin("stdlib")) + api(project(":spek-ide-plugin-intellij-base-jvm")) +// compileOnly(kotlin("stdlib")) } tasks { compileKotlin { kotlinOptions { - jvmTarget = "1.8" + jvmTarget = JavaVersion.VERSION_17.toString() } } diff --git a/spek-ide-plugin-intellij-base-jvm/build.gradle.kts b/spek-ide-plugin-intellij-base-jvm/build.gradle.kts index 67d87f9a2..3035f50f3 100644 --- a/spek-ide-plugin-intellij-base-jvm/build.gradle.kts +++ b/spek-ide-plugin-intellij-base-jvm/build.gradle.kts @@ -5,20 +5,25 @@ plugins { intellij { pluginName.set("spek-base-jvm") - plugins.set(listOf("org.jetbrains.kotlin:1.3.61-release-IJ2018.3-1")) - version.set("2018.3") + plugins.set(listOf("org.jetbrains.kotlin")) + version.set("2024.1") } dependencies { - compile(project(":spek-ide-plugin-intellij-base")) - compile(project(path = ":spek-ide-plugin-interop-jvm", configuration = "shadow")) - compileOnly(kotlin("stdlib")) + api(project(":spek-ide-plugin-intellij-base")) + api(project(path = ":spek-ide-plugin-interop-jvm", configuration = "shadow")) +// compileOnly(kotlin("stdlib")) +} + +java { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } tasks { compileKotlin { kotlinOptions { - jvmTarget = "1.8" + jvmTarget = JavaVersion.VERSION_17.toString() } } } diff --git a/spek-ide-plugin-intellij-base/build.gradle.kts b/spek-ide-plugin-intellij-base/build.gradle.kts index cefc0e9ef..5bbf52220 100644 --- a/spek-ide-plugin-intellij-base/build.gradle.kts +++ b/spek-ide-plugin-intellij-base/build.gradle.kts @@ -5,25 +5,31 @@ plugins { intellij { pluginName.set("spek-base") - plugins.set(listOf("org.jetbrains.kotlin:1.3.61-release-IJ2018.3-1")) - version.set("2018.3") + plugins.set(listOf("org.jetbrains.kotlin")) + version.set("2024.1") } dependencies { - compileOnly(kotlin("stdlib")) - compile(project(":spek-runtime")) { - exclude(group = "org.jetbrains.kotlin") - } +// compileOnly(kotlin("stdlib")) + implementation(project(":spek-runtime")) +// { +// exclude(group = "org.jetbrains.kotlin") +// } +} + +java { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } tasks { compileKotlin { kotlinOptions { - jvmTarget = "1.8" + jvmTarget = JavaVersion.VERSION_17.toString() } } patchPluginXml { - sinceBuild.set("181.*") + sinceBuild.set("233.*") } } diff --git a/spek-ide-plugin-intellij-base/src/main/kotlin/org/spekframework/intellij/SpekRunConfigurationProducer.kt b/spek-ide-plugin-intellij-base/src/main/kotlin/org/spekframework/intellij/SpekRunConfigurationProducer.kt index 47e44b8e1..a5e615e02 100644 --- a/spek-ide-plugin-intellij-base/src/main/kotlin/org/spekframework/intellij/SpekRunConfigurationProducer.kt +++ b/spek-ide-plugin-intellij-base/src/main/kotlin/org/spekframework/intellij/SpekRunConfigurationProducer.kt @@ -9,11 +9,11 @@ import com.intellij.openapi.util.Ref import com.intellij.psi.PsiDirectory import com.intellij.psi.PsiElement import com.intellij.psi.PsiPackage -import org.jetbrains.kotlin.config.KotlinFacetSettings +import org.jetbrains.kotlin.config.IKotlinFacetSettings import org.jetbrains.kotlin.config.KotlinFacetSettingsProvider -import org.jetbrains.kotlin.idea.caches.project.implementingModules +import org.jetbrains.kotlin.idea.base.facet.implementingModules +import org.jetbrains.kotlin.idea.base.util.module import org.jetbrains.kotlin.idea.core.getPackage -import org.jetbrains.kotlin.idea.util.module import org.jetbrains.kotlin.platform.IdePlatformKind import org.jetbrains.kotlin.platform.idePlatformKind import org.jetbrains.kotlin.platform.impl.CommonIdePlatformKind @@ -133,7 +133,8 @@ abstract class SpekRunConfigurationProducer(val producerType: ProducerType, type private fun getPathFromDir(context: ConfigurationContext, dir: PsiDirectory): Path? { if (context.module != null) { val moduleRootManager = ModuleRootManager.getInstance(context.module) - if (context.module == dir.module || moduleRootManager.isDependsOn(dir.module)) { + var dirModule = dir.module + if (context.module == dirModule || (dirModule != null && moduleRootManager.isDependsOn(dirModule))) { val psiPackage = dir.getPackage() if (psiPackage != null) { @@ -153,7 +154,7 @@ abstract class SpekRunConfigurationProducer(val producerType: ProducerType, type .build() } - private fun findSupportedModule(project: Project, commonModule: Module): Pair? { + private fun findSupportedModule(project: Project, commonModule: Module): Pair? { val kotlinFacetSettingsProvider = KotlinFacetSettingsProvider.getInstance(project)!! return commonModule.implementingModules .map { it to kotlinFacetSettingsProvider.getInitializedSettings(it) } @@ -162,5 +163,5 @@ abstract class SpekRunConfigurationProducer(val producerType: ProducerType, type } } - private fun isPlatformSupported(kind: IdePlatformKind<*>) = kind.toProducerType() == producerType + private fun isPlatformSupported(kind: IdePlatformKind) = kind.toProducerType() == producerType } diff --git a/spek-ide-plugin-intellij-base/src/main/kotlin/org/spekframework/intellij/domain/synonym.kt b/spek-ide-plugin-intellij-base/src/main/kotlin/org/spekframework/intellij/domain/synonym.kt index a263c5fbe..a6cc91f5c 100644 --- a/spek-ide-plugin-intellij-base/src/main/kotlin/org/spekframework/intellij/domain/synonym.kt +++ b/spek-ide-plugin-intellij-base/src/main/kotlin/org/spekframework/intellij/domain/synonym.kt @@ -100,7 +100,6 @@ class SynonymContext(val synonym: PsiSynonym, val descriptions: PsiDescriptions) else -> throw UnsupportedFeatureException("Value argument description should be a string.") } } - else -> throw IllegalArgumentException("Invalid location: ${it.location}") } }.fold(synonym.prefix) { prev, current -> if (prev.isNotEmpty()) { diff --git a/spek-ide-plugin-intellij-base/src/main/kotlin/org/spekframework/intellij/producerType.kt b/spek-ide-plugin-intellij-base/src/main/kotlin/org/spekframework/intellij/producerType.kt index c2dc2e988..7bd3bef6e 100644 --- a/spek-ide-plugin-intellij-base/src/main/kotlin/org/spekframework/intellij/producerType.kt +++ b/spek-ide-plugin-intellij-base/src/main/kotlin/org/spekframework/intellij/producerType.kt @@ -13,7 +13,7 @@ enum class ProducerType { JS } -fun IdePlatformKind<*>.toProducerType(): ProducerType { +fun IdePlatformKind.toProducerType(): ProducerType { return when (this) { CommonIdePlatformKind -> ProducerType.COMMON JvmIdePlatformKind -> ProducerType.JVM diff --git a/spek-ide-plugin-intellij-idea/build.gradle.kts b/spek-ide-plugin-intellij-idea/build.gradle.kts index 6df2d09db..181355d40 100644 --- a/spek-ide-plugin-intellij-idea/build.gradle.kts +++ b/spek-ide-plugin-intellij-idea/build.gradle.kts @@ -1,5 +1,3 @@ -import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet - plugins { kotlin("jvm") id("org.jetbrains.intellij") @@ -49,12 +47,33 @@ val buildMatrix = mapOf( "IJ183", ij.VersionRange("213.1", "223.*"), listOf("java", "org.jetbrains.kotlin:213-1.6.10-release-944-IJ6461.79") + ), + "IJ233" to ij.BuildConfig( + "233.11799.241", + "IJ2023.3", + "IJ183", + ij.VersionRange("233.1", "233.*"), + listOf("java", "org.jetbrains.kotlin"), // :231-1.7.10-release-334-IJ8228 + JavaVersion.VERSION_17 + ), + "IJ241" to ij.BuildConfig( + "241.17011.79", + "IJ2024.1", + "IJ183", + ij.VersionRange("241.1", "241.*"), + listOf("java", "org.jetbrains.kotlin"), + JavaVersion.VERSION_17 ) ) -val sdkVersion = project.properties["ij.version"] ?: "IJ213" +val sdkVersion = project.properties["ij.version"] ?: "IJ241" val settings = checkNotNull(buildMatrix[sdkVersion]) +java { + sourceCompatibility = settings.javaVersion + targetCompatibility = settings.javaVersion +} + intellij { pluginName.set("Spek Framework") plugins.set(settings.deps) @@ -65,21 +84,21 @@ intellij { sourceSets { main { - withConvention(KotlinSourceSet::class) { - kotlin.srcDirs("src/${settings.extraSource}/kotlin") + kotlin { + srcDirs("src/${settings.extraSource}/kotlin") } } } dependencies { - compile(project(":spek-ide-plugin-intellij-base-jvm")) - compileOnly(kotlin("stdlib")) + api(project(":spek-ide-plugin-intellij-base-jvm")) } tasks { compileKotlin { +// version = settings.kotlinVersion kotlinOptions { - jvmTarget = "1.8" + jvmTarget = settings.javaVersion.toString() } } diff --git a/spek-ide-plugin-interop-jvm/build.gradle.kts b/spek-ide-plugin-interop-jvm/build.gradle.kts index 8c8047dfc..ffcc16a6e 100644 --- a/spek-ide-plugin-interop-jvm/build.gradle.kts +++ b/spek-ide-plugin-interop-jvm/build.gradle.kts @@ -1,14 +1,19 @@ plugins { kotlin("jvm") - id("com.github.johnrengelman.shadow") + id("com.github.johnrengelman.shadow") version "8.1.1" } dependencies { - compile(project(":spek-runtime")) { + implementation(project(":spek-runtime")) { exclude(group = "org.jetbrains.kotlin") } - compileOnly(kotlin("stdlib")) - compile(Dependencies.kotlinArgParser) +// compileOnly(kotlin("stdlib")) + implementation(Dependencies.kotlinArgParser) +} + +java { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } tasks { diff --git a/spek-kotlin-compiler-plugin-jvm/build.gradle.kts b/spek-kotlin-compiler-plugin-jvm/build.gradle.kts index abe679cd1..db85cb417 100644 --- a/spek-kotlin-compiler-plugin-jvm/build.gradle.kts +++ b/spek-kotlin-compiler-plugin-jvm/build.gradle.kts @@ -4,7 +4,7 @@ plugins { } dependencies { - implementation(kotlin("stdlib-jdk8")) +// implementation(kotlin("stdlib-jdk8")) compileOnly(kotlin("compiler-embeddable")) implementation(Dependencies.autoService) @@ -18,7 +18,7 @@ tasks { compileKotlin { kotlinOptions { - jvmTarget = "1.8" + jvmTarget = JavaVersion.VERSION_17.toString() } } } diff --git a/spek-kotlin-compiler-plugin-native/build.gradle.kts b/spek-kotlin-compiler-plugin-native/build.gradle.kts index 090c91d3b..f84e6f135 100644 --- a/spek-kotlin-compiler-plugin-native/build.gradle.kts +++ b/spek-kotlin-compiler-plugin-native/build.gradle.kts @@ -4,7 +4,7 @@ plugins { } dependencies { - implementation(kotlin("stdlib-jdk8")) +// implementation(kotlin("stdlib-jdk8")) compileOnly(kotlin("compiler")) implementation(Dependencies.autoService) @@ -18,7 +18,7 @@ tasks { compileKotlin { kotlinOptions { - jvmTarget = "1.8" + jvmTarget = JavaVersion.VERSION_17.toString() } } } diff --git a/spek-runner-junit5/build.gradle.kts b/spek-runner-junit5/build.gradle.kts index dce0b3288..53f4f5b1c 100644 --- a/spek-runner-junit5/build.gradle.kts +++ b/spek-runner-junit5/build.gradle.kts @@ -4,7 +4,7 @@ plugins { } dependencies { - implementation(kotlin("stdlib-jdk8")) +// implementation(kotlin("stdlib-jdk8")) implementation(project(":spek-runtime")) implementation(Dependencies.junitPlatformEngine) @@ -19,6 +19,11 @@ dependencies { val archive = "spek-runner-junit5" +java { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 +} + tasks { test { useJUnitPlatform { diff --git a/spek-runtime/build.gradle.kts b/spek-runtime/build.gradle.kts index d562e3ddd..da1f2bdea 100644 --- a/spek-runtime/build.gradle.kts +++ b/spek-runtime/build.gradle.kts @@ -64,15 +64,15 @@ kotlin { val commonMain by getting { dependencies { api(project(":spek-dsl")) - implementation(kotlin("stdlib-common")) +// implementation(kotlin("stdlib-common")) implementation(Dependencies.kotlinCoroutinesCore) } } - + jvm { compilations["main"].defaultSourceSet { dependencies { - implementation(kotlin("stdlib-jdk8")) +// implementation(kotlin("stdlib-jdk8")) implementation(kotlin("reflect")) implementation(Dependencies.classgraph) implementation(Dependencies.kotlinCoroutinesCore) diff --git a/spek-runtime/src/commonMain/kotlin/org/spekframework/spek2/runtime/SpekRuntime.kt b/spek-runtime/src/commonMain/kotlin/org/spekframework/spek2/runtime/SpekRuntime.kt index 134914acc..845def847 100644 --- a/spek-runtime/src/commonMain/kotlin/org/spekframework/spek2/runtime/SpekRuntime.kt +++ b/spek-runtime/src/commonMain/kotlin/org/spekframework/spek2/runtime/SpekRuntime.kt @@ -46,7 +46,6 @@ class SpekRuntime { return results } - @UseExperimental(ExperimentalTime::class) fun discover(discoveryRequest: DiscoveryRequest): DiscoveryResult { val scopes = mutableListOf() val time = measureTime { @@ -120,4 +119,4 @@ expect fun isConcurrentExecutionEnabled(default: Boolean): Boolean expect fun getGlobalTimeoutSetting(default: Long): Long expect fun isDebuggingEnabled(default: Boolean): Boolean -expect fun measureTime(block: () -> Unit): Long \ No newline at end of file +expect fun measureTime(block: () -> Unit): Long diff --git a/spek-runtime/src/commonMain/kotlin/org/spekframework/spek2/runtime/lifecycle/MemoizedValueAdapter.kt b/spek-runtime/src/commonMain/kotlin/org/spekframework/spek2/runtime/lifecycle/MemoizedValueAdapter.kt index acadf1389..92d118153 100644 --- a/spek-runtime/src/commonMain/kotlin/org/spekframework/spek2/runtime/lifecycle/MemoizedValueAdapter.kt +++ b/spek-runtime/src/commonMain/kotlin/org/spekframework/spek2/runtime/lifecycle/MemoizedValueAdapter.kt @@ -83,6 +83,9 @@ sealed class MemoizedValueAdapter( val cached = this@ScopeCachingModeAdapter.cached when (cached) { is Cached.Value -> destructor(cached.value) + else -> { + // do nothing + } } this@ScopeCachingModeAdapter.cached = Cached.Invalid } @@ -105,6 +108,9 @@ sealed class MemoizedValueAdapter( afterEachTest { when (val cached = this@TestCachingModeAdapter.cached) { is Cached.Value -> destructor(cached.value) + else -> { + // do nothing + } } this@TestCachingModeAdapter.cached = Cached.Invalid } diff --git a/spek-runtime/src/nativeMain/kotlin/org/spekframework/spek2/runtime/timeout.kt b/spek-runtime/src/nativeMain/kotlin/org/spekframework/spek2/runtime/timeout.kt index 2625ef1c4..9e4aa4d10 100644 --- a/spek-runtime/src/nativeMain/kotlin/org/spekframework/spek2/runtime/timeout.kt +++ b/spek-runtime/src/nativeMain/kotlin/org/spekframework/spek2/runtime/timeout.kt @@ -16,7 +16,7 @@ actual fun isConcurrentExecutionEnabled(default: Boolean): Boolean { return default } -@UseExperimental(ExperimentalTime::class) +@OptIn(ExperimentalTime::class) actual fun measureTime(block: () -> Unit): Long { return TimeSource.Monotonic.measureTime(block).inMilliseconds.toLong() } @@ -27,4 +27,4 @@ actual fun isDebuggingEnabled(default: Boolean): Boolean { actual fun getExecutionParallelism(): Int { return 1 -} \ No newline at end of file +}