Skip to content

Commit

Permalink
fix gradle 7 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
xvik committed Apr 21, 2021
1 parent 4ae7b36 commit 47a7156
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
* Fix gradle 7 compatibility (for checkstyle plugin)

### 4.5.0 (2021-02-06)
* Fix report separating lines disappear in intellij IDEA output (appears when gradle output recognized as junit test output).
Extra zero-width space symbol used to prevent trims.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ class ConfigLoader {

File resolveCheckstyleConfigDir() {
// used for ${config_loc} property definition (through checkstyle.configDirectory property)
return new File(configDir, checkstyle).parentFile
File path = new File(configDir, checkstyle).parentFile
// if custom directory exists, use it, otherwise fall back to generated directory
// because gradle 7 requires configured directory existence
// (default file copying forced to create checkstyle directory and avoid gradle complains)
return path.exists() ? path : resolveCheckstyleConfig(true).parentFile
}

File resolvePmdConfig(boolean copyDefaultFile = true) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,11 @@ class BuildCacheSupportKitTest extends AbstractKitTest {
result = run('clean', 'check', '--build-cache')

then: "all plugins detect violations"
result.task(":check").outcome == TaskOutcome.UP_TO_DATE
result.task(":check").outcome == TaskOutcome.SUCCESS
result.task(":codenarcMain").outcome == TaskOutcome.FROM_CACHE
result.task(":checkstyleMain").outcome == TaskOutcome.FROM_CACHE
// since gradle 7 checkstyle's config dir must point to existing directory and so
// after project move directory (configDirectory) would always change and cache would miss
result.task(":checkstyleMain").outcome == TaskOutcome.SUCCESS
result.task(":spotbugsMain").outcome == TaskOutcome.FROM_CACHE
result.task(":pmdMain").outcome == TaskOutcome.FROM_CACHE
result.output.contains('CodeNarc violations were found in 2 files')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import org.gradle.testkit.runner.TaskOutcome
class UpstreamKitTest extends AbstractKitTest {


public static final String GRADLE = '6.8.1'
public static final String GRADLE = '7.0'

def "Check java checks"() {
setup:
Expand Down

0 comments on commit 47a7156

Please sign in to comment.