RDCT-1114: consider idea[.exe] serverMode to be remote dev launch mode in native launcher

GitOrigin-RevId: cec3dc7e5d0827677306da1156024ab01fd39de6
This commit is contained in:
Nikolay Kuznetsov
2024-09-05 18:50:36 +02:00
committed by intellij-monorepo-bot
parent 7e1404acd6
commit fc8443d377
3 changed files with 22 additions and 1 deletions

View File

@@ -16,6 +16,11 @@ import java.util.stream.IntStream;
public class TestMain {
public static void main(String[] args) throws Exception {
if (args.length > 0 && "serverMode".equals(args[0])) {
System.out.println("Started in server mode");
args = Arrays.copyOfRange(args, 1, args.length);
}
if (args.length > 0) {
switch (args[0]) {
case "dump-launch-parameters" -> dumpLaunchParameters(args);

View File

@@ -70,7 +70,9 @@ const CLASS_PATH_SEPARATOR: &str = ":";
pub fn main_lib() {
let exe_path = env::current_exe().unwrap_or_else(|_| PathBuf::from(env::args().next().unwrap()));
let remote_dev = exe_path.file_name().unwrap().to_string_lossy().starts_with("remote-dev-server");
let remote_dev_launcher_used = exe_path.file_name().unwrap().to_string_lossy().starts_with("remote-dev-server");
let server_mode_argument_used = env::args().nth(1).map(|x| x == "serverMode").unwrap_or(false);
let remote_dev = remote_dev_launcher_used || server_mode_argument_used;
let sandbox_subprocess = cfg!(target_os = "windows") && env::args().any(|arg| arg.contains("--type="));
let debug_mode = remote_dev || env::var(DEBUG_MODE_ENV_VAR).is_ok();

View File

@@ -75,6 +75,20 @@ mod tests {
assert!(!output.contains("Usage: ./remote-dev-server [ij_command_name] [/path/to/project] [arguments...]"), "output:\n{}", output);
}
#[test]
fn remote_dev_launch_via_common_launcher_test() {
let test = prepare_test_env(LauncherLocation::Standard);
let remote_dev_command = &["serverMode", "print-cwd"];
let launch_result = run_launcher_ext(&test, LauncherRunSpec::standard().with_args(remote_dev_command));
let output = launch_result.stdout;
assert!(output.contains("Started in server mode"), "'serverMode' was not included in arguments:\n{}", output);
assert!(output.contains("Mode: remote-dev"), "Launched in non-remote mode:\n{}", output);
assert!(output.contains("CWD="), "Working directory was not printed:\n{}", output);
}
#[test]
fn remote_dev_new_ui_test1() {
let test = prepare_test_env(LauncherLocation::RemoteDev);