Skip to content

Commit

Permalink
upgrade to gradle 7 (#473)
Browse files Browse the repository at this point in the history
* git rid of all deprecated gradle APIs
* bump gradle to latest 7
* use compileOnly for avro dependency in fast-serde, make gradle 7 ignore duplicate srcSets for helper-all source jar
* enable gradle buildscans for java8 PR runs and parallel execution
  • Loading branch information
radai-rosenblatt authored Apr 7, 2023
1 parent d331359 commit 6be886d
Show file tree
Hide file tree
Showing 23 changed files with 88 additions and 86 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
key: gradle-cache-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/*.gradle') }}
- name: Build with Gradle
# add --info or --debug below for more details when trying to understand issues
run: ./gradlew clean build javadoc --stacktrace --warning-mode all --no-daemon
run: ./gradlew clean build javadoc --stacktrace --warning-mode all --no-daemon --parallel --scan
- name: Generate aggregate coverage report
run: ./gradlew codeCoverageReport --no-daemon
- name: Upload coverage to Codecov
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
path: ~/.gradle/caches
key: gradle-cache-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/*.gradle') }}
- name: Build with Gradle
run: ./gradlew clean build javadoc --stacktrace --warning-mode all --no-daemon
run: ./gradlew clean build javadoc --stacktrace --warning-mode all --no-daemon --parallel
- name: Generate aggregate coverage report
run: ./gradlew codeCoverageReport --no-daemon
- name: Upload coverage to Codecov
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
java-version: 11
- name: Build with Gradle
# add --info or --debug below for more details when trying to understand issues
run: ./gradlew clean build javadoc --stacktrace --warning-mode all --no-daemon
run: ./gradlew clean build javadoc --stacktrace --warning-mode all --no-daemon --parallel
- name: Branch tag
id: branch_tag
run: echo ::set-output name=RELEASE_TAG::${GITHUB_REF#refs/tags/}
Expand Down
2 changes: 1 addition & 1 deletion avro-builder/builder/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jar {
manifest {
attributes 'Main-Class': 'com.linkedin.avroutil1.builder.SchemaBuilder',
'Implementation-Title': ' Avro builder',
'Implementation-Version': version
'Implementation-Version': project.version
}
}

Expand Down
2 changes: 1 addition & 1 deletion avro-builder/tests/tests-allavro/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ dependencies {
exclude group: "com.thoughtworks.paranamer", module: "paranamer-ant"
}

testCompile "net.javacrumbs.json-unit:json-unit-assertj:2.19.0"
testImplementation "net.javacrumbs.json-unit:json-unit-assertj:2.19.0"

testImplementation project(":helper:helper")

Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ plugins {
id "maven-publish"
id "jacoco"
id 'com.github.johnrengelman.shadow' version '5.2.0' apply false
id 'com.github.kt3k.coveralls' version '2.10.1'
id 'com.github.kt3k.coveralls' version '2.12.2'
id "org.sonarqube" version "3.0"
}

Expand Down Expand Up @@ -311,7 +311,7 @@ task clean {
}

wrapper {
gradleVersion = '6.5.1'
gradleVersion = '7.6.1'
distributionType = Wrapper.DistributionType.ALL
}

Expand Down
12 changes: 6 additions & 6 deletions fastserde/avro-fastserde-tests110/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,17 @@ sourceSets {
}

dependencies {
implementation project(":helper:helper")
testImplementation project(":helper:helper")

implementation "org.slf4j:slf4j-api:1.7.14"
implementation "org.apache.commons:commons-lang3:3.4"
implementation "com.sun.codemodel:codemodel:2.6"
testImplementation "org.slf4j:slf4j-api:1.7.14"
testImplementation "org.apache.commons:commons-lang3:3.4"
testImplementation "com.sun.codemodel:codemodel:2.6"

compile ("org.apache.avro:avro:1.10.2") {
testImplementation ("org.apache.avro:avro:1.10.2") {
exclude group: "org.slf4j"
}

testCompile (project(":fastserde:avro-fastserde")) {
testImplementation (project(":fastserde:avro-fastserde")) {
exclude group: "org.apache.avro"
}

Expand Down
12 changes: 6 additions & 6 deletions fastserde/avro-fastserde-tests111/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ sourceSets {
}

dependencies {
implementation project(":helper:helper")
testImplementation project(":helper:helper")

implementation "org.slf4j:slf4j-api:1.7.14"
implementation "org.apache.commons:commons-lang3:3.4"
implementation "com.sun.codemodel:codemodel:2.6"
testImplementation "org.slf4j:slf4j-api:1.7.14"
testImplementation "org.apache.commons:commons-lang3:3.4"
testImplementation "com.sun.codemodel:codemodel:2.6"

compile ("org.apache.avro:avro:1.11.1") {
testImplementation ("org.apache.avro:avro:1.11.1") {
exclude group: "org.slf4j"
}

testCompile (project(":fastserde:avro-fastserde")) {
testImplementation (project(":fastserde:avro-fastserde")) {
exclude group: "org.apache.avro"
}

Expand Down
14 changes: 7 additions & 7 deletions fastserde/avro-fastserde-tests14/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ sourceSets {
}

dependencies {
implementation project(":helper:helper")
testImplementation project(":helper:helper")

implementation "org.slf4j:slf4j-api:1.7.14"
implementation "org.apache.commons:commons-lang3:3.4"
implementation "com.sun.codemodel:codemodel:2.6"
testImplementation "org.slf4j:slf4j-api:1.7.14"
testImplementation "org.apache.commons:commons-lang3:3.4"
testImplementation "com.sun.codemodel:codemodel:2.6"

compile ("org.apache.avro:avro:1.4.1") {
testImplementation ("org.apache.avro:avro:1.4.1") {
exclude group: "org.mortbay.jetty"
exclude group: "org.apache.velocity"
exclude group: "commons-lang"
Expand All @@ -36,10 +36,10 @@ dependencies {
exclude group: "org.slf4j"
}

testCompile (project(":fastserde:avro-fastserde")) {
testImplementation (project(":fastserde:avro-fastserde")) {
exclude group: "org.apache.avro"
}
testCompile ("org.apache.avro:avro:1.4.1") {
testImplementation ("org.apache.avro:avro:1.4.1") {
exclude group: "org.mortbay.jetty"
exclude group: "org.apache.velocity"
exclude group: "commons-lang"
Expand Down
12 changes: 6 additions & 6 deletions fastserde/avro-fastserde-tests15/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ sourceSets {
}

dependencies {
implementation project(":helper:helper")
testImplementation project(":helper:helper")

implementation "org.slf4j:slf4j-api:1.7.14"
implementation "org.apache.commons:commons-lang3:3.4"
implementation "com.sun.codemodel:codemodel:2.6"
testImplementation "org.slf4j:slf4j-api:1.7.14"
testImplementation "org.apache.commons:commons-lang3:3.4"
testImplementation "com.sun.codemodel:codemodel:2.6"

compile ("org.apache.avro:avro:1.5.4") {
testImplementation ("org.apache.avro:avro:1.5.4") {
exclude group: "org.slf4j"
}

testCompile (project(":fastserde:avro-fastserde")) {
testImplementation (project(":fastserde:avro-fastserde")) {
exclude group: "org.apache.avro"
}

Expand Down
12 changes: 6 additions & 6 deletions fastserde/avro-fastserde-tests16/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ sourceSets {
}

dependencies {
implementation project(":helper:helper")
testImplementation project(":helper:helper")

implementation "org.slf4j:slf4j-api:1.7.14"
implementation "org.apache.commons:commons-lang3:3.4"
implementation "com.sun.codemodel:codemodel:2.6"
testImplementation "org.slf4j:slf4j-api:1.7.14"
testImplementation "org.apache.commons:commons-lang3:3.4"
testImplementation "com.sun.codemodel:codemodel:2.6"

compile ("org.apache.avro:avro:1.6.3") {
testImplementation ("org.apache.avro:avro:1.6.3") {
exclude group: "org.slf4j"
}

testCompile (project(":fastserde:avro-fastserde")) {
testImplementation (project(":fastserde:avro-fastserde")) {
exclude group: "org.apache.avro"
}

Expand Down
12 changes: 6 additions & 6 deletions fastserde/avro-fastserde-tests17/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ sourceSets {
}

dependencies {
implementation project(":helper:helper")
testImplementation project(":helper:helper")

implementation "org.slf4j:slf4j-api:1.7.14"
implementation "org.apache.commons:commons-lang3:3.4"
implementation "com.sun.codemodel:codemodel:2.6"
testImplementation "org.slf4j:slf4j-api:1.7.14"
testImplementation "org.apache.commons:commons-lang3:3.4"
testImplementation "com.sun.codemodel:codemodel:2.6"

compile ("org.apache.avro:avro:1.7.7") {
testImplementation ("org.apache.avro:avro:1.7.7") {
exclude group: "org.slf4j"
}

testCompile (project(":fastserde:avro-fastserde")) {
testImplementation (project(":fastserde:avro-fastserde")) {
exclude group: "org.apache.avro"
}

Expand Down
12 changes: 6 additions & 6 deletions fastserde/avro-fastserde-tests18/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ sourceSets {
}

dependencies {
implementation project(":helper:helper")
testImplementation project(":helper:helper")

implementation "org.slf4j:slf4j-api:1.7.14"
implementation "org.apache.commons:commons-lang3:3.4"
implementation "com.sun.codemodel:codemodel:2.6"
testImplementation "org.slf4j:slf4j-api:1.7.14"
testImplementation "org.apache.commons:commons-lang3:3.4"
testImplementation "com.sun.codemodel:codemodel:2.6"

compile ("org.apache.avro:avro:1.8.2") {
testImplementation ("org.apache.avro:avro:1.8.2") {
exclude group: "org.slf4j"
}

testCompile (project(":fastserde:avro-fastserde")) {
testImplementation (project(":fastserde:avro-fastserde")) {
exclude group: "org.apache.avro"
}

Expand Down
12 changes: 6 additions & 6 deletions fastserde/avro-fastserde-tests19/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ sourceSets {
}

dependencies {
implementation project(":helper:helper")
testImplementation project(":helper:helper")

implementation "org.slf4j:slf4j-api:1.7.14"
implementation "org.apache.commons:commons-lang3:3.4"
implementation "com.sun.codemodel:codemodel:2.6"
testImplementation "org.slf4j:slf4j-api:1.7.14"
testImplementation "org.apache.commons:commons-lang3:3.4"
testImplementation "com.sun.codemodel:codemodel:2.6"

compile ("org.apache.avro:avro:1.9.2") {
testImplementation ("org.apache.avro:avro:1.9.2") {
exclude group: "org.slf4j"
}

testCompile (project(":fastserde:avro-fastserde")) {
testImplementation (project(":fastserde:avro-fastserde")) {
exclude group: "org.apache.avro"
}

Expand Down
8 changes: 2 additions & 6 deletions fastserde/avro-fastserde/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ dependencies {
implementation "org.apache.commons:commons-lang3:3.4"
implementation "com.sun.codemodel:codemodel:2.6"

compile ("org.apache.avro:avro:1.10.2") {
compileOnly ("org.apache.avro:avro:1.10.2") {
exclude group: "org.slf4j"
}

//Custom dependency set is required for JDK11 only source set
if (JavaVersion.current() >= JavaVersion.VERSION_11) {
java11Implementation files(sourceSets.main.output.classesDirs)
java11Implementation ("org.apache.avro:avro:1.10.2") {
java11CompileOnly ("org.apache.avro:avro:1.10.2") {
exclude group: "org.slf4j"
}
java11Implementation "org.apache.commons:commons-lang3:3.4"
Expand Down Expand Up @@ -134,10 +134,6 @@ publishing {
if ("$project.group" == o.groupId[0].text() && "helper" == o.artifactId[0].text()) {
toRemove.add(o)
}
//Also remove explicit dependency on Avro, as FaastSerde is version independent
if ("org.apache.avro" == o.groupId[0].text() && "avro" == o.artifactId[0].text()) {
toRemove.add(o)
}
}

for (Node o : toRemove) {
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
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-6.8.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 2 additions & 0 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ esac

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar


# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
Expand Down Expand Up @@ -129,6 +130,7 @@ fi
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`

JAVACMD=`cygpath --unix "$JAVACMD"`

# We build the pattern for arguments to be converted via cygpath
Expand Down
22 changes: 4 additions & 18 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
if "%ERRORLEVEL%" == "0" goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Expand All @@ -54,7 +54,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto init
if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
Expand All @@ -64,28 +64,14 @@ echo location of your Java installation.

goto fail

:init
@rem Get command-line arguments, handling Windows variants

if not "%OS%" == "Windows_NT" goto win9xME_args

:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2

:win9xME_args_slurp
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar


@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*

:end
@rem End local scope for the variables with windows NT shell
Expand Down
9 changes: 8 additions & 1 deletion helper/helper/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,14 @@ shadowJar {
//"fat" sources jar
sourceJar {
// we return here a closure to do this lazy, after all projects are configured by gradle
from { collectSourceSetsIncludingSubmodules(project) }
from {
logger.debug("collecting sourceSets")
collectSourceSetsIncludingSubmodules(project)
}
// closure above gets executed 3 times for some reason and results in duplicate source
// folder definitions. while annoying, its harmless
// TODO - figure out why
duplicatesStrategy DuplicatesStrategy.EXCLUDE
}

publishing {
Expand Down
2 changes: 1 addition & 1 deletion helper/tests/helper-tests-allavro/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ dependencies {
exclude group: "com.thoughtworks.paranamer", module: "paranamer-ant"
}

testCompile "net.javacrumbs.json-unit:json-unit-assertj:2.19.0"
testImplementation "net.javacrumbs.json-unit:json-unit-assertj:2.19.0"

testImplementation project(":helper:helper")
testImplementation project(":helper:tests:helper-tests-common")
Expand Down
Loading

0 comments on commit 6be886d

Please sign in to comment.