Skip to content

Commit

Permalink
misc: minor things (#1052)
Browse files Browse the repository at this point in the history
* Use javadoc task directly

* No need to apply java-gradle-plugin

* Simple property assignment for toolchain

* Compile only AGP API

* Import Detekt

* User infix styles

* Use regex for google maven repo

* Enable config cache

* Revert "Compile only AGP API"

This reverts commit 4f58701.

* Re-enable Spotless check for Groovy files

* Fix styles

* Kotlin cleanups

* Disable trim_trailing_whitespace for md files
  • Loading branch information
Goooler committed Dec 3, 2023
1 parent b9ccf30 commit a08353a
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 14 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@ indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2
9 changes: 5 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import io.gitlab.arturbosch.detekt.Detekt

plugins {
groovy
`java-gradle-plugin`
jacoco
signing
kotlin("jvm") version "1.9.21"
Expand All @@ -14,7 +15,7 @@ plugins {

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(11))
languageVersion = JavaLanguageVersion.of(11)
}
}

Expand Down Expand Up @@ -44,7 +45,7 @@ signing {
}

tasks {
named<io.gitlab.arturbosch.detekt.Detekt>("detekt") {
named<Detekt>("detekt") {
reports {
sarif.required = true
}
Expand All @@ -61,7 +62,7 @@ tasks {
withType<Jar>().configureEach {
dependsOn(processResources)
}
named("javadoc") {
javadoc {
enabled = false
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ plugins {
}

spotless {
groovy {
licenseHeaderFile(rootProject.file("gradle/HEADER.txt"))
target("**/*.groovy")
greclipse()
indentWithSpaces()
}
kotlin {
ktlint()
}
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
org.gradle.jvmargs=-Dfile.encoding=UTF-8 -Xmx4g
org.gradle.parallel=true
org.gradle.caching=true
org.gradle.configuration-cache=true
12 changes: 9 additions & 3 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,18 @@ pluginManagement {
}

plugins {
id("com.gradle.enterprise") version("3.15.1")
id("org.gradle.toolchains.foojay-resolver-convention") version("0.7.0")
id("com.gradle.enterprise") version "3.15.1"
id("org.gradle.toolchains.foojay-resolver-convention") version "0.7.0"
}

dependencyResolutionManagement {
repositories {
// To download the Android Gradle Plugin
google()
google {
content {
includeGroupByRegex(".*android.*")
}
}
// To download trove4j required by the Android Gradle Plugin
mavenCentral()
}
Expand All @@ -29,3 +33,5 @@ gradleEnterprise {
publishAlwaysIf(isCiBuild)
}
}

enableFeaturePreview("STABLE_CONFIGURATION_CACHE")
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ class CacheabilityFunctionalTest extends BaseFunctionalTest {
*/
@IgnoreIf({
def current = System.getProperty('gradleVersion', GradleVersion.current().version)
return GradleVersion.version(current) < GradleVersion.version("8.1") })
return GradleVersion.version(current) < GradleVersion.version("8.1")
})
def 'spotbugsMain task runs with configuration cache'() {
given:
initializeBuildFile(rootDir)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ public class Foo {

@IgnoreIf({
def current = System.getProperty('gradleVersion', GradleVersion.current().version)
return GradleVersion.version(current) < GradleVersion.version("8.2") })
return GradleVersion.version(current) < GradleVersion.version("8.2")
})
def "can set params to SpotBugsExtension"() {
setup:
buildFile << """
Expand Down Expand Up @@ -126,7 +127,8 @@ dependencies {

@IgnoreIf({
def current = System.getProperty('gradleVersion', GradleVersion.current().version)
return GradleVersion.version(current) < GradleVersion.version("8.2") })
return GradleVersion.version(current) < GradleVersion.version("8.2")
})
def "can generate spotbugs.html in configured outputLocation"() {
buildFile << """
tasks.spotbugsMain {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ interface SpotBugsExtension {
/**
* Property to set the directory to generate report files. Default is `"$buildDir/reports/spotbugs"`.
*
* Note that each [SpotBugsTask] creates own sub-directory in this directory.
* Note that each [SpotBugsTask] creates own subdirectory in this directory.
*/
val reportsDir: DirectoryProperty

Expand Down
1 change: 1 addition & 0 deletions src/main/kotlin/com/github/spotbugs/snom/SpotBugsReport.kt
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ abstract class SpotBugsReport
}
}

@Suppress("MemberVisibilityCanBePrivate")
fun configure(action: Action<in Report>): Report {
action.execute(this)
return this
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/com/github/spotbugs/snom/SpotBugsTask.kt
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,8 @@ abstract class SpotBugsTask : DefaultTask(), VerificationTask {
else -> throw InvalidUserDataException("$name is invalid as the report name")
}
}
setDescription("Run SpotBugs analysis.")
setGroup(JavaBasePlugin.VERIFICATION_GROUP)
description = "Run SpotBugs analysis."
group = JavaBasePlugin.VERIFICATION_GROUP
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import java.io.OutputStream
internal class OutputScanner(out: OutputStream) : FilterOutputStream(out) {
private val builder = ByteArrayOutputStream()
var isFailedToReport = false
get() = field

override fun write(
b: ByteArray,
Expand Down

0 comments on commit a08353a

Please sign in to comment.