diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 250e619154..58d0cb4365 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -66,7 +66,7 @@ jobs: path: '**/build/reports/' retention-days: 1 - name: Code coverage report - uses: codecov/codecov-action@v4 + uses: codecov/codecov-action@v5 # Do not run coverage for forks since they cannot upload the results to codecov. # For reference, see: # https://docs.github.com/en/actions/using-jobs/using-conditions-to-control-job-execution#example-only-run-job-for-specific-repository diff --git a/.github/workflows/diktat.yml b/.github/workflows/diktat.yml index f80206618e..e75f0483bf 100644 --- a/.github/workflows/diktat.yml +++ b/.github/workflows/diktat.yml @@ -34,6 +34,7 @@ jobs: --build-cache -PgprUser=${{ github.actor }} -PgprKey=${{ secrets.GITHUB_TOKEN }} + --stacktrace - name: Upload SARIF report to Github uses: github/codeql-action/upload-sarif@v3 if: ${{ always() }} diff --git a/README.md b/README.md index 36c6a54dc0..f65e49afad 100644 --- a/README.md +++ b/README.md @@ -168,8 +168,8 @@ Requires a gradle version no lower than 7.0 You can see how the plugin is configured in our examples: - [Kotlin DSL](examples/gradle-kotlin-dsl/build.gradle.kts) -- [Kotlin DSL for multi-module project](examples/gradle-kotlin-dsl/build.gradle.kts) -- [Groovy DSL](examples/gradle-kotlin-dsl/build.gradle.kts) +- [Kotlin DSL for multi-module project](examples/gradle-kotlin-dsl-multiproject/build.gradle.kts) +- [Groovy DSL](examples/gradle-groovy-dsl/build.gradle)
Add this plugin to your `build.gradle.kts`: diff --git a/detekt-config.yml b/detekt-config.yml index 76c8c31a40..3451e511e0 100644 --- a/detekt-config.yml +++ b/detekt-config.yml @@ -81,7 +81,7 @@ complexity: threshold: 10 includeStaticDeclarations: false includePrivateDeclarations: false - ComplexMethod: + CyclomaticComplexMethod: active: true threshold: 15 ignoreSingleWhenExpression: false @@ -253,7 +253,6 @@ naming: parameterPattern: '[a-z][A-Za-z0-9]*' privateParameterPattern: '[a-z][A-Za-z0-9]*' excludeClassPattern: '$^' - ignoreOverridden: true EnumNaming: active: true excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] @@ -275,14 +274,12 @@ naming: excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] functionPattern: '([a-z][a-zA-Z0-9]*)|(`.*`)' excludeClassPattern: '$^' - ignoreOverridden: true ignoreAnnotated: ['Composable'] FunctionParameterNaming: active: true excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] parameterPattern: '[a-z][A-Za-z0-9]*' excludeClassPattern: '$^' - ignoreOverridden: true InvalidPackageDeclaration: active: false excludes: ['*.kts'] @@ -328,7 +325,6 @@ naming: variablePattern: '[a-z][A-Za-z0-9]*' privateVariablePattern: '(_)?[a-z][A-Za-z0-9]*' excludeClassPattern: '$^' - ignoreOverridden: true performance: active: true @@ -351,8 +347,6 @@ potential-bugs: active: true DontDowncastCollectionTypes: active: true - DuplicateCaseInWhenExpression: - active: true EqualsAlwaysReturnsTrueOrFalse: active: true EqualsWithHashCodeExist: @@ -365,7 +359,7 @@ potential-bugs: active: false IgnoredReturnValue: active: true - restrictToAnnotatedMethods: true + restrictToConfig: true returnValueAnnotations: ['*.CheckReturnValue', '*.CheckResult'] ImplicitDefaultLocale: active: false @@ -384,13 +378,8 @@ potential-bugs: ignoreOnClassesPattern: '' MapGetWithNotNullAssertionOperator: active: false - MissingWhenCase: - active: true - allowElseExpression: true NullableToStringCall: active: false - RedundantElseInWhen: - active: true UnconditionalJumpStatementInLoop: active: false UnnecessaryNotNullOperator: @@ -437,10 +426,6 @@ style: ExpressionBodySyntax: active: false includeLineWrapping: false - ForbiddenComment: - active: true - values: ['TODO:', 'STOPSHIP:'] - allowedPatterns: '' ForbiddenImport: active: false imports: [] @@ -486,8 +471,6 @@ style: ignoreEnums: false ignoreRanges: false ignoreExtensionFunctions: true - MandatoryBracesIfStatements: - active: false MandatoryBracesLoops: active: false MaxLineLength: @@ -512,8 +495,6 @@ style: active: true OptionalUnit: active: false - OptionalWhenBraces: - active: false PreferToOverPairSyntax: active: false ProtectedMemberInFinalClass: diff --git a/diktat-analysis.yml b/diktat-analysis.yml index 76d4e0af68..e06787c1a7 100644 --- a/diktat-analysis.yml +++ b/diktat-analysis.yml @@ -10,7 +10,7 @@ # or: "1, 2, 3, 4, 5, 6" disabledChapters: "" testDirs: test - kotlinVersion: 1.9 + kotlinVersion: 2.1 srcDirectories: "main" # Checks that the Class/Enum/Interface name matches Pascal case - name: CLASS_NAME_INCORRECT diff --git a/diktat-gradle-plugin/build.gradle.kts b/diktat-gradle-plugin/build.gradle.kts index 9e535c2b58..237e09bac5 100644 --- a/diktat-gradle-plugin/build.gradle.kts +++ b/diktat-gradle-plugin/build.gradle.kts @@ -2,6 +2,8 @@ import com.saveourtool.diktat.buildutils.configurePom import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform.getCurrentOperatingSystem +import org.jetbrains.kotlin.gradle.dsl.JvmTarget +import org.jetbrains.kotlin.gradle.dsl.KotlinVersion import org.jetbrains.kotlin.gradle.tasks.KotlinCompile @Suppress("DSL_SCOPE_VIOLATION", "RUN_IN_SCRIPT") // https://github.com/gradle/gradle/issues/22797 @@ -31,13 +33,12 @@ dependencies { } tasks.withType { - kotlinOptions { + compilerOptions { // kotlin 1.4 api is the latest support version in kotlin 1.9 // min supported Gradle is 7.0 - languageVersion = "1.4" - apiVersion = "1.4" - jvmTarget = "1.8" - freeCompilerArgs = freeCompilerArgs - "-Werror" + languageVersion.set(KotlinVersion.KOTLIN_2_0) + apiVersion.set(KotlinVersion.KOTLIN_2_0) + jvmTarget.set(JvmTarget.JVM_1_8) } } diff --git a/diktat-ktlint-engine/src/main/kotlin/com/saveourtool/diktat/ktlint/DiktatBaselineFactoryImpl.kt b/diktat-ktlint-engine/src/main/kotlin/com/saveourtool/diktat/ktlint/DiktatBaselineFactoryImpl.kt index ae85a802de..2dce685141 100644 --- a/diktat-ktlint-engine/src/main/kotlin/com/saveourtool/diktat/ktlint/DiktatBaselineFactoryImpl.kt +++ b/diktat-ktlint-engine/src/main/kotlin/com/saveourtool/diktat/ktlint/DiktatBaselineFactoryImpl.kt @@ -6,6 +6,7 @@ import com.saveourtool.diktat.api.DiktatProcessorListener import com.saveourtool.diktat.ktlint.DiktatReporterImpl.Companion.wrap import com.pinterest.ktlint.cli.reporter.baseline.Baseline +import com.pinterest.ktlint.cli.reporter.baseline.BaselineErrorHandling import com.pinterest.ktlint.cli.reporter.baseline.BaselineReporterProvider import com.pinterest.ktlint.cli.reporter.baseline.loadBaseline @@ -23,7 +24,7 @@ class DiktatBaselineFactoryImpl : DiktatBaselineFactory { override fun tryToLoad( baselineFile: Path, sourceRootDir: Path?, - ): DiktatBaseline? = loadBaseline(baselineFile.absolutePathString()) + ): DiktatBaseline? = loadBaseline(baselineFile.absolutePathString(), BaselineErrorHandling.LOG) .takeIf { it.status == Baseline.Status.VALID } ?.let { ktLintBaseline -> DiktatBaseline { file -> diff --git a/diktat-ktlint-engine/src/main/kotlin/com/saveourtool/diktat/ktlint/DiktatProcessorFactoryImpl.kt b/diktat-ktlint-engine/src/main/kotlin/com/saveourtool/diktat/ktlint/DiktatProcessorFactoryImpl.kt index 55cd7208c6..1f60bec691 100644 --- a/diktat-ktlint-engine/src/main/kotlin/com/saveourtool/diktat/ktlint/DiktatProcessorFactoryImpl.kt +++ b/diktat-ktlint-engine/src/main/kotlin/com/saveourtool/diktat/ktlint/DiktatProcessorFactoryImpl.kt @@ -83,6 +83,8 @@ class DiktatProcessorFactoryImpl : DiktatProcessorFactory { code: Code, callback: LintCallback, ): String { + // this API method is significantly changed in Ktlint, so -werror was disabled due to it + @Suppress("Deprecation") val formatResult = format(code) lint( code = Code( diff --git a/diktat-ktlint-engine/src/main/kotlin/com/saveourtool/diktat/ktlint/KtLintRuleWrapper.kt b/diktat-ktlint-engine/src/main/kotlin/com/saveourtool/diktat/ktlint/KtLintRuleWrapper.kt index 9fee4d3ab9..b77db15f54 100644 --- a/diktat-ktlint-engine/src/main/kotlin/com/saveourtool/diktat/ktlint/KtLintRuleWrapper.kt +++ b/diktat-ktlint-engine/src/main/kotlin/com/saveourtool/diktat/ktlint/KtLintRuleWrapper.kt @@ -24,6 +24,7 @@ class KtLintRuleWrapper( about = about, visitorModifiers = createVisitorModifiers(rule, prevRuleId), ) { + @Deprecated("Marked for removal in Ktlint 2.0. Please implement interface RuleAutocorrectApproveHandler.") override fun beforeVisitChildNodes( node: ASTNode, autoCorrect: Boolean, diff --git a/diktat-rules/src/main/kotlin/com/saveourtool/diktat/ruleset/rules/chapter3/MultipleModifiersSequence.kt b/diktat-rules/src/main/kotlin/com/saveourtool/diktat/ruleset/rules/chapter3/MultipleModifiersSequence.kt index 8f232febe5..663b956c56 100644 --- a/diktat-rules/src/main/kotlin/com/saveourtool/diktat/ruleset/rules/chapter3/MultipleModifiersSequence.kt +++ b/diktat-rules/src/main/kotlin/com/saveourtool/diktat/ruleset/rules/chapter3/MultipleModifiersSequence.kt @@ -97,7 +97,6 @@ class MultipleModifiersSequence(configRules: List) : DiktatRule( KtTokens.CROSSINLINE_KEYWORD, KtTokens.VARARG_KEYWORD, KtTokens.SUSPEND_KEYWORD, KtTokens.INNER_KEYWORD, KtTokens.OUT_KEYWORD, KtTokens.ENUM_KEYWORD, KtTokens.ANNOTATION_KEYWORD, KtTokens.COMPANION_KEYWORD, KtTokens.VALUE_KEYWORD, KtTokens.INLINE_KEYWORD, KtTokens.NOINLINE_KEYWORD, KtTokens.REIFIED_KEYWORD, KtTokens.INFIX_KEYWORD, - KtTokens.OPERATOR_KEYWORD, KtTokens.DATA_KEYWORD, KtTokens.IN_KEYWORD, KtTokens.HEADER_KEYWORD, - KtTokens.IMPL_KEYWORD) + KtTokens.OPERATOR_KEYWORD, KtTokens.DATA_KEYWORD, KtTokens.IN_KEYWORD) } } diff --git a/diktat-rules/src/main/kotlin/com/saveourtool/diktat/ruleset/utils/KotlinParser.kt b/diktat-rules/src/main/kotlin/com/saveourtool/diktat/ruleset/utils/KotlinParser.kt index 31cc0f3cbf..c01f54491a 100644 --- a/diktat-rules/src/main/kotlin/com/saveourtool/diktat/ruleset/utils/KotlinParser.kt +++ b/diktat-rules/src/main/kotlin/com/saveourtool/diktat/ruleset/utils/KotlinParser.kt @@ -2,7 +2,6 @@ package com.saveourtool.diktat.ruleset.utils import org.jetbrains.kotlin.KtNodeTypes.BLOCK import org.jetbrains.kotlin.KtNodeTypes.IMPORT_LIST -import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys import org.jetbrains.kotlin.cli.common.environment.setIdeaIoUseFallback import org.jetbrains.kotlin.cli.common.messages.MessageCollector import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles @@ -17,6 +16,7 @@ import org.jetbrains.kotlin.com.intellij.pom.PomTransaction import org.jetbrains.kotlin.com.intellij.pom.impl.PomTransactionBase import org.jetbrains.kotlin.com.intellij.pom.tree.TreeAspect import org.jetbrains.kotlin.com.intellij.psi.TokenType.ERROR_ELEMENT +import org.jetbrains.kotlin.config.CommonConfigurationKeys import org.jetbrains.kotlin.config.CompilerConfiguration import org.jetbrains.kotlin.lexer.KtTokens import org.jetbrains.kotlin.lexer.KtTokens.IMPORT_KEYWORD @@ -30,7 +30,7 @@ import sun.reflect.ReflectionFactory class KotlinParser { private val project: Project by lazy { val compilerConfiguration = CompilerConfiguration() - compilerConfiguration.put(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY, MessageCollector.NONE) // mute the output logging to process it themselves + compilerConfiguration.put(CommonConfigurationKeys.MESSAGE_COLLECTOR_KEY, MessageCollector.NONE) // mute the output logging to process it themselves val pomModel: PomModel = object : UserDataHolderBase(), PomModel { override fun runTransaction(transaction: PomTransaction) { (transaction as PomTransactionBase).run() diff --git a/diktat-rules/src/main/resources/diktat-analysis-huawei.yml b/diktat-rules/src/main/resources/diktat-analysis-huawei.yml index e9c1e7b54b..668e1d2669 100644 --- a/diktat-rules/src/main/resources/diktat-analysis-huawei.yml +++ b/diktat-rules/src/main/resources/diktat-analysis-huawei.yml @@ -7,7 +7,7 @@ # testDirs: test disabledChapters: "" testDirs: test - kotlinVersion: 1.9 + kotlinVersion: 2.1 srcDirectories: "main" # Checks that the Class/Enum/Interface name matches Pascal case - name: CLASS_NAME_INCORRECT diff --git a/diktat-rules/src/main/resources/diktat-analysis.yml b/diktat-rules/src/main/resources/diktat-analysis.yml index aa9b009323..cbc1072f40 100644 --- a/diktat-rules/src/main/resources/diktat-analysis.yml +++ b/diktat-rules/src/main/resources/diktat-analysis.yml @@ -7,7 +7,7 @@ # expected values: disabledChapters: "Naming, Comments, General, Variables, Functions, Classes" # or: "1, 2, 3, 4, 5, 6" disabledChapters: "" - kotlinVersion: 1.9 + kotlinVersion: 2.1 srcDirectories: "main" # Checks that the Class/Enum/Interface name matches Pascal case - name: CLASS_NAME_INCORRECT diff --git a/diktat-rules/src/test/kotlin/com/saveourtool/diktat/util/TestUtils.kt b/diktat-rules/src/test/kotlin/com/saveourtool/diktat/util/TestUtils.kt index 7cb33e61e2..827b43a4b5 100644 --- a/diktat-rules/src/test/kotlin/com/saveourtool/diktat/util/TestUtils.kt +++ b/diktat-rules/src/test/kotlin/com/saveourtool/diktat/util/TestUtils.kt @@ -22,11 +22,6 @@ import kotlin.contracts.contract internal const val TEST_FILE_NAME = "TestFileName.kt" -private val debuggerPromptPrefixes: Array = arrayOf( - "Listening for transport dt_socket at address: ", - "Listening for transport dt_shmem at address: ", -) - /** * Casts a nullable value to a non-`null` one, similarly to the `!!` * operator. @@ -43,59 +38,6 @@ internal fun T?.assertNotNull(lazyFailureMessage: () -> String = { "Ex return this ?: fail(lazyFailureMessage()) } -/** - * Calls the [block] callback giving it a sequence of all the lines in this file - * and closes the reader once the processing is complete. - * - * If [filterDebuggerPrompt] is `true`, the JVM debugger prompt is filtered out - * from the sequence of lines before it is consumed by [block]. - * - * If [filterDebuggerPrompt] is `false`, this function behaves exactly as the - * overloaded function from the standard library. - * - * @param filterDebuggerPrompt whether the JVM debugger prompt should be - * filtered out. - * @param block the callback which consumes the lines produced by this [Reader]. - * @return the value returned by [block]. - */ -@OptIn(ExperimentalContracts::class) -internal fun Reader.useLines( - filterDebuggerPrompt: Boolean, - block: (Sequence) -> T, -): T { - contract { - callsInPlace(block, EXACTLY_ONCE) - } - - return when { - filterDebuggerPrompt -> { - /* - * Transform the line consumer. - */ - { lines -> - lines.filterNot(String::isDebuggerPrompt).let(block) - } - } - - else -> block - }.let(this::useLines) -} - -private fun String.isDebuggerPrompt(printIfTrue: Boolean = true): Boolean { - val isDebuggerPrompt = debuggerPromptPrefixes.any { prefix -> - this.startsWith(prefix) - } - if (isDebuggerPrompt && printIfTrue) { - /* - * Print the prompt to the standard out, - * so that the IDE can attach to the debugger. - */ - @Suppress("DEBUG_PRINT") - println(this) - } - return isDebuggerPrompt -} - /** * This utility function lets you run arbitrary code on every node of given [code]. * It also provides you with counter which can be incremented inside [applyToNode] and then will be compared to [expectedAsserts]. diff --git a/examples/gradle-groovy-dsl/diktat-analysis.yml b/examples/gradle-groovy-dsl/diktat-analysis.yml index 59015a6785..a028be2dbb 100644 --- a/examples/gradle-groovy-dsl/diktat-analysis.yml +++ b/examples/gradle-groovy-dsl/diktat-analysis.yml @@ -7,7 +7,7 @@ # expected values: disabledChapters: "Naming, Comments, General, Variables, Functions, Classes" # or: "1, 2, 3, 4, 5, 6" disabledChapters: "" - kotlinVersion: 1.9 + kotlinVersion: 2.1 srcDirectories: "main" # Checks that the Class/Enum/Interface name matches Pascal case - name: CLASS_NAME_INCORRECT diff --git a/examples/gradle-kotlin-dsl-multiproject/build.gradle.kts b/examples/gradle-kotlin-dsl-multiproject/build.gradle.kts index af19717cf8..7bcb578991 100644 --- a/examples/gradle-kotlin-dsl-multiproject/build.gradle.kts +++ b/examples/gradle-kotlin-dsl-multiproject/build.gradle.kts @@ -2,7 +2,7 @@ import com.saveourtool.diktat.plugin.gradle.DiktatExtension import com.saveourtool.diktat.plugin.gradle.DiktatGradlePlugin plugins { - kotlin("jvm") version "1.9.24" + kotlin("jvm") version "2.1.0" id("com.saveourtool.diktat") version "2.0.0" apply false } diff --git a/examples/gradle-kotlin-dsl-multiproject/diktat-analysis.yml b/examples/gradle-kotlin-dsl-multiproject/diktat-analysis.yml index 59015a6785..a028be2dbb 100644 --- a/examples/gradle-kotlin-dsl-multiproject/diktat-analysis.yml +++ b/examples/gradle-kotlin-dsl-multiproject/diktat-analysis.yml @@ -7,7 +7,7 @@ # expected values: disabledChapters: "Naming, Comments, General, Variables, Functions, Classes" # or: "1, 2, 3, 4, 5, 6" disabledChapters: "" - kotlinVersion: 1.9 + kotlinVersion: 2.1 srcDirectories: "main" # Checks that the Class/Enum/Interface name matches Pascal case - name: CLASS_NAME_INCORRECT diff --git a/examples/gradle-kotlin-dsl/diktat-analysis.yml b/examples/gradle-kotlin-dsl/diktat-analysis.yml index 59015a6785..a028be2dbb 100644 --- a/examples/gradle-kotlin-dsl/diktat-analysis.yml +++ b/examples/gradle-kotlin-dsl/diktat-analysis.yml @@ -7,7 +7,7 @@ # expected values: disabledChapters: "Naming, Comments, General, Variables, Functions, Classes" # or: "1, 2, 3, 4, 5, 6" disabledChapters: "" - kotlinVersion: 1.9 + kotlinVersion: 2.1 srcDirectories: "main" # Checks that the Class/Enum/Interface name matches Pascal case - name: CLASS_NAME_INCORRECT diff --git a/examples/maven-multiproject/diktat-analysis.yml b/examples/maven-multiproject/diktat-analysis.yml index 59015a6785..a028be2dbb 100644 --- a/examples/maven-multiproject/diktat-analysis.yml +++ b/examples/maven-multiproject/diktat-analysis.yml @@ -7,7 +7,7 @@ # expected values: disabledChapters: "Naming, Comments, General, Variables, Functions, Classes" # or: "1, 2, 3, 4, 5, 6" disabledChapters: "" - kotlinVersion: 1.9 + kotlinVersion: 2.1 srcDirectories: "main" # Checks that the Class/Enum/Interface name matches Pascal case - name: CLASS_NAME_INCORRECT diff --git a/examples/maven/diktat-analysis.yml b/examples/maven/diktat-analysis.yml index 59015a6785..a028be2dbb 100644 --- a/examples/maven/diktat-analysis.yml +++ b/examples/maven/diktat-analysis.yml @@ -7,7 +7,7 @@ # expected values: disabledChapters: "Naming, Comments, General, Variables, Functions, Classes" # or: "1, 2, 3, 4, 5, 6" disabledChapters: "" - kotlinVersion: 1.9 + kotlinVersion: 2.1 srcDirectories: "main" # Checks that the Class/Enum/Interface name matches Pascal case - name: CLASS_NAME_INCORRECT diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 936670c354..f1d4a138fa 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,8 +1,8 @@ [versions] -kotlin = "1.9.24" -kotlin-ksp = "1.9.24-1.0.20" +kotlin = "2.1.0" +kotlin-ksp = "2.1.0-1.0.29" serialization = "1.6.3" -ktlint = "1.0.1" +ktlint = "1.5.0" junit = "5.10.2" junit-platfrom = "1.10.2" guava = "33.0.0-jre" @@ -16,13 +16,13 @@ jacoco = "0.8.8" maven-api = "3.9.6" maven-plugin-tools = "3.8.1" maven-plugin-testing-harness = "3.3.0" -plexus = "2.1.0" +plexus = "3.0.0" jbool = "1.24" kotlin-logging = "6.0.3" log4j2 = "2.23.1" kaml = "0.57.0" -sarif4k = "0.5.0" +sarif4k = "0.6.0" jupiter-itf-extension = "0.13.1" # executable jar @@ -30,7 +30,7 @@ kotlinx-cli = "0.3.6" gradle-shadow = "8.1.1" # copied from save-cloud -jetbrains-annotations = "24.1.0" +jetbrains-annotations = "26.0.1" kotlinx-coroutines = "1.8.0" assertj = "3.25.3" diktat = "2.0.0" diff --git a/gradle/plugins/src/main/kotlin/com/saveourtool/diktat/buildutils/kotlin-jvm-configuration.gradle.kts b/gradle/plugins/src/main/kotlin/com/saveourtool/diktat/buildutils/kotlin-jvm-configuration.gradle.kts index 8be3c26a19..95fc17b2d8 100644 --- a/gradle/plugins/src/main/kotlin/com/saveourtool/diktat/buildutils/kotlin-jvm-configuration.gradle.kts +++ b/gradle/plugins/src/main/kotlin/com/saveourtool/diktat/buildutils/kotlin-jvm-configuration.gradle.kts @@ -1,19 +1,11 @@ package com.saveourtool.diktat.buildutils import org.gradle.api.tasks.testing.Test -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { kotlin("jvm") } -tasks.withType { - kotlinOptions { - freeCompilerArgs = freeCompilerArgs + - "-opt-in=kotlin.RequiresOptIn" + "-Werror" - } -} - java { toolchain { languageVersion.set(JavaLanguageVersion.of(Versions.jdk)) @@ -21,6 +13,10 @@ java { } kotlin { + compilerOptions { + optIn.add("kotlin.RequiresOptIn") + } + jvmToolchain { languageVersion.set(JavaLanguageVersion.of(Versions.jdk)) } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index e6441136f3..a4b76b9530 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 a4413138c9..e2847c8200 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index b740cf1339..f5feea6d6b 100755 --- a/gradlew +++ b/gradlew @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -84,7 +86,8 @@ done # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s +' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum diff --git a/gradlew.bat b/gradlew.bat index 25da30dbde..9d21a21834 100755 --- a/gradlew.bat +++ b/gradlew.bat @@ -13,6 +13,8 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem @if "%DEBUG%"=="" @echo off @rem ########################################################################## diff --git a/info/gradle/wrapper/gradle-wrapper.properties b/info/gradle/wrapper/gradle-wrapper.properties index 0d1842103b..81aa1c0448 100644 --- a/info/gradle/wrapper/gradle-wrapper.properties +++ b/info/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists