Skip to content

Commit

Permalink
minor build clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-manes committed Feb 12, 2023
1 parent 012fc4f commit d084f2d
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 36 deletions.
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ buildscript {
classpath gradlePlugins.values()
classpath platforms.collect { platform(it) }

configurations.all { configuration ->
configurations.configureEach { configuration ->
restrictions.each { module, version ->
constraints.add(configuration.name, module).version { require version }
}
Expand All @@ -50,7 +50,7 @@ allprojects {
'api', 'apiElements', 'archives', 'compileClasspath', 'compileOnlyApi', 'default',
'implementation', 'javadocElements', 'runtimeClasspath', 'runtimeElements', 'runtimeOnly',
'sourcesElements', 'testCompileClasspath', 'testRuntimeClasspath']
configurations.all { configuration ->
configurations.configureEach { configuration ->
if (name !in ignored) {
restrictions.each { module, version ->
constraints.add(configuration.name, module).version { require version }
Expand All @@ -71,7 +71,7 @@ subprojects {
apply from: "${rootDir}/gradle/dependencies.gradle"
apply from: "${rootDir}/gradle/objectLayout.gradle"

configurations.all {
configurations.configureEach {
resolutionStrategy.dependencySubstitution {
substitute module('org.hamcrest:hamcrest-core') using module(testLibraries.hamcrest)
}
Expand Down Expand Up @@ -158,9 +158,9 @@ snyk {
}
tasks.named('snyk-test').configure {
notCompatibleWithConfigurationCache(
'The snyk-test task is not compatible with the configuration cache')
"The ${name} task is not compatible with the configuration cache")
}
tasks.named('snyk-monitor').configure {
notCompatibleWithConfigurationCache(
'The snyk-monitor task is not compatible with the configuration cache')
"The ${name} task is not compatible with the configuration cache")
}
2 changes: 1 addition & 1 deletion caffeine/testing.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ tasks.register('stress', Stresser) {
group = 'Cache tests'
description = 'Executes a stress test'
notCompatibleWithConfigurationCache(
'The stress task is not compatible with the configuration cache')
"The ${name} task is not compatible with the configuration cache")
outputs.upToDateWhen { false }
dependsOn compileTestJava
}
26 changes: 14 additions & 12 deletions gradle/codeQuality.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -221,18 +221,20 @@ tasks.withType(Checkstyle).configureEach {
}
}

afterEvaluate {
tasks.findAll { it.name.startsWith('forbiddenApis') }*.configure {
enabled = System.properties.containsKey('forbiddenApis')
}
tasks.findAll { it.name.startsWith('spotbugs') }*.configure {
notCompatibleWithConfigurationCache('Spotbugs is not compatible with the configuration cache')
enabled = System.properties.containsKey('spotbugs')
group = 'SpotBugs'
reports {
html.required = true
sarif.required = true
}
tasks.matching { it.name.startsWith('forbiddenApis') }.configureEach {
notCompatibleWithConfigurationCache(
"The ${name} task is not compatible with the configuration cache")
enabled = System.properties.containsKey('forbiddenApis')
}

tasks.matching { it.name.startsWith('spotbugs') }.configureEach {
notCompatibleWithConfigurationCache(
"The ${name} task is not compatible with the configuration cache")
enabled = System.properties.containsKey('spotbugs')
group = 'SpotBugs'
reports {
html.required = true
sarif.required = true
}
}

Expand Down
2 changes: 1 addition & 1 deletion gradle/coverage.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ tasks.named('coveralls').configure {
group = 'Coverage reports'
description = 'Uploads the aggregated coverage report to Coveralls'
notCompatibleWithConfigurationCache(
'The coveralls task is not compatible with the configuration cache')
"The ${name} task is not compatible with the configuration cache")
dependsOn jacocoFullReport
onlyIf { System.env.CI }
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ ext {
univocityParsers: '2.9.1',
ycsb: '0.17.0',
xz: '1.9',
zstd: '1.5.2-5',
zstd: '1.5.4-1',
]
testVersions = [
awaitility: '4.2.0',
Expand Down
10 changes: 4 additions & 6 deletions gradle/eclipse.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@ import org.gradle.plugins.ide.eclipse.model.SourceFolder
apply plugin: 'eclipse'

// Exclude module-info when compiling through Eclipse
afterEvaluate {
eclipse.classpath.file.whenMerged {
def main = entries.find { it instanceof SourceFolder && it.path == 'src/main/java' }
if (main != null) {
main.excludes.add('module-info.java')
}
eclipse.classpath.file.whenMerged {
def main = entries.find { it instanceof SourceFolder && it.path == 'src/main/java' }
if (main != null) {
main.excludes.add('module-info.java')
}
}

Expand Down
11 changes: 3 additions & 8 deletions gradle/jmh.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,11 @@ eclipse.classpath.file.whenMerged {

configurations {
jmh {
extendsFrom testImplementation
exclude module: 'slf4j-test'
}
}

dependencies {
afterEvaluate {
jmh configurations.testImplementation.allDependencies
}
}

tasks.named('jmh').configure {
group = 'Benchmarks'
description = 'Executes a Java microbenchmark'
Expand Down Expand Up @@ -91,12 +86,12 @@ jmhReport {

tasks.named('jmhReport').configure {
notCompatibleWithConfigurationCache(
'The jmhReport task is not compatible with the configuration cache')
"The ${name} task is not compatible with the configuration cache")
}

tasks.named('jmhJar').configure {
notCompatibleWithConfigurationCache(
'The jmhJar task is not compatible with the configuration cache')
"The ${name} task is not compatible with the configuration cache")
}

tasks.named('jmh').configure {
Expand Down
4 changes: 2 additions & 2 deletions simulator/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ tasks.register('simulate', Simulate) {
group 'Application'
description 'Runs multiple simulations and generates an aggregate report'
notCompatibleWithConfigurationCache(
'The simulate task is not compatible with the configuration cache')
"The ${name} task is not compatible with the configuration cache")
dependsOn processResources, compileJava
outputs.upToDateWhen { false }
}
Expand Down Expand Up @@ -205,7 +205,7 @@ tasks.register('rewrite', Rewrite) {
group 'Application'
description 'Rewrite traces into the format used by other simulators'
notCompatibleWithConfigurationCache(
'The rewrite task is not compatible with the configuration cache')
"The ${name} task is not compatible with the configuration cache")
dependsOn processResources, compileJava
outputs.upToDateWhen { false }
}

0 comments on commit d084f2d

Please sign in to comment.