Skip to content

Commit 40fb890

Browse files
[Backport 8.5] Update build to Gradle 7.5.1 (#445)
1 parent 9c36e21 commit 40fb890

File tree

9 files changed

+47
-75
lines changed

9 files changed

+47
-75
lines changed

.ci/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# Build a Docker image that has Gradle and all project dependencies ready.
2121
# Needs to be run with .git and java-client/src mounted under /elasticsearch-java.
2222

23-
FROM openjdk:15
23+
FROM openjdk:17
2424

2525
# Default UID/GID to 1000
2626
# it can be overridden at build time

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,6 @@ gradle-app.setting
2121

2222
# HTML files produced by the docs build
2323
html_docs
24+
25+
# Local Makefile
26+
Makefile

buildSrc/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
*/
1919

2020
dependencies {
21-
implementation("org.ajoberstar.grgit:grgit-gradle:4.0.1")
21+
implementation("org.ajoberstar.grgit:grgit-gradle:5.0.0")
2222
}
2323

2424
repositories {
25-
maven("https://plugins.gradle.org/m2/")
25+
mavenCentral()
2626
}

gradle/wrapper/gradle-wrapper.jar

293 Bytes
Binary file not shown.
Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,5 @@
1-
#
2-
# Licensed to Elasticsearch B.V. under one or more contributor
3-
# license agreements. See the NOTICE file distributed with
4-
# this work for additional information regarding copyright
5-
# ownership. Elasticsearch B.V. licenses this file to you under
6-
# the Apache License, Version 2.0 (the "License"); you may
7-
# not use this file except in compliance with the License.
8-
# You may obtain a copy of the License at
9-
#
10-
# http://www.apache.org/licenses/LICENSE-2.0
11-
#
12-
# Unless required by applicable law or agreed to in writing,
13-
# software distributed under the License is distributed on an
14-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15-
# KIND, either express or implied. See the License for the
16-
# specific language governing permissions and limitations
17-
# under the License.
18-
#
19-
201
distributionBase=GRADLE_USER_HOME
212
distributionPath=wrapper/dists
22-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
234
zipStoreBase=GRADLE_USER_HOME
245
zipStorePath=wrapper/dists

gradlew

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,5 @@
11
#!/usr/bin/env sh
22

3-
#
4-
# Licensed to Elasticsearch B.V. under one or more contributor
5-
# license agreements. See the NOTICE file distributed with
6-
# this work for additional information regarding copyright
7-
# ownership. Elasticsearch B.V. licenses this file to you under
8-
# the Apache License, Version 2.0 (the "License"); you may
9-
# not use this file except in compliance with the License.
10-
# You may obtain a copy of the License at
11-
#
12-
# http://www.apache.org/licenses/LICENSE-2.0
13-
#
14-
# Unless required by applicable law or agreed to in writing,
15-
# software distributed under the License is distributed on an
16-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17-
# KIND, either express or implied. See the License for the
18-
# specific language governing permissions and limitations
19-
# under the License.
20-
#
21-
223
#
234
# Copyright 2015 the original author or authors.
245
#
@@ -149,7 +130,7 @@ fi
149130
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
150131
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
151132
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
152-
133+
153134
JAVACMD=`cygpath --unix "$JAVACMD"`
154135

155136
# We build the pattern for arguments to be converted via cygpath

gradlew.bat

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
4040

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

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

57-
if exist "%JAVA_EXE%" goto init
57+
if exist "%JAVA_EXE%" goto execute
5858

5959
echo.
6060
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@@ -64,29 +64,14 @@ echo location of your Java installation.
6464

6565
goto fail
6666

67-
:init
68-
@rem Get command-line arguments, handling Windows variants
69-
70-
if not "%OS%" == "Windows_NT" goto win9xME_args
71-
72-
:win9xME_args
73-
@rem Slurp the command line arguments.
74-
set CMD_LINE_ARGS=
75-
set _SKIP=2
76-
77-
:win9xME_args_slurp
78-
if "x%~1" == "x" goto execute
79-
80-
set CMD_LINE_ARGS=%*
81-
8267
:execute
8368
@rem Setup the command line
8469

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

8772

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

9176
:end
9277
@rem End local scope for the variables with windows NT shell

java-client/build.gradle.kts

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,16 @@
1919

2020
import com.github.jk1.license.ProjectData
2121
import com.github.jk1.license.render.ReportRenderer
22+
import com.github.jk1.license.render.LicenseDataCollector
2223
import java.io.FileWriter
2324

2425
plugins {
2526
java
2627
`java-library`
2728
checkstyle
2829
`maven-publish`
29-
id("com.github.jk1.dependency-license-report") version "1.19"
30-
id("de.thetaphi.forbiddenapis") version "3.3"
30+
id("com.github.jk1.dependency-license-report") version "2.1"
31+
id("de.thetaphi.forbiddenapis") version "3.4"
3132
}
3233

3334
java {
@@ -88,6 +89,7 @@ tasks.withType<Javadoc> {
8889
// Gradle calls javadoc with a list of file and not a path. This prevents doc-files from being copied.
8990
opt.addStringOption("sourcepath", project.projectDir.path + "/src/main/java")
9091
opt.docFilesSubDirs(true)
92+
opt.addBooleanOption("Xdoclint:-missing", true)
9193

9294
doLast {
9395
// Javadoc adds its decoration to html doc files, including quite some JS. This slows down the api spec
@@ -175,7 +177,7 @@ publishing {
175177
dependencies {
176178
// Compile and test with the last 7.x version to make sure transition scenarios where
177179
// the Java API client coexists with a 7.x HLRC work fine
178-
val elasticsearchVersion = "7.17.4"
180+
val elasticsearchVersion = "7.17.7"
179181
val jacksonVersion = "2.13.3"
180182

181183
// Apache 2.0
@@ -261,21 +263,31 @@ class SpdxReporter(val dest: File) : ReportRenderer {
261263
FileWriter(dest).use { out ->
262264
out.append("name,url,version,revision,license\n")
263265
data?.allDependencies?.forEach { dep ->
264-
val info = com.github.jk1.license.render.LicenseDataCollector.multiModuleLicenseInfo(dep)
265266

266267
val depVersion = dep.version
267268
val depName = dep.group + ":" + dep.name
268-
val depUrl = info.moduleUrls.first()
269269

270-
val licenseIds = info.licenses.mapNotNull { license ->
271-
license.name?.let {
272-
checkNotNull(spdxIds[it]) { "No SPDX identifier for $license" }
273-
}
274-
}.toSet()
270+
//--------------
271+
// FIXME: restore section below once 2.2 is released
272+
// See https://github.com/jk1/Gradle-License-Report/issues/251
273+
val (depUrl, licenseId, licenseUrl) = LicenseDataCollector.singleModuleLicenseInfo(dep)
274+
checkNotNull(spdxIds[licenseId]) { "No SPDX identifier for $licenseId" }
275+
276+
//--------------
277+
// val info = LicenseDataCollector.multiModuleLicenseInfo(dep)
278+
// val depUrl = info.moduleUrls.first()
279+
//
280+
// val licenseIds = info.licenses.mapNotNull { license ->
281+
// license.name?.let {
282+
// checkNotNull(spdxIds[it]) { "No SPDX identifier for $license" }
283+
// }
284+
// }.toSet()
285+
//
286+
// // Combine multiple licenses.
287+
// // See https://spdx.github.io/spdx-spec/appendix-IV-SPDX-license-expressions/#composite-license-expressions
288+
// val licenseId = licenseIds.joinToString(" OR ")
289+
//--------------
275290

276-
// Combine multiple licenses.
277-
// See https://spdx.github.io/spdx-spec/appendix-IV-SPDX-license-expressions/#composite-license-expressions
278-
val licenseId = licenseIds.joinToString(" OR ")
279291
out.append("${quote(depName)},${quote(depUrl)},${quote(depVersion)},,${quote(licenseId)}\n")
280292
}
281293
}

settings.gradle.kts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,14 @@
1818
*/
1919

2020
rootProject.name = "elasticsearch-java"
21-
include("java-client")
21+
22+
// Include as subprojects all subdirectories that have a "build.gradle.kts" and no ".gradle-standalone"
23+
(rootProject.projectDir.listFiles() ?: arrayOf<File>()).
24+
filter { File(it, "build.gradle.kts").exists() }.
25+
filter { !File(it, ".gradle-standalone").exists() }.
26+
filter { it.name != "buildSrc" }.
27+
toTypedArray().
28+
forEach { dir ->
29+
include(dir.name)
30+
project(":" + dir.name).projectDir = dir
31+
}

0 commit comments

Comments
 (0)