diff options
author | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2022-10-12 22:22:12 +0200 |
---|---|---|
committer | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2022-10-12 22:29:35 +0200 |
commit | a06602363c9b001a1877afa771b3282f2230595c (patch) | |
tree | befe6d9143e614db570614f6590db69ec7f63cd6 /platform/web/SCsub | |
parent | ea47e03b360d0aeee10c1f7ef798f5750c2b1aa8 (diff) |
[Web] Add the "serve" and "run" scons targets.
You can now run the test HTTP server by calling:
scons p=web serve
If you also wish to run the browser, call instead:
scons p=web 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.
Diffstat (limited to 'platform/web/SCsub')
-rw-r--r-- | platform/web/SCsub | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/platform/web/SCsub b/platform/web/SCsub index 013b734be2..cb00fa9f5b 100644 --- a/platform/web/SCsub +++ b/platform/web/SCsub @@ -2,6 +2,20 @@ Import("env") +# The HTTP server "targets". Run with "scons p=web serve", or "scons p=web 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/.web_zip").abspath, port, "run" in COMMAND_LINE_TARGETS) + sys.exit(0) + web_files = [ "audio_driver_web.cpp", "display_server_web.cpp", |