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

[Backport 8.5] Update build to Gradle 7.5.1 #445

Merged
merged 2 commits into from Nov 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ci/Dockerfile
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -21,3 +21,6 @@ gradle-app.setting

# HTML files produced by the docs build
html_docs

# Local Makefile
Makefile
4 changes: 2 additions & 2 deletions buildSrc/build.gradle.kts
Expand Up @@ -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()
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
21 changes: 1 addition & 20 deletions 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
21 changes: 1 addition & 20 deletions 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.
#
Expand Down Expand Up @@ -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
Expand Down
21 changes: 3 additions & 18 deletions gradlew.bat
Expand Up @@ -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.
Expand All @@ -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%
Expand All @@ -64,29 +64,14 @@ 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

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
Expand Down
38 changes: 25 additions & 13 deletions java-client/build.gradle.kts
Expand Up @@ -19,15 +19,16 @@

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 {
java
`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 {
Expand Down Expand Up @@ -88,6 +89,7 @@ tasks.withType<Javadoc> {
// 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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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")
}
}
Expand Down
12 changes: 11 additions & 1 deletion settings.gradle.kts
Expand Up @@ -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<File>()).
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
}