[rdct] launcher: GTW-4769 disable JCEF if env var REMOTE_DEV_SERVER_JCEF_ENABLED false

GitOrigin-RevId: 2630cbddd0fe7889fd2ac60acd5fef356a7c50f0
This commit is contained in:
Eugene Lazurin
2023-06-22 17:27:44 +02:00
committed by intellij-monorepo-bot
parent abe667a02a
commit 63a7343e88
2 changed files with 52 additions and 2 deletions

View File

@@ -340,6 +340,36 @@ impl RemoteDevLaunchConfiguration {
}
}
match env::var("REMOTE_DEV_SERVER_JCEF_ENABLED") {
Ok(remote_dev_server_jcef_enabled) => {
match remote_dev_server_jcef_enabled.as_str() {
"1" | "true" => {
// todo: platform depended function which setup jcef
let _ = self.setup_jcef();
remote_dev_properties.push(("ide.browser.jcef.gpu.disable", "true"));
remote_dev_properties.push(("ide.browser.jcef.log.level", "warning"));
remote_dev_properties.push(("idea.suppress.statistics.report", "true"));
}
"0" | "false" => {
if env::var("REMOTE_DEV_SERVER_TRACE").is_ok_and( |remote_dev_server_trace| !remote_dev_server_trace.is_empty() ) {
info!("JCEF support is disabled. Set REMOTE_DEV_SERVER_JCEF_ENABLED=true to enable");
}
// Disable JCEF support for now since it does not work in headless environment now
// Also see IDEA-241709
remote_dev_properties.push(("ide.browser.jcef.enabled", "false"));
}
_ => {
bail!("Unsupported value for 'REMOTE_DEV_SERVER_JCEF_ENABLED' variable: '{remote_dev_server_jcef_enabled:?}'")
}
}
}
Err(_) => {
info!("JCEF support is disabled. Set 'REMOTE_DEV_SERVER_JCEF_ENABLED=true' to enable");
}
}
match env::var("REMOTE_DEV_JDK_DETECTION") {
Ok(remote_dev_jdk_detection_value) => {
match remote_dev_jdk_detection_value.as_str() {
@@ -470,6 +500,16 @@ impl RemoteDevLaunchConfiguration {
Ok(eap_registry_file)
}
#[cfg(target_os = "linux")]
fn setup_jcef(&self) -> Result<()> {
bail!("XVFB workarounds from linux are not ported yet");
}
#[cfg(not(target_os = "linux"))]
fn setup_jcef(&self) -> Result<()> {
bail!("jcef support not yet implemented");
}
#[cfg(not(target_os = "linux"))]
fn setup_font_config() -> Result<()> {
Ok(())

View File

@@ -5,9 +5,7 @@ pub mod utils;
#[cfg(test)]
mod tests {
use std::collections::HashMap;
use std::env;
use std::path::Path;
use xplat_launcher::get_config_home;
use crate::utils::*;
#[test]
@@ -113,4 +111,16 @@ mod tests {
assert!(!output.contains("Force enable new UI"));
}
#[test]
fn remote_dev_jcef_enabled_test() {
let test = prepare_test_env(LauncherLocation::RemoteDev);
let project_dir = &test.project_dir.to_string_lossy().to_string();
let env = HashMap::from([("REMOTE_DEV_SERVER_JCEF_ENABLED", "0"), ("REMOTE_DEV_SERVER_TRACE", "1")]);
let remote_dev_command = &["run", &project_dir];
let output = run_launcher_ext(&test, &LauncherRunSpec::remote_dev().with_args(remote_dev_command).with_env(&env)).stdout;
assert!(output.contains("JCEF support is disabled. Set REMOTE_DEV_SERVER_JCEF_ENABLED=true to enable"));
}
}