build(gradle): version change (Gradle and shadow plugin) (#11999)

This commit is contained in:
Dejan Stojadinović 2024-12-14 17:04:48 +01:00 committed by GitHub
parent 5617d6b447
commit 2291c71c29
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 58 additions and 40 deletions

View File

@ -34,6 +34,7 @@ buildscript {
// Releases: https://github.com/linkedin/rest.li/blob/master/CHANGELOG.md // Releases: https://github.com/linkedin/rest.li/blob/master/CHANGELOG.md
ext.pegasusVersion = '29.57.0' ext.pegasusVersion = '29.57.0'
ext.mavenVersion = '3.6.3' ext.mavenVersion = '3.6.3'
ext.versionGradle = '8.11.1'
ext.springVersion = '6.1.13' ext.springVersion = '6.1.13'
ext.springBootVersion = '3.2.9' ext.springBootVersion = '3.2.9'
ext.springKafkaVersion = '3.1.6' ext.springKafkaVersion = '3.1.6'
@ -78,7 +79,7 @@ buildscript {
plugins { plugins {
id 'com.gorylenko.gradle-git-properties' version '2.4.1' id 'com.gorylenko.gradle-git-properties' version '2.4.1'
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false id 'com.gradleup.shadow' version '8.3.5' apply false
id 'com.palantir.docker' version '0.35.0' apply false id 'com.palantir.docker' version '0.35.0' apply false
id 'com.avast.gradle.docker-compose' version '0.17.6' id 'com.avast.gradle.docker-compose' version '0.17.6'
id "com.diffplug.spotless" version "6.23.3" id "com.diffplug.spotless" version "6.23.3"
@ -499,3 +500,8 @@ subprojects {
} }
} }
} }
wrapper {
gradleVersion = project.versionGradle
distributionType = Wrapper.DistributionType.ALL
}

View File

@ -65,14 +65,14 @@ The sample authenticator implementation can be found at [Authenticator Sample](.
3. Use `getResourceAsStream` to read files: If your plugin read any configuration file like properties or YAML or JSON or xml then use `this.getClass().getClassLoader().getResourceAsStream("<file-name>")` to read that file from DataHub GMS plugin's class-path. For DataHub GMS resource look-up behavior please refer [Plugin Installation](#plugin-installation) section. Sample code of `getResourceAsStream` is available in sample Authenticator plugin [TestAuthenticator.java](../metadata-service/plugin/src/test/sample-test-plugins/src/main/java/com/datahub/plugins/test/TestAuthenticator.java). 3. Use `getResourceAsStream` to read files: If your plugin read any configuration file like properties or YAML or JSON or xml then use `this.getClass().getClassLoader().getResourceAsStream("<file-name>")` to read that file from DataHub GMS plugin's class-path. For DataHub GMS resource look-up behavior please refer [Plugin Installation](#plugin-installation) section. Sample code of `getResourceAsStream` is available in sample Authenticator plugin [TestAuthenticator.java](../metadata-service/plugin/src/test/sample-test-plugins/src/main/java/com/datahub/plugins/test/TestAuthenticator.java).
4. Bundle your Jar: Use `com.github.johnrengelman.shadow` gradle plugin to create an uber jar. 4. Bundle your Jar: Use `com.gradleup.shadow` gradle plugin to create an uber jar.
To see an example of building an uber jar, check out the `build.gradle` file for the apache-ranger-plugin file of [Apache Ranger Plugin](https://github.com/acryldata/datahub-ranger-auth-plugin/tree/main/apache-ranger-plugin) for reference. To see an example of building an uber jar, check out the `build.gradle` file for the apache-ranger-plugin file of [Apache Ranger Plugin](https://github.com/acryldata/datahub-ranger-auth-plugin/tree/main/apache-ranger-plugin) for reference.
Exclude signature files as shown in below `shadowJar` task. Exclude signature files as shown in below `shadowJar` task.
```groovy ```groovy
apply plugin: 'com.github.johnrengelman.shadow'; apply plugin: 'com.gradleup.shadow';
shadowJar { shadowJar {
// Exclude com.datahub.plugins package and files related to jar signature // Exclude com.datahub.plugins package and files related to jar signature
exclude "META-INF/*.RSA", "META-INF/*.SF","META-INF/*.DSA" exclude "META-INF/*.RSA", "META-INF/*.SF","META-INF/*.DSA"
@ -152,14 +152,14 @@ The sample authorizer implementation can be found at [Authorizer Sample](https:/
3. Use `getResourceAsStream` to read files: If your plugin read any configuration file like properties or YAML or JSON or xml then use `this.getClass().getClassLoader().getResourceAsStream("<file-name>")` to read that file from DataHub GMS plugin's class-path. For DataHub GMS resource look-up behavior please refer [Plugin Installation](#plugin-installation) section. Sample code of `getResourceAsStream` is available in sample Authenticator plugin [TestAuthenticator.java](../metadata-service/plugin/src/test/sample-test-plugins/src/main/java/com/datahub/plugins/test/TestAuthenticator.java). 3. Use `getResourceAsStream` to read files: If your plugin read any configuration file like properties or YAML or JSON or xml then use `this.getClass().getClassLoader().getResourceAsStream("<file-name>")` to read that file from DataHub GMS plugin's class-path. For DataHub GMS resource look-up behavior please refer [Plugin Installation](#plugin-installation) section. Sample code of `getResourceAsStream` is available in sample Authenticator plugin [TestAuthenticator.java](../metadata-service/plugin/src/test/sample-test-plugins/src/main/java/com/datahub/plugins/test/TestAuthenticator.java).
4. Bundle your Jar: Use `com.github.johnrengelman.shadow` gradle plugin to create an uber jar. 4. Bundle your Jar: Use `com.gradleup.shadow` gradle plugin to create an uber jar.
To see an example of building an uber jar, check out the `build.gradle` file for the apache-ranger-plugin file of [Apache Ranger Plugin](https://github.com/acryldata/datahub-ranger-auth-plugin/tree/main/apache-ranger-plugin) for reference. To see an example of building an uber jar, check out the `build.gradle` file for the apache-ranger-plugin file of [Apache Ranger Plugin](https://github.com/acryldata/datahub-ranger-auth-plugin/tree/main/apache-ranger-plugin) for reference.
Exclude signature files as shown in below `shadowJar` task. Exclude signature files as shown in below `shadowJar` task.
```groovy ```groovy
apply plugin: 'com.github.johnrengelman.shadow'; apply plugin: 'com.gradleup.shadow';
shadowJar { shadowJar {
// Exclude com.datahub.plugins package and files related to jar signature // Exclude com.datahub.plugins package and files related to jar signature
exclude "META-INF/*.RSA", "META-INF/*.SF","META-INF/*.DSA" exclude "META-INF/*.RSA", "META-INF/*.SF","META-INF/*.DSA"

Binary file not shown.

View File

@ -1,6 +1,8 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip distributionSha256Sum=89d4e70e4e84e2d2dfbb63e4daa53e21b25017cc70c37e4eea31ee51fb15098a
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-all.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

34
gradlew vendored
View File

@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# #
# SPDX-License-Identifier: Apache-2.0
#
############################################################################## ##############################################################################
# #
@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop. # Darwin, MinGW, and NonStop.
# #
# (3) This script is generated from the Groovy template # (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project. # within the Gradle project.
# #
# You can find Gradle at https://github.com/gradle/gradle/. # You can find Gradle at https://github.com/gradle/gradle/.
@ -83,10 +85,9 @@ done
# This is normally unused # This is normally unused
# shellcheck disable=SC2034 # shellcheck disable=SC2034
APP_BASE_NAME=${0##*/} APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. ' "$PWD" ) || exit
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum MAX_FD=maximum
@ -133,18 +134,21 @@ location of your Java installation."
fi fi
else else
JAVACMD=java JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the Please set the JAVA_HOME variable in your environment to match the
location of your Java installation." location of your Java installation."
fi fi
fi
# Increase the maximum file descriptors if we can. # Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #( case $MAX_FD in #(
max*) max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045 # shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) || MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit" warn "Could not query maximum file descriptor limit"
esac esac
@ -152,7 +156,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
'' | soft) :;; #( '' | soft) :;; #(
*) *)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045 # shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" || ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD" warn "Could not set maximum file descriptor limit to $MAX_FD"
esac esac
@ -197,11 +201,15 @@ if "$cygwin" || "$msys" ; then
done done
fi fi
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
# shell script including quotes and variable substitutions, so put them in DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded. # Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \ set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \ "-Dorg.gradle.appname=$APP_BASE_NAME" \

22
gradlew.bat vendored
View File

@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and @rem See the License for the specific language governing permissions and
@rem limitations under the License. @rem limitations under the License.
@rem @rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off @if "%DEBUG%"=="" @echo off
@rem ########################################################################## @rem ##########################################################################
@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 %JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute if %ERRORLEVEL% equ 0 goto execute
echo. echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. echo location of your Java installation. 1>&2
goto fail goto fail
@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute if exist "%JAVA_EXE%" goto execute
echo. echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. echo location of your Java installation. 1>&2
goto fail goto fail

View File

@ -2,7 +2,7 @@ plugins {
id("com.palantir.git-version") apply false id("com.palantir.git-version") apply false
} }
apply plugin: 'com.github.johnrengelman.shadow' apply plugin: 'com.gradleup.shadow'
apply plugin: 'java-library' apply plugin: 'java-library'
apply plugin: 'signing' apply plugin: 'signing'
apply plugin: 'maven-publish' apply plugin: 'maven-publish'

View File

@ -2,7 +2,7 @@ plugins {
id("com.palantir.git-version") apply false id("com.palantir.git-version") apply false
} }
apply plugin: 'java-library' apply plugin: 'java-library'
apply plugin: 'com.github.johnrengelman.shadow' apply plugin: 'com.gradleup.shadow'
apply plugin: 'signing' apply plugin: 'signing'
apply plugin: 'io.codearte.nexus-staging' apply plugin: 'io.codearte.nexus-staging'
apply plugin: 'maven-publish' apply plugin: 'maven-publish'

View File

@ -1,6 +1,6 @@
plugins { plugins {
id 'java-library' id 'java-library'
id 'com.github.johnrengelman.shadow' id 'com.gradleup.shadow'
id 'signing' id 'signing'
id 'io.codearte.nexus-staging' id 'io.codearte.nexus-staging'
id 'maven-publish' id 'maven-publish'

View File

@ -1,7 +1,7 @@
plugins { plugins {
id("com.palantir.git-version") apply false id("com.palantir.git-version") apply false
id 'java-library' id 'java-library'
id 'com.github.johnrengelman.shadow' id 'com.gradleup.shadow'
id 'signing' id 'signing'
id 'io.codearte.nexus-staging' id 'io.codearte.nexus-staging'
id 'maven-publish' id 'maven-publish'

View File

@ -1,7 +1,7 @@
plugins { plugins {
id("com.palantir.git-version") apply false id("com.palantir.git-version") apply false
id 'java' id 'java'
id 'com.github.johnrengelman.shadow' id 'com.gradleup.shadow'
id 'signing' id 'signing'
id 'io.codearte.nexus-staging' id 'io.codearte.nexus-staging'
id 'maven-publish' id 'maven-publish'

View File

@ -3,7 +3,7 @@ plugins {
id "application" id "application"
} }
apply plugin: 'java' apply plugin: 'java'
apply plugin: 'com.github.johnrengelman.shadow' apply plugin: 'com.gradleup.shadow'
apply plugin: 'signing' apply plugin: 'signing'
apply plugin: 'io.codearte.nexus-staging' apply plugin: 'io.codearte.nexus-staging'
apply plugin: 'maven-publish' apply plugin: 'maven-publish'

View File

@ -1,5 +1,5 @@
apply plugin: 'java-library' apply plugin: 'java-library'
apply plugin: 'com.github.johnrengelman.shadow' apply plugin: 'com.gradleup.shadow'
apply plugin: 'signing' apply plugin: 'signing'
apply plugin: 'maven-publish' apply plugin: 'maven-publish'
apply from: '../../../gradle/coverage/java-coverage.gradle' apply from: '../../../gradle/coverage/java-coverage.gradle'

View File

@ -2,7 +2,7 @@ plugins {
id("com.palantir.git-version") apply false id("com.palantir.git-version") apply false
} }
apply plugin: 'java' apply plugin: 'java'
apply plugin: 'com.github.johnrengelman.shadow' apply plugin: 'com.gradleup.shadow'
apply plugin: 'signing' apply plugin: 'signing'
apply plugin: 'io.codearte.nexus-staging' apply plugin: 'io.codearte.nexus-staging'
apply plugin: 'maven-publish' apply plugin: 'maven-publish'