diff --git a/gradle/spotless.gradle b/gradle/spotless.gradle index 0289e09d57..f19bf46911 100644 --- a/gradle/spotless.gradle +++ b/gradle/spotless.gradle @@ -1,17 +1,5 @@ apply plugin: 'com.diffplug.spotless' spotless { - def noInternalDepsClosure = { - String text = it - /* - * No good way to get around using this import: - * https://github.com/gradle/gradle/issues/3191 - */ - String regex = "import org\\.gradle\\.api\\.internal\\.(?!plugins\\.DslObject)(?!project\\.ProjectInternal)" - if ((text.contains('import org.gradle.internal.') || text.find(regex)) && - !text.contains('def noInternalDepsClosure')) { - throw new AssertionError("Accidental internal import") - } - } if (project != rootProject) { // the rootProject doesn't have any java java { @@ -22,9 +10,9 @@ spotless { eclipse().configFile rootProject.file('gradle/spotless.eclipseformat.xml') trimTrailingWhitespace() removeUnusedImports() - removeWildcardImports() formatAnnotations() - custom 'noInternalDeps', noInternalDepsClosure + forbidWildcardImports() + forbidRegex('ForbidGradleInternal', 'import org\\.gradle\\.api\\.internal\\.(.*)', "Don't use Gradle's internal API") } } groovyGradle { diff --git a/settings.gradle b/settings.gradle index 92bffc5031..64db3b18a8 100644 --- a/settings.gradle +++ b/settings.gradle @@ -6,7 +6,7 @@ pluginManagement { } plugins { - id 'com.diffplug.spotless' version '7.2.1' apply false + id 'com.diffplug.spotless' version '8.0.0' apply false // https://plugins.gradle.org/plugin/com.gradle.plugin-publish id 'com.gradle.plugin-publish' version '2.0.0' apply false // https://github.com/gradle-nexus/publish-plugin/releases