diff --git a/.github/workflows/diktat_snapshot.yml b/.github/workflows/diktat_snapshot.yml index 6146ada96a..3e6bf8c3d7 100644 --- a/.github/workflows/diktat_snapshot.yml +++ b/.github/workflows/diktat_snapshot.yml @@ -71,25 +71,15 @@ jobs: - name: 'Small hack to inject implementation and to run diktat properly from snapshot' run: | #!/bin/bash - line_number=26 file_path=gradle/plugins/build.gradle.kts - string_to_insert='implementation(libs.diktat.gradle.plugin) { - exclude("io.github.detekt.sarif4k", "sarif4k") - }' + string_to_insert=' + dependencies { + implementation(libs.diktat.gradle.plugin) { + exclude("io.github.detekt.sarif4k", "sarif4k") + } + }' - # Escape the special characters in the string - escaped_string=$(sed 's/[\/&]/\\&/g' <<< "$string_to_insert") - - # Create a temporary file - tmp_file=$(mktemp) - - # Insert the string as multiple lines after the specified line number - sed "${line_number}r /dev/stdin" "$file_path" <<< "$escaped_string" > "$tmp_file" - - # Move the temporary file to overwrite the original file - mv "$tmp_file" "$file_path" - - echo "String inserted successfully." + echo $string_to_insert >> $file_path # copied from .github/workflows/diktat.yml - uses: gradle/gradle-build-action@v2 @@ -101,6 +91,7 @@ jobs: -Pdiktat.githubActions=true -Pdetekt.multiplatform.disabled=true --continue + --build-cache -PgprUser=${{ github.actor }} -PgprKey=${{ secrets.GITHUB_TOKEN }} - name: Upload SARIF report to Github diff --git a/gradle/plugins/build.gradle.kts b/gradle/plugins/build.gradle.kts index f042f4674d..2f8e603f44 100644 --- a/gradle/plugins/build.gradle.kts +++ b/gradle/plugins/build.gradle.kts @@ -16,6 +16,12 @@ repositories { gradlePluginPortal() } +tasks.withType { + compilerOptions { + freeCompilerArgs.add("-opt-in=kotlin.RequiresOptIn") + } +} + @Suppress("COMMENTED_OUT_CODE", "WRONG_INDENTATION") dependencies { // workaround https://github.com/gradle/gradle/issues/15383 @@ -39,9 +45,3 @@ dependencies { implementation(libs.kotlin.stdlib.jdk8) implementation(libs.jetbrains.annotations) } - -tasks.withType { - compilerOptions { - freeCompilerArgs.add("-opt-in=kotlin.RequiresOptIn") - } -} diff --git a/gradle/plugins/src/main/kotlin/com/saveourtool/diktat/buildutils/code-quality-convention.gradle.kts b/gradle/plugins/src/main/kotlin/com/saveourtool/diktat/buildutils/code-quality-convention.gradle.kts index 520fda1cbd..df1f869212 100644 --- a/gradle/plugins/src/main/kotlin/com/saveourtool/diktat/buildutils/code-quality-convention.gradle.kts +++ b/gradle/plugins/src/main/kotlin/com/saveourtool/diktat/buildutils/code-quality-convention.gradle.kts @@ -1,6 +1,7 @@ package com.saveourtool.diktat.buildutils -@Suppress("AVOID_NULL_CHECKS") +// FixMe: remove after 2.0.0 +@Suppress("RUN_IN_SCRIPT", "AVOID_NULL_CHECKS") plugins { id("com.saveourtool.diktat.buildutils.detekt-convention-configuration") // FixMe: remove after 2.0.0