Support and switch to Java 17 everywhere except CentOS 7 (#6190)

This commit is contained in:
Jakub Kuczys
2023-06-20 11:29:50 +02:00
committed by GitHub
parent be5751a7ea
commit 8acc1c3e02
21 changed files with 67 additions and 39 deletions

View File

@@ -51,7 +51,7 @@ class LavalinkSetupCommands(MixinMeta, metaclass=CompositeMetaClass):
This command shouldn't need to be used most of the time, and is only useful if the host machine has conflicting Java versions.
If changing this make sure that the Java executable you set is supported by Audio.
The current supported version is Java 11.
The current supported versions are Java 17 and 11.
Enter nothing or "java" to reset it back to default.
"""

View File

@@ -83,7 +83,7 @@ DANGEROUS_COMMANDS = {
"This command will change the executable path of Java, "
"this is useful if you have multiple installations of Java and the default one is causing issues. "
"Please don't change this unless you are certain that the Java version you are specifying is supported by Red. "
"The default and supported version is currently Java 11."
"The default and supported versions are currently Java 17 and 11."
),
"command_llset_heapsize": _(
"This command will change the maximum RAM allocation for the managed Lavalink node, "

View File

@@ -365,20 +365,19 @@ class ServerManager:
raise UnsupportedJavaException(
await replace_p_with_prefix(
self.cog.bot,
f"The managed Lavalink node requires Java 11 to run{extras};\n"
"Either install version 11 and restart the bot or connect to an external Lavalink node "
f"The managed Lavalink node requires Java 17 or 11 to run{extras};\n"
"Either install version 17 (or 11) and restart the bot or connect to an external Lavalink node "
"(https://docs.discord.red/en/stable/install_guides/index.html)\n"
"If you already have Java 11 installed then then you will need to specify the executable path, "
"use '[p]llset java' to set the correct Java 11 executable.",
"If you already have Java 17 or 11 installed then then you will need to specify the executable path, "
"use '[p]llset java' to set the correct Java 17 or 11 executable.",
) # TODO: Replace with Audio docs when they are out
)
java_xms, java_xmx = list((await self._config.java.all()).values())
match = re.match(r"^(\d+)([MG])$", java_xmx, flags=re.IGNORECASE)
command_args = [
self._java_exc,
"-Djdk.tls.client.protocols=TLSv1.2",
f"-Xms{java_xms}",
]
command_args = [self._java_exc]
if self._java_version[0] < 12:
command_args.append("-Djdk.tls.client.protocols=TLSv1.2")
command_args.append(f"-Xms{java_xms}")
meta = 0, None
invalid = None
if match and (
@@ -408,7 +407,7 @@ class ServerManager:
self._java_version = None
else:
self._java_version = await self._get_java_version()
self._java_available = (11, 0) <= self._java_version < (12, 0)
self._java_available = self._java_version[0] in (11, 17)
self._java_exc = java_exec
return self._java_available, self._java_version