Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/sanity-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: "Sanity Check"

on:
push:
branches:
- main
- 'releases/**'
pull_request:
# The branches below must be a subset of the branches above
branches:
- main
- 'releases/**'
schedule:
- cron: '0 19 * * 3'

concurrency:
# Cancels in-progress runs only for pull requests
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions: {}

env:
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}

jobs:
analyze:
name: Analyze (${{ matrix.language }})
runs-on: ubuntu-latest
permissions:
security-events: write
strategy:
fail-fast: false
matrix:
include:
- language: actions
build-mode: none
- language: java-kotlin
build-mode: manual
steps:
- name: Check out repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
- name: Sanity Check
if: matrix.build-mode == 'manual'
uses: ./.github/actions/run-gradle
with:
encryptionKey: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
arguments: rewriteDryRun
# arguments: rewriteDryRun -Dorg.gradle.jvmargs=-Xmx8G
44 changes: 27 additions & 17 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[versions]
ant = "1.10.15"
apiguardian = "1.1.2"
asciidoctorj-pdf = "2.3.23"
asciidoctor-plugins = "4.0.5" # Check if workaround in documentation.gradle.kts can be removed when upgrading
asciidoctorj-pdf = "2.3.23"
assertj = "3.27.6"
bnd = "7.1.0"
checkstyle = "12.1.1"
Expand All @@ -15,8 +15,14 @@ junit4 = "4.13.2"
junit4Min = "4.12"
ktlint = "1.7.1"
log4j = "2.25.2"
opentest4j = "1.3.0"
openTestReporting = "0.2.5"
opentest4j = "1.3.0"
rewrite-java-security = "7.21.0"
rewrite-migrate-java = "7.21.0"
rewrite-recipe-bom = "7.21.0"
rewrite-rewrite = "7.21.0"
rewrite-static-analysis = "7.21.0"
rewrite-third-party = "7.21.0"
snapshotTests = "1.11.0"
surefire = "3.5.4"
xmlunit = "2.11.0"
Expand All @@ -27,11 +33,13 @@ ant-junit = { module = "org.apache.ant:ant-junit", version.ref = "ant" }
ant-junitlauncher = { module = "org.apache.ant:ant-junitlauncher", version.ref = "ant" }
apiguardian = { module = "org.apiguardian:apiguardian-api", version.ref = "apiguardian" }
archunit = { module = "com.tngtech.archunit:archunit-junit5", version = "1.4.1" }
asciidoctorj-pdf = { module = "org.asciidoctor:asciidoctorj-pdf", version.ref = "asciidoctorj-pdf" } # Only declared here so Dependabot knows when to update the referenced versions
assertj = { module = "org.assertj:assertj-core", version.ref = "assertj" }
bndlib = { module = "biz.aQute.bnd:biz.aQute.bndlib", version.ref = "bnd" }
checkstyle = { module = "com.puppycrawl.tools:checkstyle", version.ref = "checkstyle" }
classgraph = { module = "io.github.classgraph:classgraph", version = "4.8.184" }
commons-io = { module = "commons-io:commons-io", version = "2.21.0" }
eclipse-platform = { module = "org.eclipse.platform:org.eclipse.platform", version.ref = "eclipse" }
error-prone-contrib = { module = "tech.picnic.error-prone-support:error-prone-contrib", version = "0.26.0" }
error-prone-core = { module = "com.google.errorprone:error_prone_core", version = "2.44.0" }
fastcsv = { module = "de.siegmar:fastcsv", version = "4.1.0" }
Expand All @@ -40,17 +48,22 @@ groovy2-bom = { module = "org.codehaus.groovy:groovy-bom", version = "2.5.23" }
hamcrest = { module = "org.hamcrest:hamcrest", version = "3.0" }
jackson-dataformat-yaml = { module = "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml", version.ref = "jackson" }
jackson-module-kotlin = { module = "com.fasterxml.jackson.module:jackson-module-kotlin", version.ref = "jackson" }
jacoco = { module = "org.jacoco:jacoco", version.ref = "jacoco" }
jaxb-api = { module = "jakarta.xml.bind:jakarta.xml.bind-api", version = "4.0.4" }
jaxb-runtime = { module = "org.glassfish.jaxb:jaxb-runtime", version = "4.0.6" }
jfrunit = { module = "org.moditect.jfrunit:jfrunit-core", version = "1.0.0.Alpha2" }
jimfs = { module = "com.google.jimfs:jimfs", version = "1.3.1" }
jmh-core = { module = "org.openjdk.jmh:jmh-core", version.ref = "jmh" }
jmh-generator-annprocess = { module = "org.openjdk.jmh:jmh-generator-annprocess", version.ref = "jmh" }
joox = { module = "org.jooq:joox", version = "2.0.1" }
jruby = { module = "org.jruby:jruby", version.ref = "jruby" }
jspecify = { module = "org.jspecify:jspecify", version = "1.0.0" }
jte = { module = "gg.jte:jte", version = "3.2.1" }
junit4 = { module = "junit:junit", version = { require = "[4.12,)", prefer = "4.13.2" } }
junit4-bundle = { module = "org.apache.servicemix.bundles:org.apache.servicemix.bundles.junit", version = "4.13.2_1" }
junit4-latest = { module = "junit:junit", version.ref = "junit4" }
kotlinx-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version = "1.10.2" }
ktlint-cli = { module = "com.pinterest.ktlint:ktlint-cli", version.ref = "ktlint" }
log4j-core = { module = "org.apache.logging.log4j:log4j-core", version.ref = "log4j" }
log4j-jul = { module = "org.apache.logging.log4j:log4j-jul", version.ref = "log4j" }
maven = { module = "org.apache.maven:apache-maven", version = "3.9.11" }
Expand All @@ -61,31 +74,28 @@ mockito-core = { module = "org.mockito:mockito-core" }
mockito-junit-jupiter = { module = "org.mockito:mockito-junit-jupiter" }
nohttp-checkstyle = { module = "io.spring.nohttp:nohttp-checkstyle", version = "0.0.11" }
nullaway = { module = "com.uber.nullaway:nullaway", version = "0.12.12" }
opentest4j = { module = "org.opentest4j:opentest4j", version.ref = "opentest4j" }
openTestReporting-cli = { module = "org.opentest4j.reporting:open-test-reporting-cli", version.ref = "openTestReporting" }
openTestReporting-events = { module = "org.opentest4j.reporting:open-test-reporting-events", version.ref = "openTestReporting" }
openTestReporting-tooling-core = { module = "org.opentest4j.reporting:open-test-reporting-tooling-core", version.ref = "openTestReporting" }
openTestReporting-tooling-spi = { module = "org.opentest4j.reporting:open-test-reporting-tooling-spi", version.ref = "openTestReporting" }
opentest4j = { module = "org.opentest4j:opentest4j", version.ref = "opentest4j" }
picocli = { module = "info.picocli:picocli", version = "4.7.7" }
rewrite-java-security = { module = "org.openrewrite.recipe:rewrite-java-security", version.ref = "rewrite-java-security" }
rewrite-migrate-java = { module = "org.openrewrite.recipe:rewrite-migrate-java", version.ref = "rewrite-migrate-java" }
rewrite-recipe-bom = { module = "org.openrewrite.recipe:rewrite-recipe-bom", version.ref = "rewrite-recipe-bom" }
rewrite-rewrite = { module = "org.openrewrite.recipe:rewrite-rewrite", version.ref = "rewrite-rewrite" }
rewrite-static-analysis = { module = "org.openrewrite.recipe:rewrite-static-analysis", version.ref = "rewrite-static-analysis" }
rewrite-third-party = { module = "org.openrewrite.recipe:rewrite-third-party", version.ref = "rewrite-third-party" }
roseau-cli = { module = "io.github.alien-tools:roseau-cli", version = "0.4.0" }
slf4j-julBinding = { module = "org.slf4j:slf4j-jdk14", version = "2.0.17" }
snapshotTests-junit5 = { module = "de.skuzzle.test:snapshot-tests-junit5", version.ref = "snapshotTests" }
snapshotTests-xml = { module = "de.skuzzle.test:snapshot-tests-xml", version.ref = "snapshotTests" }
spock1 = { module = "org.spockframework:spock-core", version = "1.3-groovy-2.5" }
xmlunit-assertj = { module = "org.xmlunit:xmlunit-assertj3", version.ref = "xmlunit" }
xmlunit-placeholders = { module = "org.xmlunit:xmlunit-placeholders", version.ref = "xmlunit" }
xmlunit-jakarta-jaxb-impl = { module = "org.xmlunit:xmlunit-jakarta-jaxb-impl", version.ref = "xmlunit" }
testingAnnotations = { module = "com.gradle:develocity-testing-annotations", version = "2.0.1" }
woodstox = { module = "com.fasterxml.woodstox:woodstox-core", version = "7.1.1" }

# Only declared here so Dependabot knows when to update the referenced versions
asciidoctorj-pdf = { module = "org.asciidoctor:asciidoctorj-pdf", version.ref = "asciidoctorj-pdf" }
eclipse-platform = { module = "org.eclipse.platform:org.eclipse.platform", version.ref = "eclipse" }
jacoco = { module = "org.jacoco:jacoco", version.ref = "jacoco" }
jruby = { module = "org.jruby:jruby", version.ref = "jruby" }
junit4-latest = { module = "junit:junit", version.ref = "junit4" }
junit4-bundle = { module = "org.apache.servicemix.bundles:org.apache.servicemix.bundles.junit", version = "4.13.2_1" }
ktlint-cli = { module = "com.pinterest.ktlint:ktlint-cli", version.ref = "ktlint" }
xmlunit-assertj = { module = "org.xmlunit:xmlunit-assertj3", version.ref = "xmlunit" }
xmlunit-jakarta-jaxb-impl = { module = "org.xmlunit:xmlunit-jakarta-jaxb-impl", version.ref = "xmlunit" }
xmlunit-placeholders = { module = "org.xmlunit:xmlunit-placeholders", version.ref = "xmlunit" }

[bundles]
ant = ["ant", "ant-junit", "ant-junitlauncher"]
Expand All @@ -105,9 +115,9 @@ foojayResolver = { id = "org.gradle.toolchains.foojay-resolver", version = "1.0.
gitPublish = { id = "org.ajoberstar.git-publish", version = "5.1.3" }
jmh = { id = "me.champeau.jmh", version = "0.7.3" }
jreleaser = { id = "org.jreleaser", version = "1.21.0" }
# check if workaround in gradle.properties can be removed when updating
kotlin = { id = "org.jetbrains.kotlin.jvm", version = "2.2.21" }
kotlin = { id = "org.jetbrains.kotlin.jvm", version = "2.2.21" } # check if workaround in gradle.properties can be removed when updating
nullaway = { id = "net.ltgt.nullaway", version = "2.3.0" }
plantuml = { id = "io.freefair.plantuml", version = "9.1.0" }
rewrite = { id = "org.openrewrite.rewrite", version = "7.21.0" }
shadow = { id = "com.gradleup.shadow", version = "9.2.2" }
spotless = { id = "com.diffplug.spotless", version = "8.0.0" }
1 change: 1 addition & 0 deletions gradle/plugins/common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ dependencies {
implementation(libs.plugins.nullaway.markerCoordinates)
implementation(libs.plugins.shadow.markerCoordinates)
implementation(libs.plugins.spotless.markerCoordinates)
implementation(libs.plugins.rewrite.markerCoordinates)
Copy link
Owner Author

@Pankraz76 Pankraz76 Nov 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems to compile but it not applied i can not execute the plugin:

  • What went wrong:
    Task 'rewriteRun' not found in root project 'junit-framework' and its subprojects.

please how to fix this? @vlsi

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to apply id("junitbuild.rewrite-conventions") plugin like in

junitbuild.rewrite-conventions.gradle.kts adds Gradle plugin, and you need to use it to activate.

Copy link
Owner Author

@Pankraz76 Pankraz76 Nov 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you please help me fixing this step?

Extension with name 'rewrite' does not exist. Currently registered extension names: [ext, develocity, libs, versionCatalogs, projects, grolifant, asciidoctorj, pdfThemes, gitPublish, buildParameters, base, sourceSets, reporting, javaToolchains, java, testing, eclipse, spotless]

its able apply only the plugin id("org.openrewrite.rewrite"), but when trying to configure it its not findig it.

}

tasks.compileJava {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ plugins {
eclipse
id("junitbuild.java-toolchain-conventions")
id("junitbuild.spotless-conventions")
id("junitbuild.rewrite-conventions")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
plugins {
id("org.openrewrite.rewrite")
}

rewrite {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

Now i can execute but not configure it. When applying it fails:

An exception occurred applying plugin request [id: 'junitbuild.kotlin-library-conventions']
> Failed to apply plugin 'junitbuild.rewrite-conventions'.
   > Extension with name 'rewrite' does not exist. Currently registered extension names: [ext, develocity, libs, versionCatalogs, projects, grolifant, asciidoctorj, pdfThemes, gitPublish, buildParameters, base, sourceSets, reporting, javaToolchains, java, testing, eclipse, spotless]

activeRecipe("org.junit.openrewrite.SanityCheck")
exclusion("**CollectionUtils.java")
setExportDatatables(true)
setFailOnDryRunResults(true)
}

dependencies {
rewrite(platform("org.openrewrite.recipe:rewrite-recipe-bom:3.17.0"))
rewrite("org.openrewrite.recipe:rewrite-migrate-java:3.20.0")
rewrite("org.openrewrite.recipe:rewrite-java-security:3.19.2")
rewrite("org.openrewrite.recipe:rewrite-rewrite:0.14.1")
rewrite("org.openrewrite.recipe:rewrite-static-analysis:2.20.0")
rewrite("org.openrewrite.recipe:rewrite-third-party:0.30.0")
}
3 changes: 2 additions & 1 deletion gradle/plugins/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ rootProject.name = "plugins"

include("backward-compatibility")
include("build-parameters")
include("common")
include("code-generator")
include("common")
include("publishing")
include("rewrite")

enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import static org.apiguardian.api.API.Status.MAINTAINED;

import java.lang.reflect.Member;
import java.lang.reflect.Modifier;

import org.apiguardian.api.API;
import org.junit.platform.commons.util.ReflectionUtils;
Expand Down Expand Up @@ -47,7 +48,7 @@ private ModifierSupport() {
*
* @param clazz the class to check; never {@code null}
* @return {@code true} if the class is {@code public}
* @see java.lang.reflect.Modifier#isPublic(int)
* @see Modifier#isPublic(int)
*/
public static boolean isPublic(Class<?> clazz) {
return ReflectionUtils.isPublic(clazz);
Expand All @@ -58,7 +59,7 @@ public static boolean isPublic(Class<?> clazz) {
*
* @param member the member to check; never {@code null}
* @return {@code true} if the member is {@code public}
* @see java.lang.reflect.Modifier#isPublic(int)
* @see Modifier#isPublic(int)
*/
public static boolean isPublic(Member member) {
return ReflectionUtils.isPublic(member);
Expand All @@ -69,7 +70,7 @@ public static boolean isPublic(Member member) {
*
* @param clazz the class to check; never {@code null}
* @return {@code true} if the class is {@code private}
* @see java.lang.reflect.Modifier#isPrivate(int)
* @see Modifier#isPrivate(int)
*/
public static boolean isPrivate(Class<?> clazz) {
return ReflectionUtils.isPrivate(clazz);
Expand All @@ -80,7 +81,7 @@ public static boolean isPrivate(Class<?> clazz) {
*
* @param member the member to check; never {@code null}
* @return {@code true} if the member is {@code private}
* @see java.lang.reflect.Modifier#isPrivate(int)
* @see Modifier#isPrivate(int)
*/
public static boolean isPrivate(Member member) {
return ReflectionUtils.isPrivate(member);
Expand All @@ -96,9 +97,9 @@ public static boolean isPrivate(Member member) {
*
* @param clazz the class to check; never {@code null}
* @return {@code true} if the class is not {@code private}
* @see java.lang.reflect.Modifier#isPublic(int)
* @see java.lang.reflect.Modifier#isProtected(int)
* @see java.lang.reflect.Modifier#isPrivate(int)
* @see Modifier#isPublic(int)
* @see Modifier#isProtected(int)
* @see Modifier#isPrivate(int)
*/
public static boolean isNotPrivate(Class<?> clazz) {
return ReflectionUtils.isNotPrivate(clazz);
Expand All @@ -114,9 +115,9 @@ public static boolean isNotPrivate(Class<?> clazz) {
*
* @param member the member to check; never {@code null}
* @return {@code true} if the member is not {@code private}
* @see java.lang.reflect.Modifier#isPublic(int)
* @see java.lang.reflect.Modifier#isProtected(int)
* @see java.lang.reflect.Modifier#isPrivate(int)
* @see Modifier#isPublic(int)
* @see Modifier#isProtected(int)
* @see Modifier#isPrivate(int)
*/
public static boolean isNotPrivate(Member member) {
return ReflectionUtils.isNotPrivate(member);
Expand All @@ -127,7 +128,7 @@ public static boolean isNotPrivate(Member member) {
*
* @param clazz the class to check; never {@code null}
* @return {@code true} if the class is {@code abstract}
* @see java.lang.reflect.Modifier#isAbstract(int)
* @see Modifier#isAbstract(int)
*/
public static boolean isAbstract(Class<?> clazz) {
return ReflectionUtils.isAbstract(clazz);
Expand All @@ -138,7 +139,7 @@ public static boolean isAbstract(Class<?> clazz) {
*
* @param member the class to check; never {@code null}
* @return {@code true} if the member is {@code abstract}
* @see java.lang.reflect.Modifier#isAbstract(int)
* @see Modifier#isAbstract(int)
*/
public static boolean isAbstract(Member member) {
return ReflectionUtils.isAbstract(member);
Expand All @@ -150,7 +151,7 @@ public static boolean isAbstract(Member member) {
* @param clazz the class to check; never {@code null}
* @return {@code true} if the class is not {@code abstract}
* @since 1.13
* @see java.lang.reflect.Modifier#isAbstract(int)
* @see Modifier#isAbstract(int)
*/
@API(status = EXPERIMENTAL, since = "6.0")
public static boolean isNotAbstract(Class<?> clazz) {
Expand All @@ -163,7 +164,7 @@ public static boolean isNotAbstract(Class<?> clazz) {
* @param member the class to check; never {@code null}
* @return {@code true} if the member is not {@code abstract}
* @since 1.13
* @see java.lang.reflect.Modifier#isAbstract(int)
* @see Modifier#isAbstract(int)
*/
@API(status = EXPERIMENTAL, since = "6.0")
public static boolean isNotAbstract(Member member) {
Expand All @@ -175,7 +176,7 @@ public static boolean isNotAbstract(Member member) {
*
* @param clazz the class to check; never {@code null}
* @return {@code true} if the class is {@code static}
* @see java.lang.reflect.Modifier#isStatic(int)
* @see Modifier#isStatic(int)
*/
public static boolean isStatic(Class<?> clazz) {
return ReflectionUtils.isStatic(clazz);
Expand All @@ -186,7 +187,7 @@ public static boolean isStatic(Class<?> clazz) {
*
* @param member the member to check; never {@code null}
* @return {@code true} if the member is {@code static}
* @see java.lang.reflect.Modifier#isStatic(int)
* @see Modifier#isStatic(int)
*/
public static boolean isStatic(Member member) {
return ReflectionUtils.isStatic(member);
Expand All @@ -197,7 +198,7 @@ public static boolean isStatic(Member member) {
*
* @param clazz the class to check; never {@code null}
* @return {@code true} if the class is not {@code static}
* @see java.lang.reflect.Modifier#isStatic(int)
* @see Modifier#isStatic(int)
*/
public static boolean isNotStatic(Class<?> clazz) {
return ReflectionUtils.isNotStatic(clazz);
Expand All @@ -208,7 +209,7 @@ public static boolean isNotStatic(Class<?> clazz) {
*
* @param member the member to check; never {@code null}
* @return {@code true} if the member is not {@code static}
* @see java.lang.reflect.Modifier#isStatic(int)
* @see Modifier#isStatic(int)
*/
public static boolean isNotStatic(Member member) {
return ReflectionUtils.isNotStatic(member);
Expand All @@ -220,7 +221,7 @@ public static boolean isNotStatic(Member member) {
* @param clazz the class to check; never {@code null}
* @return {@code true} if the class is {@code final}
* @since 1.5
* @see java.lang.reflect.Modifier#isFinal(int)
* @see Modifier#isFinal(int)
*/
@API(status = MAINTAINED, since = "1.5")
public static boolean isFinal(Class<?> clazz) {
Expand All @@ -233,7 +234,7 @@ public static boolean isFinal(Class<?> clazz) {
* @param clazz the class to check; never {@code null}
* @return {@code true} if the class is not {@code final}
* @since 1.5
* @see java.lang.reflect.Modifier#isFinal(int)
* @see Modifier#isFinal(int)
*/
@API(status = MAINTAINED, since = "1.5")
public static boolean isNotFinal(Class<?> clazz) {
Expand All @@ -246,7 +247,7 @@ public static boolean isNotFinal(Class<?> clazz) {
* @param member the member to check; never {@code null}
* @return {@code true} if the member is {@code final}
* @since 1.5
* @see java.lang.reflect.Modifier#isFinal(int)
* @see Modifier#isFinal(int)
*/
@API(status = MAINTAINED, since = "1.5")
public static boolean isFinal(Member member) {
Expand All @@ -259,7 +260,7 @@ public static boolean isFinal(Member member) {
* @param member the member to check; never {@code null}
* @return {@code true} if the member is not {@code final}
* @since 1.5
* @see java.lang.reflect.Modifier#isFinal(int)
* @see Modifier#isFinal(int)
*/
@API(status = MAINTAINED, since = "1.5")
public static boolean isNotFinal(Member member) {
Expand Down
Loading
Loading