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

Gradle update #437

Merged
merged 11 commits into from
Jun 7, 2023
Merged
Show file tree
Hide file tree
Changes from 10 commits
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
4 changes: 2 additions & 2 deletions build-tools/opensearchplugin-coverage.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ jacocoTestReport {
getSourceDirectories().from(sourceSets.main.allSource)
getClassDirectories().from(sourceSets.main.output)
reports {
html.enabled = true // human readable
xml.enabled = true // for coverlay
html.required = true // human readable
xml.required = true // for coverlay
}
}

Expand Down
27 changes: 11 additions & 16 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ buildscript {
}

plugins {
id 'nebula.ospackage' version "8.3.0"
id "com.netflix.nebula.ospackage" version "11.3.0"
id 'java-library'
}

Expand Down Expand Up @@ -156,7 +156,7 @@ dependencies {
}

// RPM & Debian build
apply plugin: 'nebula.ospackage'
apply plugin: 'com.netflix.nebula.ospackage'

def es_tmp_dir = rootProject.file('build/private/es_tmp').absoluteFile
es_tmp_dir.mkdirs()
Expand Down Expand Up @@ -317,7 +317,7 @@ afterEvaluate {
ospackage {
packageName = "${name}"
release = isSnapshot ? "0.1" : '1'
version = "${project.version}"
version = "${project.version}" - "-SNAPSHOT"
petardz marked this conversation as resolved.
Show resolved Hide resolved

into '/usr/share/opensearch/plugins'
from(zipTree(bundlePlugin.archivePath)) {
Expand All @@ -329,17 +329,17 @@ afterEvaluate {
fileMode 0644
dirMode 0755

requires('opensearch', versions.opensearch, EQUAL)
requires('elasticsearch-oss', versions.elasticsearch, EQUAL)
petardz marked this conversation as resolved.
Show resolved Hide resolved
packager = 'Amazon'
vendor = 'Amazon'
os = 'LINUX'
prefix '/usr'

license 'ASL-2.0'
maintainer 'OpenSearch Team <opensearch@amazon.com>'
maintainer 'OpenDistro for Elasticsearch Team <opendistro@amazon.com>'
petardz marked this conversation as resolved.
Show resolved Hide resolved
url 'https://opensearch.org/downloads.html'
summary '''
Security Analytics plugin for OpenSearch.
Open Distro for Elasticsearch Index Management.
Reference documentation can be found at https://docs-beta.opensearch.org/.
'''.stripIndent().replace('\n', ' ').trim()
}
Expand All @@ -350,23 +350,18 @@ afterEvaluate {
finalizedBy 'renameRpm'
task renameRpm(type: Copy) {
from("$buildDir/distributions")
into("$buildDir/distributions")
include archiveName
rename archiveName, "${packageName}-${version}.rpm"
doLast { delete file("$buildDir/distributions/$archiveName") }
rename "$archiveFileName", "${packageName}-${archiveVersion}.rpm"
doLast { delete file("$buildDir/distributions/$archiveFileName") }
}
}

buildDeb {
arch = 'all'
dependsOn 'assemble'
finalizedBy 'renameDeb'
task renameDeb(type: Copy) {
from("$buildDir/distributions")
into("$buildDir/distributions")
include archiveName
rename archiveName, "${packageName}-${version}.deb"
doLast { delete file("$buildDir/distributions/$archiveName") }
rename "$archiveFileName", "${packageName}-${archiveVersion}.deb"
doLast { delete file("$buildDir/distributions/$archiveFileName") }
}
}
}
}
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,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
25 changes: 18 additions & 7 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,10 @@ 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='"-Xmx64m" "-Xms64m"'
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -143,12 +140,16 @@ fi
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=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=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -193,6 +194,10 @@ if "$cygwin" || "$msys" ; then
done
fi


# 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, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
Expand All @@ -205,6 +210,12 @@ set -- \
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
15 changes: 9 additions & 6 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,7 +25,8 @@
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%

Expand All @@ -40,7 +41,7 @@ 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
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.apache.logging.log4j.Logger;
import org.opensearch.action.ActionRequest;
import org.opensearch.action.ActionRequestValidationException;
import org.opensearch.common.Strings;
import org.opensearch.core.common.Strings;
import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.common.io.stream.StreamOutput;
import org.opensearch.common.xcontent.XContentFactory;
Expand Down Expand Up @@ -135,7 +135,7 @@ public static CreateIndexMappingsRequest parse(XContentParser xcp) throws IOExce
aliasMap.put(alias, Map.of("type", "alias", "path", path));
}
}
aliasMappings = Strings.toString(XContentFactory.jsonBuilder().map(Map.of("properties", aliasMap)));
aliasMappings = org.opensearch.common.Strings.toString(XContentFactory.jsonBuilder().map(Map.of("properties", aliasMap)));
break;
case PARTIAL_FIELD:
partial = xcp.booleanValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import org.opensearch.Version;
import org.opensearch.action.ActionResponse;
import org.opensearch.cluster.metadata.MappingMetadata;
import org.opensearch.common.Strings;
import org.opensearch.core.common.Strings;
import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.common.io.stream.StreamOutput;
import org.opensearch.common.xcontent.XContentType;
Expand Down Expand Up @@ -102,7 +102,7 @@ public Map<String, MappingMetadata> getMappings() {

@Override
public String toString() {
return Strings.toString(XContentType.JSON, this);
return org.opensearch.common.Strings.toString(XContentType.JSON, this);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import java.util.Map;
import java.util.Objects;
import org.opensearch.action.ActionResponse;
import org.opensearch.common.Strings;
import org.opensearch.core.common.Strings;
import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.common.io.stream.StreamOutput;
import org.opensearch.common.xcontent.XContentType;
Expand Down Expand Up @@ -125,7 +125,7 @@ public List<String> getUnmappedIndexFields() {

@Override
public String toString() {
return Strings.toString(XContentType.JSON, this);
return org.opensearch.common.Strings.toString(XContentType.JSON, this);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import org.apache.logging.log4j.Logger;
import org.opensearch.action.ActionRequest;
import org.opensearch.action.ActionRequestValidationException;
import org.opensearch.common.Strings;
import org.opensearch.core.common.Strings;
import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.common.io.stream.StreamOutput;
import org.opensearch.common.xcontent.XContentFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import java.util.Map;
import java.util.Objects;
import org.opensearch.action.ActionResponse;
import org.opensearch.common.Strings;
import org.opensearch.core.common.Strings;
import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.common.io.stream.StreamOutput;
import org.opensearch.common.xcontent.XContentType;
Expand Down Expand Up @@ -67,7 +67,7 @@ public List<String> getNonapplicableFields() {

@Override
public String toString() {
return Strings.toString(XContentType.JSON, this);
return org.opensearch.common.Strings.toString(XContentType.JSON, this);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.apache.logging.log4j.Logger;
import org.apache.lucene.search.Query;
import org.opensearch.common.ParsingException;
import org.opensearch.common.Strings;
import org.opensearch.core.common.Strings;
import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.common.io.stream.StreamOutput;
import org.opensearch.core.ParseField;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ private void doCreateMapping(
indicesClient.putMapping(request, new ActionListener<>() {
@Override
public void onResponse(AcknowledgedResponse acknowledgedResponse) {
//((Map<String, Object>)mappingsRoot.get(PROPERTIES)).putAll(presentPathsMappings);
CreateMappingResult result = new CreateMappingResult(
acknowledgedResponse,
indexName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.opensearch.OpenSearchException;
import org.opensearch.common.Strings;
import org.opensearch.core.common.Strings;
import org.opensearch.common.xcontent.XContentFactory;
import org.opensearch.core.xcontent.XContentBuilder;
import org.opensearch.rest.RestStatus;
Expand Down Expand Up @@ -74,7 +74,7 @@ public static OpenSearchException wrap(List<Exception> ex) {
log.error("Security Analytics error:", e);
}
builder.endObject();
String friendlyMsg = Strings.toString(builder);
String friendlyMsg = org.opensearch.common.Strings.toString(builder);

return new SecurityAnalyticsException(friendlyMsg, status, new Exception(String.format(Locale.getDefault(), "%s: %s", ex.getClass().getName(), friendlyMsg)));
} catch (IOException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import org.opensearch.client.WarningsHandler;
import org.opensearch.cluster.ClusterModule;
import org.opensearch.cluster.metadata.MappingMetadata;
import org.opensearch.common.Strings;
import org.opensearch.core.common.Strings;
import org.opensearch.common.UUIDs;

import org.opensearch.common.io.PathUtils;
Expand Down Expand Up @@ -201,7 +201,7 @@ protected String createTestIndex(String index, String mapping, Settings settings

protected String createTestIndex(RestClient client, String index, String mapping, Settings settings) throws IOException {
Request request = new Request("PUT", "/" + index);
String entity = "{\"settings\": " + Strings.toString(XContentType.JSON, settings);
String entity = "{\"settings\": " + org.opensearch.common.Strings.toString(XContentType.JSON, settings);
if (mapping != null) {
entity = entity + ",\"mappings\" : {" + mapping + "}";
}
Expand Down Expand Up @@ -250,7 +250,7 @@ protected Settings getCorrelationDefaultIndexSettings() {

protected String createTestIndexWithMappingJson(RestClient client, String index, String mapping, Settings settings) throws IOException {
Request request = new Request("PUT", "/" + index);
String entity = "{\"settings\": " + Strings.toString(XContentType.JSON, settings);
String entity = "{\"settings\": " + org.opensearch.common.Strings.toString(XContentType.JSON, settings);
if (mapping != null) {
entity = entity + ",\"mappings\" : " + mapping;
}
Expand All @@ -274,7 +274,7 @@ protected void addCorrelationDoc(String index, String docId, List<String> fieldN
}
builder.endObject();

request.setJsonEntity(Strings.toString(builder));
request.setJsonEntity(org.opensearch.common.Strings.toString(builder));
Response response = client().performRequest(request);
assertEquals(request.getEndpoint() + ": failed", RestStatus.CREATED, RestStatus.fromCode(response.getStatusLine().getStatusCode()));
}
Expand All @@ -295,7 +295,7 @@ protected Response searchCorrelationIndex(String index, CorrelationQueryBuilder
request.addParameter("size", Integer.toString(resultSize));
request.addParameter("explain", Boolean.toString(true));
request.addParameter("search_type", "query_then_fetch");
request.setJsonEntity(Strings.toString(builder));
request.setJsonEntity(org.opensearch.common.Strings.toString(builder));

Response response = client().performRequest(request);
Assert.assertEquals("Search failed", RestStatus.OK, restStatus(response));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.apache.lucene.index.VectorSimilarityFunction;
import org.junit.Assert;
import org.opensearch.client.Response;
import org.opensearch.common.Strings;
import org.opensearch.core.common.Strings;
import org.opensearch.core.xcontent.XContentBuilder;
import org.opensearch.common.xcontent.XContentFactory;
import org.opensearch.securityanalytics.SecurityAnalyticsRestTestCase;
Expand Down Expand Up @@ -65,7 +65,7 @@ public void testQuery() throws IOException {
.endObject()
.endObject();

String mapping = Strings.toString(builder);
String mapping = org.opensearch.common.Strings.toString(builder);
createTestIndexWithMappingJson(client(), INDEX_NAME, mapping, getCorrelationDefaultIndexSettings());

for (int idx = 0; idx < TEST_VECTORS.length; ++idx) {
Expand Down
Loading