Skip to content
Merged
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
16 changes: 2 additions & 14 deletions gradle/spotless.gradle
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading