1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-22 15:06:45 +00:00

[Web] Add the "serve" and "run" scons targets.

You can now run the test HTTP server by calling:

scons p=javascript serve

If you also wish to run the browser, call instead:

scons p=javascript run

The default listen port is 8060, but can be overriden via the env
variable GODOT_WEB_TEST_PORT which must be a valid integer.

(cherry picked from commit a06602363c)
This commit is contained in:
Fabio Alessandrelli
2022-10-12 22:22:12 +02:00
committed by Rémi Verschelde
parent 816db5c215
commit eda014197f
2 changed files with 26 additions and 9 deletions

View File

@@ -2,6 +2,20 @@
Import("env")
# The HTTP server "targets". Run with "scons p=javascript serve", or "scons p=javascript run"
if "serve" in COMMAND_LINE_TARGETS or "run" in COMMAND_LINE_TARGETS:
from serve import serve
import os
port = os.environ.get("GODOT_WEB_TEST_PORT", 8060)
try:
port = int(port)
except Exception:
print("GODOT_WEB_TEST_PORT must be a valid integer")
sys.exit(255)
serve(env.Dir("#bin/.javascript_zip").abspath, port, "run" in COMMAND_LINE_TARGETS)
sys.exit(0)
javascript_files = [
"audio_driver_javascript.cpp",
"godot_webgl2.cpp",