mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-01-24 07:53:30 +08:00
tidying
This commit is contained in:
parent
fa8600304a
commit
ee19079f6d
56
.efrocachemap
generated
56
.efrocachemap
generated
@ -4072,26 +4072,26 @@
|
||||
"build/assets/workspace/ninjafightplug.py": "https://files.ballistica.net/cache/ba1/18/4b/787a9267e17be3c49966072581a5",
|
||||
"build/assets/workspace/onslaughtplug.py": "https://files.ballistica.net/cache/ba1/20/f6/4ce9bc3c1f3732f6adf8237fbe9b",
|
||||
"build/assets/workspace/runaroundplug.py": "https://files.ballistica.net/cache/ba1/a5/30/9058181df0b1255bf6950cbc7813",
|
||||
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/af/74/63a2e94a00fc6fd7e2ba20312835",
|
||||
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/a0/f4/4949dd40fa16ceb096f19f9fb59a",
|
||||
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/b5/54/c4a0b3ebae89c1daacad1fc4487d",
|
||||
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/d7/1c/01d56615808e727b56a3693fe4ad",
|
||||
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/bc/76/25f6808f20283d4e82be28ddb4a1",
|
||||
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/2e/8f/adf3d0562553038e34976dff9958",
|
||||
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/3f/0e/dd749c23f02e312907082a07a861",
|
||||
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/31/71/a94fb103d47b9ce9efca77954174",
|
||||
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/75/22/ce4cbe58229f9562f995d43d7e92",
|
||||
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/1a/3d/3b4425729c0f3340e3625dbba55c",
|
||||
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/3c/38/13ff6125bf31f1a148bb9b9b2bba",
|
||||
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/8f/bf/acc99bed876fcf2a22576c318cfa",
|
||||
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/f8/f1/a5023eeb804dc7595b5ea571d843",
|
||||
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/4a/cb/02d7e6cb708ada799cd92f6429d9",
|
||||
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/bf/79/9bb3ffb328636d0001dea7ba574e",
|
||||
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/3c/af/84c4f181932bc05eb01453cb80ac",
|
||||
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/0c/9f/8ef5e150e65b5954f8573096f501",
|
||||
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/34/02/88667cc83749306a5fc325b6675c",
|
||||
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/0c/14/d4f7ffb81cf9544ddd6632ca3c89",
|
||||
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/c4/3e/a410c260e56b01a0ff4affbce1e1",
|
||||
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/1d/7b/7253826637a9bf6d9bfbc8605676",
|
||||
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/91/eb/eaec773bf6e4a832ba9c87c33d54",
|
||||
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/9f/4b/ba62963d78b77786d9aeefb49c7d",
|
||||
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/06/fb/8cf21337918d6930e4b261cfe2ed",
|
||||
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/f7/61/c817cfd272e7ad401b3e3d17ad2b",
|
||||
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/5b/c6/92d0ba8ca612e475b72260a19e98",
|
||||
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/b7/bd/b8ac02a5e68a1069e8f95e694878",
|
||||
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/7d/79/e42dfe45c7b2c1a50d10b4e09efe",
|
||||
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/ed/03/e0b417ce56a85c7975669d3e8b8b",
|
||||
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/ad/ce/473c60a90b856145b0cf587cda4c",
|
||||
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/3c/98/5111efecd865a47f9a3de8e02387",
|
||||
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/6a/8a/b5db085b0e7c302592339e71bb7e",
|
||||
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/b9/43/b58ab949e8096dc5bae6a109aec9",
|
||||
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/ca/80/8f44943b05b5fb9cb4e1c1c5763d",
|
||||
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/a4/92/6be951095042e1005d147be3cd58",
|
||||
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/48/e9/cbc79d892e48a419fb06201b664b",
|
||||
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/b1/77/d2218fb36652c6925becdfa337b4",
|
||||
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/6b/dd/6c19ca17aa060e11c4d95c4a9087",
|
||||
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/2b/67/23ceb35d65c944919040a21f2b0b",
|
||||
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/60/27/193bb6c86f557aa3846b967e84b9",
|
||||
"build/prefab/lib/linux_arm64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/29/dc/e5b08aae2dbe3222082aaa1e90e7",
|
||||
"build/prefab/lib/linux_arm64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/ce/bb/5796a83ce9d1c9cf58e08f3ff351",
|
||||
"build/prefab/lib/linux_arm64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/31/65/014221e46f7974f40aa84c8922dc",
|
||||
@ -4108,14 +4108,14 @@
|
||||
"build/prefab/lib/mac_x86_64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/14/4b/68a0ece3c1f191183b695cf45a4d",
|
||||
"build/prefab/lib/mac_x86_64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/1f/3f/d899a46cc0dc8bc4f1b38f9318a5",
|
||||
"build/prefab/lib/mac_x86_64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/de/99/95fdcb3f614a7b83ada148bca38d",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/57/2e/ee73674f5b1f7386c60ea5307ded",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/93/30/08020cd2db3ef59496d5e96f2d84",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/d3/3a/97d1be08d0490e1e31268e23cdbc",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/cf/e4/d33833d8388f738523572c6a8da2",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/56/26/d9fedd985d38d4b2e463ab665c9e",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/6f/de/0778f269e1c51bf235b5ec3d126f",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/75/17/af83314fa27fe2ecc6c405a154b1",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/5e/a6/978e8b472821c272f8578de27ea0",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/7a/5f/b922c97b829f5de5e3261f6d8de9",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/e9/48/262cc207da408d08a14524ccf736",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/70/55/62ed906a1d81978d9b0b4d32869d",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/2a/c7/1bc68e765058fe9322fe85c16cf9",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/4b/26/19e9a195b08f7b66052ff17a8b87",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/0f/e3/fe48cb08d1736d1316af65363614",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/fd/bd/09275e9bc0237b6806f7bab36360",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/4d/30/94c21cd426979e7e6e323f2f7dae",
|
||||
"src/assets/ba_data/python/babase/_mgen/__init__.py": "https://files.ballistica.net/cache/ba1/52/c6/c11130af7b10d6c0321add5518fa",
|
||||
"src/assets/ba_data/python/babase/_mgen/enums.py": "https://files.ballistica.net/cache/ba1/38/c3/1dedd5e74f2508efc5974c8815a1",
|
||||
"src/ballistica/base/mgen/pyembed/binding_base.inc": "https://files.ballistica.net/cache/ba1/ea/6a/6a4721b144e5e297b542d2a0eea2",
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
### 1.7.20 (build 21092, api 8, 2023-06-12)
|
||||
### 1.7.20 (build 21093, api 8, 2023-06-12)
|
||||
|
||||
- This seems like a good time for a `refactoring` release in anticipation of
|
||||
changes coming in 1.8. Basically this means that a lot of things will be
|
||||
|
||||
2
Makefile
2
Makefile
@ -161,7 +161,7 @@ dummymodules-clean:
|
||||
|
||||
# Generate docs.
|
||||
docs: assets-cmake
|
||||
@tools/pcommand gendocs
|
||||
@tools/pcommand gen_docs_pdoc
|
||||
|
||||
# Tell make which of these targets don't represent files.
|
||||
.PHONY: help prereqs prereqs-pre-update prereqs-clean assets assets-cmake \
|
||||
|
||||
@ -28,7 +28,7 @@ if TYPE_CHECKING:
|
||||
|
||||
# Build number and version of the ballistica binary we expect to be
|
||||
# using.
|
||||
TARGET_BALLISTICA_BUILD = 21092
|
||||
TARGET_BALLISTICA_BUILD = 21093
|
||||
TARGET_BALLISTICA_VERSION = '1.7.20'
|
||||
|
||||
_g_env_config: EnvConfig | None = None
|
||||
|
||||
@ -39,7 +39,7 @@ auto main(int argc, char** argv) -> int {
|
||||
namespace ballistica {
|
||||
|
||||
// These are set automatically via script; don't modify them here.
|
||||
const int kEngineBuildNumber = 21092;
|
||||
const int kEngineBuildNumber = 21093;
|
||||
const char* kEngineVersion = "1.7.20";
|
||||
|
||||
auto MonolithicMain(const core::CoreConfig& core_config) -> int {
|
||||
|
||||
@ -6,16 +6,16 @@ from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from batools import testrun
|
||||
from batools import apprun
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
testrun.test_runs_disabled(), reason=testrun.test_runs_disabled_reason()
|
||||
apprun.test_runs_disabled(), reason=apprun.test_runs_disabled_reason()
|
||||
)
|
||||
def test_imports() -> None:
|
||||
"""Test imports for our featureset."""
|
||||
|
||||
# Make sure our package and binary module can be cleanly imported by
|
||||
# themselves.
|
||||
testrun.run_command('import babase')
|
||||
testrun.run_command('import _babase')
|
||||
apprun.python_command('import babase', purpose='import testing')
|
||||
apprun.python_command('import _babase', purpose='import testing')
|
||||
|
||||
@ -6,16 +6,16 @@ from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from batools import testrun
|
||||
from batools import apprun
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
testrun.test_runs_disabled(), reason=testrun.test_runs_disabled_reason()
|
||||
apprun.test_runs_disabled(), reason=apprun.test_runs_disabled_reason()
|
||||
)
|
||||
def test_imports() -> None:
|
||||
"""Test imports for our featureset."""
|
||||
|
||||
# Make sure our package and binary module can be cleanly imported by
|
||||
# themselves.
|
||||
testrun.run_command('import baclassic')
|
||||
testrun.run_command('import _baclassic')
|
||||
apprun.python_command('import baclassic', purpose='import testing')
|
||||
apprun.python_command('import _baclassic', purpose='import testing')
|
||||
|
||||
@ -6,16 +6,16 @@ from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from batools import testrun
|
||||
from batools import apprun
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
testrun.test_runs_disabled(), reason=testrun.test_runs_disabled_reason()
|
||||
apprun.test_runs_disabled(), reason=apprun.test_runs_disabled_reason()
|
||||
)
|
||||
def test_imports() -> None:
|
||||
"""Test imports for our featureset."""
|
||||
|
||||
# Make sure our package and binary module can be cleanly imported by
|
||||
# themselves.
|
||||
testrun.run_command('import baplus')
|
||||
testrun.run_command('import _baplus')
|
||||
apprun.python_command('import baplus', purpose='import testing')
|
||||
apprun.python_command('import _baplus', purpose='import testing')
|
||||
|
||||
@ -6,16 +6,16 @@ from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from batools import testrun
|
||||
from batools import apprun
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
testrun.test_runs_disabled(), reason=testrun.test_runs_disabled_reason()
|
||||
apprun.test_runs_disabled(), reason=apprun.test_runs_disabled_reason()
|
||||
)
|
||||
def test_imports() -> None:
|
||||
"""Test imports for our featureset."""
|
||||
|
||||
# Make sure our package and binary module can be cleanly imported by
|
||||
# themselves.
|
||||
testrun.run_command('import bascenev1')
|
||||
testrun.run_command('import _bascenev1')
|
||||
apprun.python_command('import bascenev1', purpose='import testing')
|
||||
apprun.python_command('import _bascenev1', purpose='import testing')
|
||||
|
||||
@ -6,16 +6,16 @@ from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from batools import testrun
|
||||
from batools import apprun
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
testrun.test_runs_disabled(), reason=testrun.test_runs_disabled_reason()
|
||||
apprun.test_runs_disabled(), reason=apprun.test_runs_disabled_reason()
|
||||
)
|
||||
def test_imports() -> None:
|
||||
"""Test imports for our featureset."""
|
||||
|
||||
# Make sure our package and binary module can be cleanly imported by
|
||||
# themselves.
|
||||
testrun.run_command('import batemplatefs')
|
||||
testrun.run_command('import _batemplatefs')
|
||||
apprun.python_command('import batemplatefs', purpose='import testing')
|
||||
apprun.python_command('import _batemplatefs', purpose='import testing')
|
||||
|
||||
@ -6,16 +6,16 @@ from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from batools import testrun
|
||||
from batools import apprun
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
testrun.test_runs_disabled(), reason=testrun.test_runs_disabled_reason()
|
||||
apprun.test_runs_disabled(), reason=apprun.test_runs_disabled_reason()
|
||||
)
|
||||
def test_imports() -> None:
|
||||
"""Test imports for our featureset."""
|
||||
|
||||
# Make sure our package and binary module can be cleanly imported by
|
||||
# themselves.
|
||||
testrun.run_command('import bauiv1')
|
||||
testrun.run_command('import _bauiv1')
|
||||
apprun.python_command('import bauiv1', purpose='import testing')
|
||||
apprun.python_command('import _bauiv1', purpose='import testing')
|
||||
|
||||
154
tools/batools/apprun.py
Executable file
154
tools/batools/apprun.py
Executable file
@ -0,0 +1,154 @@
|
||||
# Released under the MIT License. See LICENSE for details.
|
||||
#
|
||||
"""Utils for wrangling runs of the app.
|
||||
|
||||
Manages constructing or downloading it as well as running it.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
import platform
|
||||
import subprocess
|
||||
import os
|
||||
|
||||
from efro.terminal import Clr
|
||||
|
||||
if TYPE_CHECKING:
|
||||
pass
|
||||
|
||||
|
||||
def test_runs_disabled() -> bool:
|
||||
"""Are test runs disabled on the current platform?"""
|
||||
|
||||
# Currently skipping this on Windows, as we aren't able to assemble
|
||||
# complete build there without WSL.
|
||||
if platform.system() == 'Windows':
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def test_runs_disabled_reason() -> str:
|
||||
"""Why are test runs disabled here?"""
|
||||
# Can get more specific later.
|
||||
return 'App test runs disabled here.'
|
||||
|
||||
|
||||
def python_command(cmd: str, purpose: str) -> None:
|
||||
"""Run a cmd with a built bin and PYTHONPATH set to its scripts dir."""
|
||||
|
||||
binpath = acquire_binary(assets=True, purpose=purpose)
|
||||
bindir = os.path.dirname(binpath)
|
||||
|
||||
cmdargs = [binpath, '--command', cmd]
|
||||
print(f'Running command: {cmdargs}...')
|
||||
subprocess.run(
|
||||
cmdargs,
|
||||
env=dict(os.environ, PYTHONPATH=f'{bindir}/ba_data/python'),
|
||||
check=True,
|
||||
)
|
||||
|
||||
|
||||
def acquire_binary(assets: bool, purpose: str) -> str:
|
||||
"""Return a path to a runnable binary, building or downloading as needed.
|
||||
|
||||
If 'assets' is False, only the binary itself will be fetched or
|
||||
assembled; no scripts or assets. This generally saves some time, but
|
||||
must only be used for very simple '-c' command cases where no assets
|
||||
will be needed.
|
||||
|
||||
By default, binaries used here will be downloaded prefab builds.
|
||||
This allows people without full compiler setups to still perform app
|
||||
runs for things like dummy-module generation. However, someone who
|
||||
*is* able to compile their own binaries might prefer to use their
|
||||
own binaries here so that changes to their local repo are properly
|
||||
reflected in app runs and whatnot. Set environment variable
|
||||
BA_APP_RUN_ENABLE_BUILDS=1 to enable that.
|
||||
|
||||
When local builds are enabled, we use the same gui build targets as
|
||||
the 'make cmake' command. This works well if you are iterating using
|
||||
that build target anyway, minimizing redundant rebuilds. You may,
|
||||
however, prefer to assemble headless builds for various reasons
|
||||
including faster build times and fewer dependencies. To do so, set
|
||||
environment variable BA_APP_RUN_BUILD_HEADLESS=1.
|
||||
"""
|
||||
|
||||
binary_build_command: list[str]
|
||||
if os.environ.get('BA_APP_RUN_ENABLE_BUILDS') == '1':
|
||||
# Going the build-it-ourselves route.
|
||||
|
||||
if os.environ.get('BA_APP_RUN_BUILD_HEADLESS') == '1':
|
||||
# User has opted for headless builds.
|
||||
if assets:
|
||||
print(
|
||||
f'{Clr.SMAG}Building headless binary & assets for'
|
||||
f' {purpose}...{Clr.RST}',
|
||||
flush=True,
|
||||
)
|
||||
binary_build_command = ['make', 'cmake-server-build']
|
||||
else:
|
||||
print(
|
||||
f'{Clr.SMAG}Building headless binary for'
|
||||
f' {purpose}...{Clr.RST}',
|
||||
flush=True,
|
||||
)
|
||||
binary_build_command = ['make', 'cmake-server-binary']
|
||||
binary_path = 'build/cmake/server-debug/dist/ballisticakit_headless'
|
||||
else:
|
||||
# Using default gui builds.
|
||||
if assets:
|
||||
print(
|
||||
f'{Clr.SMAG}Building gui binary & assets for'
|
||||
f' {purpose}...{Clr.RST}',
|
||||
flush=True,
|
||||
)
|
||||
binary_build_command = ['make', 'cmake-build']
|
||||
else:
|
||||
print(
|
||||
f'{Clr.SMAG}Building gui binary for {purpose}...{Clr.RST}',
|
||||
flush=True,
|
||||
)
|
||||
binary_build_command = ['make', 'cmake-binary']
|
||||
binary_path = 'build/cmake/debug/ballisticakit'
|
||||
else:
|
||||
# Ok; going with prefab headless stuff.
|
||||
if assets:
|
||||
print(
|
||||
f'{Clr.SMAG}Fetching prefab binary & assets for'
|
||||
f' {purpose}...{Clr.RST}',
|
||||
flush=True,
|
||||
)
|
||||
binary_path = (
|
||||
subprocess.run(
|
||||
['tools/pcommand', 'prefab_binary_path', 'server-release'],
|
||||
check=True,
|
||||
capture_output=True,
|
||||
)
|
||||
.stdout.decode()
|
||||
.strip()
|
||||
)
|
||||
binary_build_command = ['make', 'prefab-server-release-build']
|
||||
else:
|
||||
print(
|
||||
f'{Clr.SMAG}Fetching prefab binary for {purpose}...{Clr.RST}',
|
||||
flush=True,
|
||||
)
|
||||
binary_path = (
|
||||
subprocess.run(
|
||||
['tools/pcommand', 'prefab_binary_path', 'server-release'],
|
||||
check=True,
|
||||
capture_output=True,
|
||||
)
|
||||
.stdout.decode()
|
||||
.strip()
|
||||
)
|
||||
binary_build_command = ['make', binary_path]
|
||||
|
||||
subprocess.run(binary_build_command, check=True)
|
||||
if not os.path.exists(binary_path):
|
||||
raise RuntimeError(
|
||||
f"Binary not found at expected path '{binary_path}'."
|
||||
)
|
||||
return binary_path
|
||||
# subprocess.run(['make', 'scripts-cmake'], cwd='src/assets', check=True)
|
||||
@ -75,14 +75,20 @@ def parse_docs_attrs(attrs: list[AttributeInfo], docs: str) -> str:
|
||||
return docs
|
||||
|
||||
|
||||
def generate(projroot: str) -> None:
|
||||
def generate_pdoc(projroot: str) -> None:
|
||||
"""Main entry point."""
|
||||
del projroot # Unused.
|
||||
print('WOULD DO DOCS')
|
||||
|
||||
|
||||
def do_generate_pdoc(projroot: str) -> None:
|
||||
"""Main entry point."""
|
||||
from batools.version import get_current_version
|
||||
import pdoc
|
||||
|
||||
# Since we're operating on source dirs, suppress .pyc generation.
|
||||
# (__pycache__ dirs in source dirs causes some subtle headaches in
|
||||
# the private repo)
|
||||
# (__pycache__ dirs accumulating in source dirs causes some subtle
|
||||
# headaches)
|
||||
sys.dont_write_bytecode = True
|
||||
|
||||
# Make sure we're running from the dir above this script.
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
# Released under the MIT License. See LICENSE for details.
|
||||
#
|
||||
# pylint: disable=too-many-lines
|
||||
"""Generates dummy .py modules based on binary modules.
|
||||
|
||||
This allows us to use code introspection tools such as pylint without spinning
|
||||
@ -914,6 +913,7 @@ def generate_dummy_modules(projroot: str) -> None:
|
||||
# pylint: disable=cyclic-import
|
||||
|
||||
from batools.featureset import FeatureSet
|
||||
from batools import apprun
|
||||
|
||||
toolsdir = os.path.abspath(os.path.join(projroot, 'tools'))
|
||||
|
||||
@ -924,63 +924,9 @@ def generate_dummy_modules(projroot: str) -> None:
|
||||
f" but cwd is '{os.getcwd()}'."
|
||||
)
|
||||
|
||||
# WARNING: this builds cmake-binary. This could cause problems in
|
||||
# parallel builds containing checks plus actual builds of cmake-binary.
|
||||
# The upside is during iteration this will often just use the same binary
|
||||
# we are iterating with, reducing redundant compiles.
|
||||
|
||||
# Normally here we download a prefab binary to use when generating
|
||||
# dummy modules. This allows people without full compiler setups to
|
||||
# still get dummy modules made so they can check their Python code.
|
||||
# However someone who *is* able to compile their own binaries might want
|
||||
# to go with those so any changes they make to the binary are reflected
|
||||
# in the dummy-modules. Set BA_ENABLE_DUMMY_MODULE_BINARY_BUILDS=1 to
|
||||
# enable that.
|
||||
binary_build_command: list[str]
|
||||
if os.environ.get('BA_ENABLE_DUMMY_MODULE_BINARY_BUILDS') == '1':
|
||||
# Default to gui binary since that's what people are most likely
|
||||
# to be iterating with anyway (minimizing redundant builds), but
|
||||
# allow using headless builds which may work better in CI
|
||||
# situations and whatnot due to fewer build requirements.
|
||||
if os.environ.get('BA_DUMMY_MODULE_BINARY_BUILDS_USE_HEADLESS') == '1':
|
||||
print(
|
||||
f'{Clr.SMAG}Building (headless) binary to generate'
|
||||
f' dummy-modules...{Clr.RST}',
|
||||
flush=True,
|
||||
)
|
||||
binary_build_command = ['make', 'cmake-server-binary']
|
||||
binary_path = 'build/cmake/server-debug/dist/ballisticakit_headless'
|
||||
else:
|
||||
print(
|
||||
f'{Clr.SMAG}Building (gui) binary to generate'
|
||||
f' dummy-modules...{Clr.RST}',
|
||||
flush=True,
|
||||
)
|
||||
binary_build_command = ['make', 'cmake-binary']
|
||||
binary_path = 'build/cmake/debug/ballisticakit'
|
||||
else:
|
||||
print(
|
||||
f'{Clr.SMAG}Fetching prefab binary to'
|
||||
f' generate dummy-modules...{Clr.RST}',
|
||||
flush=True,
|
||||
)
|
||||
binary_path = (
|
||||
subprocess.run(
|
||||
['tools/pcommand', 'prefab_binary_path', 'server-release'],
|
||||
check=True,
|
||||
capture_output=True,
|
||||
)
|
||||
.stdout.decode()
|
||||
.strip()
|
||||
)
|
||||
binary_build_command = ['make', binary_path]
|
||||
|
||||
subprocess.run(binary_build_command, check=True)
|
||||
if not os.path.exists(binary_path):
|
||||
raise RuntimeError(
|
||||
f"Binary not found at expected path '{binary_path}'."
|
||||
)
|
||||
subprocess.run(['make', 'scripts-cmake'], cwd='src/assets', check=True)
|
||||
binary_path = apprun.acquire_binary(
|
||||
assets=True, purpose='dummy modules generation'
|
||||
)
|
||||
|
||||
pycmd = (
|
||||
f'import sys\n'
|
||||
|
||||
@ -518,13 +518,13 @@ def warm_start_asset_build() -> None:
|
||||
)
|
||||
|
||||
|
||||
def gendocs() -> None:
|
||||
"""Generate docs html."""
|
||||
def gen_docs_pdoc() -> None:
|
||||
"""Generate pdoc documentation."""
|
||||
from efro.terminal import Clr
|
||||
import batools.docs
|
||||
|
||||
print(f'{Clr.BLU}Generating documentation...{Clr.RST}')
|
||||
batools.docs.generate(projroot=str(PROJROOT))
|
||||
batools.docs.generate_pdoc(projroot=str(PROJROOT))
|
||||
|
||||
|
||||
def list_pip_reqs() -> None:
|
||||
|
||||
@ -150,8 +150,8 @@ def spinoff_test(args: list[str]) -> None:
|
||||
cwd=path,
|
||||
env=dict(
|
||||
os.environ,
|
||||
BA_ENABLE_DUMMY_MODULE_BINARY_BUILDS='1',
|
||||
BA_DUMMY_MODULE_BINARY_BUILDS_USE_HEADLESS='1',
|
||||
BA_APP_RUN_ENABLE_BUILDS='1',
|
||||
BA_APP_RUN_BUILD_HEADLESS='1',
|
||||
),
|
||||
check=True,
|
||||
)
|
||||
|
||||
@ -1,55 +0,0 @@
|
||||
# Released under the MIT License. See LICENSE for details.
|
||||
#
|
||||
"""Utils for test runs of the app."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
import platform
|
||||
import subprocess
|
||||
import os
|
||||
|
||||
if TYPE_CHECKING:
|
||||
pass
|
||||
|
||||
|
||||
def test_runs_disabled() -> bool:
|
||||
"""Are test runs disabled on the current platform?"""
|
||||
|
||||
# Currently skipping this on Windows, as we aren't able to assemble
|
||||
# complete build there without WSL.
|
||||
if platform.system() == 'Windows':
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def test_runs_disabled_reason() -> str:
|
||||
"""Why are test runs disabled here?"""
|
||||
# Can get more specific later.
|
||||
return 'App test runs disabled here.'
|
||||
|
||||
|
||||
def get_binary() -> str:
|
||||
"""Return a path to a server build binary, building it if need be."""
|
||||
|
||||
subprocess.run(['make', 'cmake-server-build'], check=True)
|
||||
builddir = 'build/cmake/server-debug/dist'
|
||||
binpath = os.path.join(builddir, 'ballisticakit_headless')
|
||||
assert os.path.isfile(binpath)
|
||||
return binpath
|
||||
|
||||
|
||||
def run_command(cmd: str) -> None:
|
||||
"""Run a cmd with a built bin and PYTHONPATH set to its scripts dir."""
|
||||
|
||||
binpath = get_binary()
|
||||
bindir = os.path.dirname(binpath)
|
||||
|
||||
cmdargs = [binpath, '--command', cmd]
|
||||
print(f'Running command: {cmdargs}...')
|
||||
subprocess.run(
|
||||
cmdargs,
|
||||
env=dict(os.environ, PYTHONPATH=f'{bindir}/ba_data/python'),
|
||||
check=True,
|
||||
)
|
||||
@ -89,7 +89,7 @@ from batools.pcommand import (
|
||||
efrocache_get,
|
||||
get_modern_make,
|
||||
warm_start_asset_build,
|
||||
gendocs,
|
||||
gen_docs_pdoc,
|
||||
list_pip_reqs,
|
||||
install_pip_reqs,
|
||||
checkenv,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user