diff --git a/.ci/Dockerfile b/.ci/Dockerfile index 4c1d4e858..aabf446f7 100644 --- a/.ci/Dockerfile +++ b/.ci/Dockerfile @@ -20,7 +20,7 @@ # Build a Docker image that has Gradle and all project dependencies ready. # Needs to be run with .git and java-client/src mounted under /elasticsearch-java. -FROM openjdk:15 +FROM openjdk:17 # Default UID/GID to 1000 # it can be overridden at build time diff --git a/.gitignore b/.gitignore index bbdb39a36..357194249 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,6 @@ gradle-app.setting # HTML files produced by the docs build html_docs + +# Local Makefile +Makefile diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 521094f9f..07aa19b8b 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -18,9 +18,9 @@ */ dependencies { - implementation("org.ajoberstar.grgit:grgit-gradle:4.0.1") + implementation("org.ajoberstar.grgit:grgit-gradle:5.0.0") } repositories { - maven("https://plugins.gradle.org/m2/") + mavenCentral() } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 62d4c0535..e708b1c02 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 1ed23ca6b..ae04661ee 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,24 +1,5 @@ -# -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index a4d2e2351..4f906e0c8 100755 --- a/gradlew +++ b/gradlew @@ -1,24 +1,5 @@ #!/usr/bin/env sh -# -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - # # Copyright 2015 the original author or authors. # @@ -149,7 +130,7 @@ fi if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - + JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath diff --git a/gradlew.bat b/gradlew.bat index a9f778a7a..ac1b06f93 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if "%ERRORLEVEL%" == "0" goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -54,7 +54,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -64,21 +64,6 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line @@ -86,7 +71,7 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell diff --git a/java-client/build.gradle.kts b/java-client/build.gradle.kts index d9e208c0f..1686d58eb 100644 --- a/java-client/build.gradle.kts +++ b/java-client/build.gradle.kts @@ -19,6 +19,7 @@ import com.github.jk1.license.ProjectData import com.github.jk1.license.render.ReportRenderer +import com.github.jk1.license.render.LicenseDataCollector import java.io.FileWriter plugins { @@ -26,8 +27,8 @@ plugins { `java-library` checkstyle `maven-publish` - id("com.github.jk1.dependency-license-report") version "1.19" - id("de.thetaphi.forbiddenapis") version "3.3" + id("com.github.jk1.dependency-license-report") version "2.1" + id("de.thetaphi.forbiddenapis") version "3.4" } java { @@ -88,6 +89,7 @@ tasks.withType { // Gradle calls javadoc with a list of file and not a path. This prevents doc-files from being copied. opt.addStringOption("sourcepath", project.projectDir.path + "/src/main/java") opt.docFilesSubDirs(true) + opt.addBooleanOption("Xdoclint:-missing", true) doLast { // Javadoc adds its decoration to html doc files, including quite some JS. This slows down the api spec @@ -175,7 +177,7 @@ publishing { dependencies { // Compile and test with the last 7.x version to make sure transition scenarios where // the Java API client coexists with a 7.x HLRC work fine - val elasticsearchVersion = "7.17.4" + val elasticsearchVersion = "7.17.7" val jacksonVersion = "2.13.3" // Apache 2.0 @@ -261,21 +263,31 @@ class SpdxReporter(val dest: File) : ReportRenderer { FileWriter(dest).use { out -> out.append("name,url,version,revision,license\n") data?.allDependencies?.forEach { dep -> - val info = com.github.jk1.license.render.LicenseDataCollector.multiModuleLicenseInfo(dep) val depVersion = dep.version val depName = dep.group + ":" + dep.name - val depUrl = info.moduleUrls.first() - val licenseIds = info.licenses.mapNotNull { license -> - license.name?.let { - checkNotNull(spdxIds[it]) { "No SPDX identifier for $license" } - } - }.toSet() + //-------------- + // FIXME: restore section below once 2.2 is released + // See https://github.com/jk1/Gradle-License-Report/issues/251 + val (depUrl, licenseId, licenseUrl) = LicenseDataCollector.singleModuleLicenseInfo(dep) + checkNotNull(spdxIds[licenseId]) { "No SPDX identifier for $licenseId" } + + //-------------- + // val info = LicenseDataCollector.multiModuleLicenseInfo(dep) + // val depUrl = info.moduleUrls.first() + // + // val licenseIds = info.licenses.mapNotNull { license -> + // license.name?.let { + // checkNotNull(spdxIds[it]) { "No SPDX identifier for $license" } + // } + // }.toSet() + // + // // Combine multiple licenses. + // // See https://spdx.github.io/spdx-spec/appendix-IV-SPDX-license-expressions/#composite-license-expressions + // val licenseId = licenseIds.joinToString(" OR ") + //-------------- - // Combine multiple licenses. - // See https://spdx.github.io/spdx-spec/appendix-IV-SPDX-license-expressions/#composite-license-expressions - val licenseId = licenseIds.joinToString(" OR ") out.append("${quote(depName)},${quote(depUrl)},${quote(depVersion)},,${quote(licenseId)}\n") } } diff --git a/settings.gradle.kts b/settings.gradle.kts index 932f6edf2..11b843f2d 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -18,4 +18,14 @@ */ rootProject.name = "elasticsearch-java" -include("java-client") + +// Include as subprojects all subdirectories that have a "build.gradle.kts" and no ".gradle-standalone" +(rootProject.projectDir.listFiles() ?: arrayOf()). + filter { File(it, "build.gradle.kts").exists() }. + filter { !File(it, ".gradle-standalone").exists() }. + filter { it.name != "buildSrc" }. + toTypedArray(). + forEach { dir -> + include(dir.name) + project(":" + dir.name).projectDir = dir + }