Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Gradle 8.5 #58

Merged
merged 2 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,18 @@ permissions:

jobs:
build:

runs-on: ubuntu-latest

runs-on: ${{ matrix.os }}
strategy:
matrix:
java: [ 11, 17, 21 ]
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v2
- name: Set up OpenJDK JDK 15
uses: actions/setup-java@v2
with:
java-version: '15'
distribution: 'zulu'
java-version: ${{ matrix.java }}
distribution: temurin
- name: Build with Gradle
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
with:
Expand Down
74 changes: 51 additions & 23 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@

plugins {
id 'nebula.ospackage' version "8.3.0"
id 'com.netflix.nebula.ospackage' version "11.6.0"
id 'checkstyle'
id "io.freefair.lombok" version "6.4.0"
id "io.freefair.lombok" version "8.4"
id 'jacoco'
id 'java'
id 'java-library'
id "com.diffplug.spotless" version "6.21.0"
id "com.diffplug.spotless" version "6.23.3"
id 'idea'
id 'eclipse'
}

repositories {
Expand All @@ -17,7 +19,7 @@ repositories {
}

allprojects {
version = '2.7.0'
version = '2.12.0-SNAPSHOT'

// Force using a newer version, due to guava vulnerability CVE-2023-2976. Remove after Gradle upgrades its default version.
checkstyle {
Expand All @@ -33,9 +35,9 @@ subprojects {
apply plugin: 'com.diffplug.spotless'

ext {
opensearch_version = System.getProperty("opensearch.version", "2.7.0-SNAPSHOT")
opensearch_version = System.getProperty("opensearch.version", "2.12.0-SNAPSHOT")
sdk_version = "3.24.0"
jackson_version = "2.14.2"
jackson_version = "2.16.0"
}

repositories {
Expand All @@ -57,42 +59,65 @@ subprojects {
force "commons-codec:commons-codec:1.15"
force "org.apache.httpcomponents:httpcore:4.4.15"
force "jakarta.annotation:jakarta.annotation-api:2.1.1"
force "org.javassist:javassist:3.25.0-GA"
force "org.apache.httpcomponents:httpclient:4.5.14"
// Force spotless depending on newer version of guava due to CVE-2023-2976. Remove after spotless upgrades.
force "com.google.guava:guava:32.1.2-jre"
// Force opensearch transport-netty4-client depending on newer version of netty-handler due to CVE-2023-34462.
// Remove after upgrading the compiled opensearch version.
force "io.netty:netty-handler:4.1.94.Final"
}
}

dependencies {
implementation "net.jodah:failsafe:2.4.0"
implementation "com.google.guava:guava:32.1.2-jre"
implementation "org.apache.commons:commons-lang3:3.9"
implementation "commons-io:commons-io:2.7"
implementation "commons-logging:commons-logging:1.2"
implementation "commons-codec:commons-codec:1.15"

/******************** Hacking transient dependencies for OCI SDK ********************/
// TODO: For some odd reason it seems that the OpenSearch gradle plugin overrides resolution of implementation
// configuration which is why this hack is needed so we can get the transient dependencies packaged properly


implementation("com.oracle.oci.sdk:oci-java-sdk-common-httpclient:${sdk_version}")
implementation("com.oracle.oci.sdk:oci-java-sdk-common-httpclient-jersey:${sdk_version}")
compileClasspath("com.oracle.oci.sdk:oci-java-sdk-common-httpclient-jersey:${sdk_version}")
testCompileClasspath("com.oracle.oci.sdk:oci-java-sdk-common-httpclient-jersey:${sdk_version}")
runtimeClasspath("com.oracle.oci.sdk:oci-java-sdk-common-httpclient-jersey:${sdk_version}")
testRuntimeClasspath("com.oracle.oci.sdk:oci-java-sdk-common-httpclient-jersey:${sdk_version}")

implementation("com.oracle.oci.sdk:oci-java-sdk-objectstorage:${sdk_version}")
compileClasspath("com.oracle.oci.sdk:oci-java-sdk-objectstorage:${sdk_version}")
testCompileClasspath("com.oracle.oci.sdk:oci-java-sdk-objectstorage:${sdk_version}")
runtimeClasspath("com.oracle.oci.sdk:oci-java-sdk-objectstorage:${sdk_version}")
testRuntimeClasspath("com.oracle.oci.sdk:oci-java-sdk-objectstorage:${sdk_version}")

runtimeClasspath("org.slf4j:slf4j-api") {
version {
strictly "1.7.33"
}
}
testRuntimeClasspath("org.slf4j:slf4j-api") {
implementation("com.oracle.oci.sdk:oci-java-sdk-common:${sdk_version}")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those are not new dependencies, all of them were brought in transitively

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @reta , curious why the preference to explicitly pin the versions as oppose to the above that will pull them transitively?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@samuel-oci so the transitive dependencies are not pulled (the opensearch.plugin Gradle plugin alters that), the reason they were pulled before is because the use of xxxRuntimeClasspath / xxxCompileClasspath scopes - those are not allowed anymore (in Gradle)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, thanks @reta approved.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@samuel-oci do you mind approving the workflow? seems like few checks need to be run, thank you

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies, @samuel-oci may I ask you to approve one more time (fixed build issue), thank you

implementation("com.oracle.oci.sdk:oci-java-sdk-objectstorage-generated:${sdk_version}")
implementation("com.oracle.oci.sdk:oci-java-sdk-objectstorage-extensions:${sdk_version}")
implementation("com.oracle.oci.sdk:oci-java-sdk-circuitbreaker:${sdk_version}")

implementation("io.github.resilience4j:resilience4j-circuitbreaker:1.7.1")
implementation("io.github.resilience4j:resilience4j-core:1.7.1")
implementation("jakarta.ws.rs:jakarta.ws.rs-api:2.1.6")
implementation("org.glassfish.jersey.media:jersey-media-json-jackson:2.35")
implementation("org.glassfish.jersey.ext:jersey-entity-filtering:2.35")
implementation("org.glassfish.jersey.core:jersey-client:2.35")
implementation("org.glassfish.jersey.core:jersey-common:2.35")
implementation("org.glassfish.jersey.inject:jersey-hk2:2.35")
implementation("org.glassfish.jersey.connectors:jersey-apache-connector:2.35")
implementation("jakarta.annotation:jakarta.annotation-api:2.1.1")
implementation("org.glassfish.hk2.external:jakarta.inject:2.6.1")
implementation("org.glassfish.hk2.external:aopalliance-repackaged:2.6.1")
implementation("org.glassfish.hk2:hk2-locator:2.6.1")
implementation("org.glassfish.hk2:hk2-utils:2.6.1")
implementation("org.glassfish.hk2:osgi-resource-locator:1.0.3")
implementation("org.glassfish.hk2:hk2-api:2.6.1")
implementation("org.apache.httpcomponents:httpclient:4.5.14")
implementation("org.apache.httpcomponents:httpcore:4.4.15")
implementation("org.bouncycastle:bcpkix-jdk15to18:1.74")
implementation("org.bouncycastle:bcprov-jdk15to18:1.74")
implementation("org.bouncycastle:bcutil-jdk15to18:1.74")
implementation("org.javassist:javassist:3.25.0-GA")
implementation("io.vavr:vavr:0.10.2")
implementation("io.vavr:vavr-match:0.10.2")
implementation("jakarta.xml.bind:jakarta.xml.bind-api:2.3.3")
implementation("jakarta.activation:jakarta.activation-api:1.2.2")

implementation("org.slf4j:slf4j-api") {
version {
strictly "1.7.33"
}
Expand All @@ -102,6 +127,9 @@ subprojects {
implementation("com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:${jackson_version}")
implementation("com.fasterxml.jackson.jaxrs:jackson-jaxrs-base:${jackson_version}")
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jdk8:${jackson_version}")
implementation("com.fasterxml.jackson.core:jackson-annotations:${jackson_version}")
implementation("com.fasterxml.jackson.core:jackson-databind:${jackson_version}")
implementation("com.fasterxml.jackson.module:jackson-module-jaxb-annotations:${jackson_version}")

compileOnly "org.opensearch:opensearch:${opensearch_version}"

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-7.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
41 changes: 28 additions & 13 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand All @@ -80,13 +80,11 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"'
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -133,22 +131,29 @@ location of your Java installation."
fi
else
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
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -193,18 +198,28 @@ if "$cygwin" || "$msys" ; then
done
fi

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# 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 -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"

# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi

# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
Expand Down
17 changes: 10 additions & 7 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
Expand All @@ -25,22 +25,23 @@
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

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

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Expand Down Expand Up @@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
if %ERRORLEVEL% equ 0 goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%

:mainEnd
if "%OS%"=="Windows_NT" endlocal
Expand Down
4 changes: 3 additions & 1 deletion oci-objectstorage-fixture/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ plugins {
apply plugin: 'io.freefair.lombok'
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'eclipse'
apply plugin: 'idea'

dependencies {
testImplementation 'junit:junit:4.13.2'
Expand All @@ -22,7 +24,7 @@ version = '1.0'

java {
toolchain {
languageVersion = JavaLanguageVersion.of(19)
languageVersion = JavaLanguageVersion.of(21)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
import lombok.extern.log4j.Log4j2;
import org.opensearch.common.bytes.BytesReference;
import org.opensearch.common.io.Streams;
import org.opensearch.common.regex.Regex;
import org.opensearch.rest.RestStatus;
import org.opensearch.core.common.bytes.BytesReference;
import org.opensearch.core.rest.RestStatus;
import org.opensearch.rest.RestUtils;

@Log4j2
Expand Down
1 change: 1 addition & 0 deletions oci-repository-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ apply plugin: 'opensearch.opensearchplugin'
apply plugin: 'opensearch.pluginzip'
apply plugin: "io.freefair.lombok"
apply plugin: 'jacoco'
apply plugin: 'eclipse'

def pluginName = 'repository-oci'
def pluginDescription = 'OCI Object storage repository'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
import org.opensearch.common.blobstore.DeleteResult;
import org.opensearch.common.blobstore.support.PlainBlobMetadata;
import org.opensearch.common.collect.MapBuilder;
import org.opensearch.common.unit.ByteSizeUnit;
import org.opensearch.common.unit.ByteSizeValue;
import org.opensearch.core.common.unit.ByteSizeUnit;
import org.opensearch.core.common.unit.ByteSizeValue;

// Lots of code duplication with OciObjectStorageBlobStore and OciObjectStorageBlobContainer
// Re-using the code will require significant refactoring which is needed on both
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
import lombok.extern.log4j.Log4j2;
import org.opensearch.cluster.metadata.RepositoryMetadata;
import org.opensearch.cluster.service.ClusterService;
import org.opensearch.common.Strings;
import org.opensearch.common.blobstore.BlobPath;
import org.opensearch.common.settings.Setting;
import org.opensearch.common.unit.ByteSizeUnit;
import org.opensearch.common.unit.ByteSizeValue;
import org.opensearch.core.common.Strings;
import org.opensearch.core.common.unit.ByteSizeUnit;
import org.opensearch.core.common.unit.ByteSizeValue;
import org.opensearch.core.xcontent.NamedXContentRegistry;
import org.opensearch.indices.recovery.RecoverySettings;
import org.opensearch.repositories.RepositoryException;
Expand Down Expand Up @@ -56,8 +56,6 @@ public class OciObjectStorageRepository extends BlobStoreRepository {
simpleString("bucket_compartment_id", Property.NodeScope, Property.Dynamic);
public static final Setting<String> BASE_PATH_SETTING =
simpleString("base_path", Property.NodeScope, Property.Dynamic);
public static final Setting<Boolean> COMPRESS =
boolSetting("compress", false, Property.NodeScope, Property.Dynamic);
public static final Setting<ByteSizeValue> CHUNK_SIZE_SETTING =
byteSizeSetting(
"chunk_size",
Expand All @@ -79,12 +77,7 @@ public class OciObjectStorageRepository extends BlobStoreRepository {
final OciObjectStorageService storageService,
final ClusterService clusterService,
final RecoverySettings recoverySettings) {
super(
metadata,
getSetting(COMPRESS, metadata),
namedXContentRegistry,
clusterService,
recoverySettings);
super(metadata, namedXContentRegistry, clusterService, recoverySettings);

this.storageService = storageService;
String basePath = BASE_PATH_SETTING.get(metadata.settings());
Expand Down
Loading