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

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

Merged
merged 2 commits into from
Aug 26, 2021
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 42 additions & 27 deletions gradle/generation/local-settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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', " +
Expand Down
2 changes: 1 addition & 1 deletion gradle/validation/spotless.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.IOContext;

;

/** RW impersonation of Lucene87StoredFieldsFormat. */
public class Lucene87RWStoredFieldsFormat extends Lucene87StoredFieldsFormat {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
@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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void testNonZeroOffset() {
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ public int hashCode() {
}
}

@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;
Expand Down