LUCENE-10066: Build does not work with JDK16 as gradle's runtime (#259)

This commit is contained in:
Dawid Weiss 2021-08-26 10:08:37 +02:00 committed by GitHub
parent 2d7590a355
commit 39a2fc62d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 48 additions and 33 deletions

View File

@ -35,33 +35,48 @@ configure(rootProject) {
def testsJvms = (int) Math.max(1d, Math.min(cpus * 0.5d, 12))
// Write the defaults for this machine.
rootProject.file("gradle.properties").write(
[
"# These settings have been generated automatically on the first run.",
"# See gradlew :helpLocalSettings for more information.",
"systemProp.file.encoding=UTF-8",
"org.gradle.jvmargs=-Xmx3g", // TODO figure out why "gradlew check" runs out of memory if 2g
"org.gradle.parallel=true",
"org.gradle.priority=normal",
"org.gradle.warning.mode=none", // Silence gradle warnings. We'll deal with them when we upgrade the wrapper.
"",
"# You may disable the background daemon if it consumes too much memory.",
"org.gradle.daemon=true",
"org.gradle.daemon.idletimeout=900000", // timeout after 15 mins.
"",
"# Maximum number of parallel gradle workers.",
"org.gradle.workers.max=${maxWorkers}",
"",
"# Maximum number of test JVMs forked per test task.",
"tests.jvms=${testsJvms}",
"",
"# Disable auto JVM provisioning",
"org.gradle.java.installations.auto-download=false",
"",
"# Set these to enable automatic JVM location discovery.",
"# org.gradle.java.installations.fromEnv=JDK11,JDK12,JDK13,JDK14,JDK15,JDK16,JDK17",
"# org.gradle.java.installations.paths=(custom paths)",
].join("\n"), "UTF-8")
rootProject.file("gradle.properties").write("""
# These settings have been generated automatically on the first run.
# See gradlew :helpLocalSettings for more information.
systemProp.file.encoding=UTF-8
# Set up gradle JVM defaults.
# The heap seems huge but gradle runs out of memory on lower values (don't know why).
#
# We also open up internal compiler modules for spotless/ google jaa format.
org.gradle.jvmargs=-Xmx3g \\
--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \\
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \\
--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \\
--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \\
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
# Run at normal priority, in parallel
org.gradle.parallel=true
org.gradle.priority=normal
# Silence gradle warnings. We'll deal with them when we upgrade the wrapper.
org.gradle.warning.mode=none
# You may disable the background daemon if it consumes too much memory.
org.gradle.daemon=true
# timeout after 15 mins of inactivity.
org.gradle.daemon.idletimeout=900000
# Maximum number of parallel gradle workers.
org.gradle.workers.max=${maxWorkers}
# Maximum number of test JVMs forked per test task.
tests.jvms=${testsJvms}
# Disable auto JVM provisioning (we don't use toolchains yet but want no surprises).
org.gradle.java.installations.auto-download=false
# Set these to enable automatic JVM location discovery.
org.gradle.java.installations.fromEnv=JDK11,JDK12,JDK13,JDK14,JDK15,JDK16,JDK17
org.gradle.java.installations.paths=(custom paths)
""", "UTF-8")
logger.log(LogLevel.WARN, "\nIMPORTANT. This is the first time you ran the build. " +
"I wrote some sane defaults (for this machine) to 'gradle.properties', " +

View File

@ -37,7 +37,7 @@ configure(project(":lucene").subprojects) { prj ->
lineEndings 'UNIX'
endWithNewline()
googleJavaFormat('1.9')
googleJavaFormat('1.11.0')
// Apply to all Java sources
target "src/**/*.java"

View File

@ -24,8 +24,6 @@ import org.apache.lucene.index.SegmentInfo;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.IOContext;
;
/** RW impersonation of Lucene87StoredFieldsFormat. */
public class Lucene87RWStoredFieldsFormat extends Lucene87StoredFieldsFormat {

View File

@ -30,7 +30,8 @@ import org.apache.lucene.util.SuppressForbidden;
@SuppressForbidden(reason = "Uses a Long instance as a marker")
public final class PositiveIntOutputs extends Outputs<Long> {
@SuppressWarnings("deprecation")
// Ignore the deprecated constructor. We do want a unique object here.
@SuppressWarnings({"all"})
private static final Long NO_OUTPUT = new Long(0);
private static final PositiveIntOutputs singleton = new PositiveIntOutputs();

View File

@ -57,7 +57,7 @@ public class TestCharArraySet extends LuceneTestCase {
public void testObjectContains() {
CharArraySet set = new CharArraySet(10, true);
Integer val = Integer.valueOf(1);
@SuppressWarnings("deprecation")
@SuppressWarnings("all")
Integer val1 = new Integer(1);
// Verify explicitly the case of different Integer instances
assertNotSame(val, val1);

View File

@ -76,7 +76,8 @@ public final class UpToTwoPositiveIntOutputs extends Outputs<Object> {
}
}
@SuppressWarnings("deprecation")
// Ignore the deprecated constructor. We do want a unique object here.
@SuppressWarnings({"all"})
private static final Long NO_OUTPUT = new Long(0);
private final boolean doShare;