Skip to content
Open
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
3 changes: 3 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@ org.gradle.jvmargs=-Dfile.encoding=UTF-8 -XX:+HeapDumpOnOutOfMemoryError
org.gradle.caching=true
org.gradle.parallel=true

org.gradle.configuration-cache=true
org.gradle.configuration-cache.parallel=true

dependency.analysis.autoapply=false
dependency.analysis.print.build.health=true
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
10 changes: 4 additions & 6 deletions plugin-best-practices-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,16 @@ testing {
}

gradlePlugin {
website = 'https://github.com/autonomousapps/gradle-best-practices-plugin'
vcsUrl = 'https://github.com/autonomousapps/gradle-best-practices-plugin'

plugins {
plugin {
id = 'com.autonomousapps.plugin-best-practices-plugin'
implementationClass = 'com.autonomousapps.GradleBestPracticesPlugin'
displayName = 'Gradle Best Practices Plugin'
description = 'Gradle Plugin that detects violations of Gradle best practices in Gradle Plugins'
tags = ['best practices']
}
}
}
Expand All @@ -104,9 +108,3 @@ def check = tasks.named('check') {
tasks.named('publishPlugins') {
dependsOn(check)
}

pluginBundle {
website = 'https://github.com/autonomousapps/gradle-best-practices-plugin'
vcsUrl = 'https://github.com/autonomousapps/gradle-best-practices-plugin'
tags = ['best practices']
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,26 @@ class GradleBestPracticesPlugin : Plugin<Project> {

val baselineTask = tasks.register("bestPracticesBaseline", CreateBaselineTask::class.java)

// A RegularFileProperty is allowed to wrap a nullable RegularFile
@Suppress("NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS")
val detectViolationsTask = tasks.register("detectViolations", DetectBestPracticesViolationsTask::class.java) {
with(it) {
classesDirs.setFrom(mainOutput)
baseline.set(extension.baseline.map { f ->
if (f.asFile.exists()) f else null
baseline.set(extension.baseline.flatMap {
// Weird avoidance of nullability annotation issues required til Gradle 9.0
// https://github.com/gradle/gradle/issues/25341
provider { if (it.asFile.exists()) it else null }
})
logLevel.set(extension.level)
outputJson.set(layout.buildDirectory.file("reports/best-practices/report.json"))
outputText.set(layout.buildDirectory.file("reports/best-practices/report.txt"))
}
}

// A RegularFileProperty is allowed to wrap a nullable RegularFile
@Suppress("NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS")
val checkBestPracticesTask = tasks.register("checkBestPractices", CheckBestPracticesTask::class.java) { t ->
with(t) {
reportJson.set(detectViolationsTask.flatMap { it.outputJson })
reportText.set(detectViolationsTask.flatMap { it.outputText })
baseline.set(extension.baseline.map { f ->
if (f.asFile.exists()) f else null
baseline.set(extension.baseline.flatMap {
provider { if (it.asFile.exists()) it else null }
})
logLevel.set(extension.level)
projectPath.set(project.path)
Expand Down
11 changes: 5 additions & 6 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pluginManagement {
}

plugins {
id 'com.gradle.enterprise' version '3.10.2'
id 'com.gradle.develocity' version '4.0'
id 'com.gradle.plugin-publish' version '1.0.0'
id 'com.autonomousapps.dependency-analysis' version '1.22.0'
id 'com.autonomousapps.plugin-best-practices-plugin' version '0.9'
Expand All @@ -16,7 +16,7 @@ pluginManagement {
}

plugins {
id 'com.gradle.enterprise'
id 'com.gradle.develocity'
}

rootProject.name = 'gradle-best-practices'
Expand All @@ -30,10 +30,9 @@ dependencyResolutionManagement {
}
}

gradleEnterprise {
develocity {
buildScan {
publishAlways()
termsOfServiceUrl = 'https://gradle.com/terms-of-service'
termsOfServiceAgree = 'yes'
termsOfUseUrl = 'https://gradle.com/terms-of-service'
termsOfUseAgree = 'yes'
}
}