mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-13 15:52:01 +07:00
IJPL-172117 JCEF: disable JCEF if glibc < 2.28
GitOrigin-RevId: 10d547d74132c4567ce1a2c615289c3f265176de
This commit is contained in:
committed by
intellij-monorepo-bot
parent
149ca9aa4c
commit
7841791008
@@ -24,5 +24,6 @@
|
||||
<orderEntry type="module" module-name="intellij.platform.core.impl" />
|
||||
<orderEntry type="library" name="jbr-api" level="project" />
|
||||
<orderEntry type="module" module-name="intellij.platform.jbr" />
|
||||
<orderEntry type="library" name="jna" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -12,6 +12,7 @@ import com.intellij.openapi.progress.Cancellation;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.SystemInfoRt;
|
||||
import com.intellij.openapi.util.Version;
|
||||
import com.intellij.openapi.util.registry.RegistryManager;
|
||||
import com.intellij.ui.JreHiDpiUtil;
|
||||
import com.intellij.ui.scale.DerivedScaleType;
|
||||
@@ -285,6 +286,11 @@ public final class JBCefApp {
|
||||
if (delegate != null) {
|
||||
return delegate.isCefSupported();
|
||||
}
|
||||
|
||||
if (SystemInfo.isLinux && !isLinuxLibcSupported()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Function<String, Boolean> unsupported = (msg) -> {
|
||||
LOG.warn(msg + (!msg.contains("disabled") ? " (Use JBR bundled with the IDE)" : ""));
|
||||
return false;
|
||||
@@ -585,4 +591,27 @@ public final class JBCefApp {
|
||||
private static @Nullable CefDelegate getActiveDelegate() {
|
||||
return CefDelegate.EP.findFirstSafe(CefDelegate::isActive);
|
||||
}
|
||||
|
||||
private static boolean isLinuxLibcSupported() {
|
||||
String libcVersionString;
|
||||
try {
|
||||
libcVersionString = LibC.INSTANCE.gnu_get_libc_version();
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
LOG.warn("Failed load libc to check the version: " + e.getMessage());
|
||||
return false;
|
||||
}
|
||||
|
||||
Version version = Version.parseVersion(libcVersionString);
|
||||
if (version == null) {
|
||||
LOG.error("Failed to parse libc version: " + libcVersionString);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (version.lessThan(2, 28)) {
|
||||
LOG.warn("Incompatible glibc version: " + libcVersionString);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
11
platform/ui.jcef/jcef/LibC.java
Normal file
11
platform/ui.jcef/jcef/LibC.java
Normal file
@@ -0,0 +1,11 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.ui.jcef;
|
||||
|
||||
import com.sun.jna.Library;
|
||||
import com.sun.jna.Native;
|
||||
|
||||
interface LibC extends Library {
|
||||
LibC INSTANCE = Native.load("c", LibC.class);
|
||||
|
||||
String gnu_get_libc_version();
|
||||
}
|
||||
Reference in New Issue
Block a user