Skip to content

Commit

Permalink
Update to Gradle 8.8
Browse files Browse the repository at this point in the history
Signed-off-by: Andriy Redko <[email protected]>
  • Loading branch information
reta committed May 27, 2024
1 parent 1c0a274 commit 55b7ba0
Show file tree
Hide file tree
Showing 22 changed files with 382 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,28 @@ private JavaVersion determineJavaVersion(String description, File javaHome, Java
}

private JvmInstallationMetadata getJavaInstallation(File javaHome) {
final InstallationLocation location = new InstallationLocation(javaHome, "Java home");
InstallationLocation location = null;

try {
try {
// The InstallationLocation(File, String) is used by Gradle pre-8.8
location = (InstallationLocation) MethodHandles.publicLookup()
.findConstructor(InstallationLocation.class, MethodType.methodType(void.class, File.class, String.class))
.invokeExact(javaHome, "Java home");
} catch (Throwable ex) {
// The InstallationLocation::userDefined is used by Gradle post-8.7
location = (InstallationLocation) MethodHandles.publicLookup()
.findStatic(
InstallationLocation.class,
"userDefined",
MethodType.methodType(InstallationLocation.class, File.class, String.class)
)
.invokeExact(javaHome, "Java home");

}
} catch (Throwable ex) {
throw new IllegalStateException("Unable to find suitable InstallationLocation constructor / factory method", ex);
}

try {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ private void configureGeneralTaskDefaults(Project project) {
project.getTasks().withType(AbstractCopyTask.class).configureEach(t -> {
t.dependsOn(project.getTasks().withType(EmptyDirTask.class));
t.setIncludeEmptyDirs(true);
t.setDirMode(0755);
t.setFileMode(0644);
t.dirPermissions(perms -> perms.unix(0755));
t.filePermissions(perms -> perms.unix(0644));
});

// common config across all archives
Expand Down
20 changes: 15 additions & 5 deletions distribution/archives/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,17 @@ CopySpec archiveFiles(CopySpec modulesFiles, String distributionType, String pla
with libFiles()
}
into('config') {
dirMode 0750
fileMode 0660
dirPermissions {
unix 0750
}
filePermissions {
unix 0660
}
with configFiles(distributionType, java)
from {
dirMode 0750
dirPermissions {
unix 0750
}
jvmOptionsDir.getParent()
}
}
Expand All @@ -61,13 +67,17 @@ CopySpec archiveFiles(CopySpec modulesFiles, String distributionType, String pla
}
into('') {
from {
dirMode 0755
dirPermissions {
unix 0755
}
logsDir.getParent()
}
}
into('') {
from {
dirMode 0755
dirPermissions {
unix 0755
}
pluginsDir.getParent()
}
}
Expand Down
56 changes: 42 additions & 14 deletions distribution/packages/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,9 @@ Closure commonPackageConfig(String type, boolean jdk, String architecture) {
}
from(rootProject.projectDir) {
include 'README.md'
fileMode 0644
filePermissions {
unix 0644
}
}
into('lib') {
with libFiles()
Expand Down Expand Up @@ -195,7 +197,9 @@ Closure commonPackageConfig(String type, boolean jdk, String architecture) {
if (type == 'deb') {
into("/usr/share/doc/${packageName}") {
from "${packagingFiles}/copyright"
fileMode 0644
filePermissions {
unix 0644
}
}
} else {
assert type == 'rpm'
Expand All @@ -204,7 +208,9 @@ Closure commonPackageConfig(String type, boolean jdk, String architecture) {
include 'APACHE-LICENSE-2.0.txt'
rename { 'LICENSE.txt' }
}
fileMode 0644
filePermissions {
unix 0644
}
}
}

Expand All @@ -213,7 +219,9 @@ Closure commonPackageConfig(String type, boolean jdk, String architecture) {
configurationFile '/etc/opensearch/jvm.options'
configurationFile '/etc/opensearch/log4j2.properties'
from("${packagingFiles}") {
dirMode 0750
dirPermissions {
unix 0750
}
into('/etc')
permissionGroup 'opensearch'
includeEmptyDirs true
Expand All @@ -223,8 +231,12 @@ Closure commonPackageConfig(String type, boolean jdk, String architecture) {
}
from("${packagingFiles}/etc/opensearch") {
into('/etc/opensearch')
dirMode 0750
fileMode 0660
dirPermissions {
unix 0750
}
filePermissions{
unix 0660
}
permissionGroup 'opensearch'
includeEmptyDirs true
createDirectoryEntry true
Expand All @@ -235,34 +247,46 @@ Closure commonPackageConfig(String type, boolean jdk, String architecture) {
into(new File(envFile).getParent()) {
fileType CONFIG | NOREPLACE
permissionGroup 'opensearch'
fileMode 0660
filePermissions {
unix 0660
}
from "${packagingFiles}/env/opensearch"
}

// ========= systemd =========
into('/usr/lib/tmpfiles.d') {
from "${packagingFiles}/systemd/opensearch.conf"
fileMode 0644
filePermissions {
unix 0644
}
}
into('/usr/lib/systemd/system') {
fileType CONFIG | NOREPLACE
from "${packagingFiles}/systemd/opensearch.service"
fileMode 0644
filePermissions {
unix 0644
}
}
into('/usr/lib/sysctl.d') {
fileType CONFIG | NOREPLACE
from "${packagingFiles}/systemd/sysctl/opensearch.conf"
fileMode 0644
filePermissions {
unix 0644
}
}
into('/usr/share/opensearch/bin') {
from "${packagingFiles}/systemd/systemd-entrypoint"
fileMode 0755
filePermissions {
unix 0755
}
}

// ========= sysV init =========
configurationFile '/etc/init.d/opensearch'
into('/etc/init.d') {
fileMode 0750
filePermissions {
unix 0750
}
fileType CONFIG | NOREPLACE
from "${packagingFiles}/init.d/opensearch"
}
Expand All @@ -278,7 +302,9 @@ Closure commonPackageConfig(String type, boolean jdk, String architecture) {
createDirectoryEntry true
user u
permissionGroup g
dirMode mode
dirPermissions {
unix mode
}
}
}
copyEmptyDir('/var/log/opensearch', 'opensearch', 'opensearch', 0750)
Expand Down Expand Up @@ -341,7 +367,9 @@ Closure commonDebConfig(boolean jdk, String architecture) {

into('/usr/share/lintian/overrides') {
from('src/deb/lintian/opensearch')
fileMode 0644
filePermissions {
unix 0644
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-rc-2-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionSha256Sum=194717442575a6f96e1c1befa2c30e9a4fc90f701d7aee33eb879b79e7ff05c0
distributionSha256Sum=8cc380c27207423e8d0b2feeedca5f52c269aa52f797f5b5ea7cb5d101713329
16 changes: 10 additions & 6 deletions server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -356,14 +356,18 @@ tasks.named("thirdPartyAudit").configure {
}

tasks.named("dependencyLicenses").configure {
mapping from: /jackson-.*/, to: 'jackson'
mapping from: /reactor-.*/, to: 'reactor'
mapping from: /lucene-.*/, to: 'lucene'
dependencies = project.configurations.runtimeClasspath.fileCollection {
it.group.startsWith('org.opensearch') == false ||
// keep the following org.opensearch jars in
(it.name == 'jna' ||
it.name == 'securesm')
}
dependencies = project.configurations.runtimeClasspath.incoming.artifactView {
componentFilter {
it instanceof ModuleComponentIdentifier &&
(it.group.startsWith('org.opensearch') == false ||
// keep the following org.opensearch jars in
(it.name == 'jna' ||
it.name == 'securesm'))
}
}.files
}

tasks.named("filepermissions").configure {
Expand Down
8 changes: 8 additions & 0 deletions server/licenses/jackson-LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
This copy of Jackson JSON processor streaming parser/generator is licensed under the
Apache (Software) License, version 2.0 ("the License").
See the License for details about distribution rights, and the
specific rights regarding derivate works.

You may obtain a copy of the License at:

http://www.apache.org/licenses/LICENSE-2.0
20 changes: 20 additions & 0 deletions server/licenses/jackson-NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Jackson JSON processor

Jackson is a high-performance, Free/Open Source JSON processing library.
It was originally written by Tatu Saloranta ([email protected]), and has
been in development since 2007.
It is currently developed by a community of developers, as well as supported
commercially by FasterXML.com.

## Licensing

Jackson core and extension components may licensed under different licenses.
To find the details that apply to this artifact see the accompanying LICENSE file.
For more information, including possible other licensing options, contact
FasterXML.com (http://fasterxml.com).

## Credits

A list of contributors may be found from CREDITS file, which is included
in some artifacts (usually source distributions); but is always available
from the source code management (SCM) system project uses.
1 change: 1 addition & 0 deletions server/licenses/jackson-core-2.17.1.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5e52a11644cd59a28ef79f02bddc2cc3bab45edb
1 change: 1 addition & 0 deletions server/licenses/jackson-dataformat-cbor-2.17.1.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ba5d8e6ecc62aa0e49c0ce935b8696352dbebc71
1 change: 1 addition & 0 deletions server/licenses/jackson-dataformat-smile-2.17.1.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
89683ac4f0a0c2c4f69ea56b90480ed40266dac8
1 change: 1 addition & 0 deletions server/licenses/jackson-dataformat-yaml-2.17.1.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
b4c7b8a9ea3f398116a75c146b982b22afebc4ee
1 change: 1 addition & 0 deletions server/licenses/jopt-simple-5.0.4.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4fdac2fbe92dfad86aa6e9301736f6b4342a3f5c
24 changes: 24 additions & 0 deletions server/licenses/jopt-simple-LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
The MIT License

Copyright (c) 2004-2015 Paul R. Holser, Jr.

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
Empty file.
1 change: 1 addition & 0 deletions server/licenses/snakeyaml-2.1.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
c79f47315517560b5bd6a62376ee385e48105437
Loading

0 comments on commit 55b7ba0

Please sign in to comment.