Skip to content

Commit

Permalink
Java 16 + gradle 7.0 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
popfalushi committed May 13, 2021
1 parent ed6a0e5 commit 632a8c5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
22 changes: 5 additions & 17 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import java.time.OffsetDateTime
import java.time.format.DateTimeFormatter
import io.franzbecker.gradle.lombok.task.DelombokTask

buildscript {
repositories {
Expand Down Expand Up @@ -29,7 +28,7 @@ buildscript {
// https://github.com/spring-projects/spring-security-oauth/releases
springSecurityOAuthVersion = '2.5.1.RELEASE'

lombokPluginVersion = '4.0.0'
lombokPluginVersion = '5.3.3.3'
versioningPluginVersion = '2.14.0'
versionsPluginVersion = '0.29.0'
}
Expand All @@ -42,9 +41,9 @@ plugins {
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'net.nemerosa.versioning' version '2.14.0'
id 'com.google.protobuf' version '0.8.15'
id 'io.franzbecker.gradle-lombok' version '4.0.0' apply false
id 'io.freefair.lombok' version '5.3.3.3' apply false
id 'com.github.ben-manes.versions' version '0.36.0' // gradle dependencyUpdates
id 'com.diffplug.spotless' version '5.11.0'
id 'com.diffplug.spotless' version '5.12.1'
}

// If you attempt to build without the `--scan` parameter in `gradle 6.0+` it will cause a build error that it can't find
Expand Down Expand Up @@ -77,7 +76,7 @@ allprojects {
apply plugin: 'eclipse'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'com.diffplug.spotless'
apply plugin: 'io.franzbecker.gradle-lombok'
apply plugin: 'io.freefair.lombok'

java {
toolchain {
Expand Down Expand Up @@ -218,17 +217,6 @@ allprojects { project ->
}

if (project.name == 'grpc-common-spring-boot' || project.name == 'grpc-client-spring-boot-autoconfigure' || project.name == 'grpc-server-spring-boot-autoconfigure') {
// Properly generate javadocs for the important projects

task delombok(type: DelombokTask, dependsOn: compileJava) {
ext.outputDir = file("$buildDir/delombok")
outputs.dir(outputDir)
sourceSets.main.java.srcDirs.each {
inputs.dir(it)
args(it, '-d', outputDir)
}
}

java {
registerFeature('optionalSupport') {
usingSourceSet(sourceSets.main)
Expand All @@ -241,7 +229,7 @@ allprojects { project ->
if (project.name != 'grpc-common-spring-boot') {
dependsOn(":grpc-common-spring-boot:javadoc")
}
source = delombok.outputDir
source = delombok
failOnError = false
options.locale = 'en_US'
options.encoding = 'UTF-8'
Expand Down
6 changes: 6 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@ org.gradle.caching=true
org.gradle.vfs.watch=true
org.gradle.daemon=true

# for spotless java 16 compatibility: https://github.com/diffplug/spotless/issues/834
org.gradle.jvmargs=--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED

0 comments on commit 632a8c5

Please sign in to comment.