Skip to content

Commit

Permalink
Some build tweaks (#6602)
Browse files Browse the repository at this point in the history
- Avoid eager creation of tasks
- Fix some deprecations
  • Loading branch information
melix authored Dec 3, 2021
1 parent be5d99f commit d8ce48e
Show file tree
Hide file tree
Showing 19 changed files with 46 additions and 44 deletions.
2 changes: 1 addition & 1 deletion aop/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dependencies {
compileOnly libs.kotlinx.coroutines.core
}

compileKotlin {
tasks.named("compileKotlin") {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.languageVersion = "1.6"
}
11 changes: 7 additions & 4 deletions benchmarks/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,12 @@ jmh {
fork = 1
// jvmArgs = ["-agentpath:/Applications/YourKit-Java-Profiler-2018.04.app/Contents/Resources/bin/mac/libyjpagent.jnilib"]
}
processJmhResources {

tasks.named("processJmhResources") {
duplicatesStrategy = DuplicatesStrategy.WARN
}
spotlessJavaCheck.enabled = false
checkstyleMain.enabled = false
checkstyleJmh.enabled = false
['spotlessJavaCheck', 'checkstyleMain', 'checkstyleJmh'].each {
tasks.named(it) {
enabled = false
}
}
11 changes: 7 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ subprojects { Project subproject ->
}
tasks.withType(Checkstyle).configureEach {
reports {
xml.enabled = !System.getenv("GITHUB_ACTIONS")
html.enabled = !System.getenv("GITHUB_ACTIONS")
xml.required = !System.getenv("GITHUB_ACTIONS")
html.required = !System.getenv("GITHUB_ACTIONS")
}
}

Expand All @@ -133,7 +133,7 @@ subprojects { Project subproject ->

apply plugin: 'com.github.johnrengelman.shadow'

shadowJar {
tasks.named("shadowJar") {
configurations = [project.configurations.shadowCompile]
relocate "com.github.benmanes.caffeine", "io.micronaut.caffeine"
relocate "org.objectweb.asm", "io.micronaut.asm"
Expand Down Expand Up @@ -210,7 +210,10 @@ htmlSanityCheck {
include "index.html"
}
}
docs.finalizedBy(htmlSanityCheck)

tasks.named("docs") {
finalizedBy(htmlSanityCheck)
}

tasks.named("updateVersionCatalogs") {
// we set the list to empty because we accept upgrades which improve the status
Expand Down
12 changes: 6 additions & 6 deletions core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ext {
shadowJarEnabled = true
}

shadowJar {
tasks.named("shadowJar") {
exclude "module-info.class"
}

Expand Down Expand Up @@ -33,10 +33,10 @@ spotless {
}
}

processResources.dependsOn('micronautVersionInfo')
task micronautVersionInfo(type: WriteProperties) {
outputFile = "${buildDir}/resources/main/micronaut-version.properties"
def versionInfo = tasks.register("micronautVersionInfo", WriteProperties) {
outputFile = "${buildDir}/resources/version/micronaut-version.properties"
property 'micronaut.version', projectVersion
}


tasks.named("processResources") {
from(versionInfo)
}
2 changes: 1 addition & 1 deletion gradle/geb.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dependencies {
testRuntimeOnly libs.selenium.driver.firefox
}

test {
tasks.named("test") {
systemProperty "geb.env", System.getProperty('geb.env')
systemProperty "webdriver.chrome.driver", System.getProperty('webdriver.chrome.driver')
systemProperty "webdriver.gecko.driver", System.getProperty('webdriver.gecko.driver')
Expand Down
2 changes: 1 addition & 1 deletion http-client-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ dependencies {
compileOnly libs.kotlin.stdlib
}

//tasks.withType(Test) {
//tasks.withType(Test).configureEach {
// testLogging {
// showStandardStreams = true
// exceptionFormat = 'full'
Expand Down
2 changes: 1 addition & 1 deletion http-client/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ dependencies {
}
}

//tasks.withType(Test) {
//tasks.withType(Test).configureEach {
// jvmArgs('-Dio.netty.leakDetection.level=paranoid')
// testLogging {
// showStandardStreams = true
Expand Down
2 changes: 1 addition & 1 deletion http-server-netty/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ dependencies {
testImplementation libs.junit.jupiter.api
}

//tasks.withType(Test) {
//tasks.withType(Test).configureEach {
// testLogging {
// showStandardStreams = true
// exceptionFormat = 'full'
Expand Down
2 changes: 1 addition & 1 deletion http/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ dependencies {
testImplementation project(":runtime")
}

compileKotlin {
tasks.named("compileKotlin") {
kotlinOptions.jvmTarget = "1.8"
}

Expand Down
8 changes: 3 additions & 5 deletions inject-groovy-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ dependencies {
api project(":context")
}

afterEvaluate {
sourcesJar {
from "$projectDir/src/main/groovy"
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
}
tasks.named("sourcesJar") {
from "$projectDir/src/main/groovy"
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
}
2 changes: 1 addition & 1 deletion inject-groovy/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ dependencies {
functionalTestImplementation(testFixtures(project(":test-suite")))
}

test {
tasks.named("test") {
exclude '**/*$_closure*'
}

Expand Down
6 changes: 2 additions & 4 deletions inject-java-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ dependencies {
testImplementation libs.smallrye
}

afterEvaluate {
sourcesJar {
from "$projectDir/src/main/groovy"
}
tasks.named("sourcesJar") {
from "$projectDir/src/main/groovy"
}
2 changes: 1 addition & 1 deletion inject-java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ dependencies {
//compileTestJava.options.forkOptions.jvmArgs = ['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005']


tasks.withType(Test) {
tasks.withType(Test).configureEach {
forkEvery = 100
maxParallelForks = 2
useJUnitPlatform()
Expand Down
14 changes: 7 additions & 7 deletions inject-kotlin-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@ dependencies {
implementation libs.kotlin.stdlib
}

afterEvaluate {
sourcesJar {
from "$projectDir/src/main/groovy"
from "$projectDir/src/main/kotlin"
}
tasks.named("sourcesJar") {
from "$projectDir/src/main/groovy"
from "$projectDir/src/main/kotlin"
}
compileKotlin {

tasks.named("compileKotlin") {
kotlinOptions {
jvmTarget = "1.8"
}
}
compileGroovy {

tasks.named("compileGroovy") {
// this allows groovy to access kotlin classes.
dependsOn tasks.getByPath('compileKotlin')
classpath += files(compileKotlin.destinationDir)
Expand Down
2 changes: 1 addition & 1 deletion test-suite-groovy/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ dependencies {
testImplementation libs.managed.reactor
}

//tasks.withType(Test) {
//tasks.withType(Test).configureEach {
// testLogging {
// showStandardStreams = true
// exceptionFormat = 'full'
Expand Down
4 changes: 2 additions & 2 deletions test-suite-kotlin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ dependencies {
testImplementation libs.managed.reactor
}

compileTestKotlin {
tasks.named("compileTestKotlin") {
kotlinOptions.jvmTarget = "1.8"
}

test {
tasks.named("test") {
useJUnitPlatform()
}
2 changes: 1 addition & 1 deletion test-suite/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ dependencies {
testFixturesApi libs.managed.groovy
}

//tasks.withType(Test) {
//tasks.withType(Test).configureEach {
// useJUnitPlatform()
//
// jvmArgs('-Dio.netty.leakDetection.level=paranoid')
Expand Down
2 changes: 1 addition & 1 deletion tracing/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ dependencies {

}

tasks.withType(Test) {
tasks.withType(Test).configureEach {
testLogging {
showStandardStreams = true
exceptionFormat = 'full'
Expand Down
2 changes: 1 addition & 1 deletion websocket/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ dependencies {
testImplementation project(":inject-groovy")
}

test {
tasks.named("test") {
timeout = Duration.ofMinutes(5)
}

0 comments on commit d8ce48e

Please sign in to comment.