import subprocess
import sys

# sys.executable to use the same Python interpreter used to invoke this command
if len(sys.argv) < 2:
    sys.stderr.write("Expected different parameters!\n")
    sys.stderr.write("    %s port\n" % sys.argv[0])
else:
    subprocess.check_call([sys.executable, "-m", "sccd.compiler.sccdc", "-p", "threads", "server.xml"], cwd="hybrid_server")
    # There's no need to specify `--kernel=baseline-jit` here, because that's the default kernel.
    # Also, specifying a kernel here breaks the performance tests.
    subprocess.call([sys.executable, "run_mvk_server.py"] + sys.argv[1:], cwd="hybrid_server")
    # subprocess.call([sys.executable, "run_mvk_server.py"] + sys.argv[1:] + ["--kernel=legacy-interpreter"], cwd="hybrid_server")
