spinoff functionality and tidying

This commit is contained in:
Eric 2023-05-31 15:23:03 -07:00
parent 77b6183ce3
commit 088db6928b
No known key found for this signature in database
GPG Key ID: 89C93F0F8D6D5A98
9 changed files with 103 additions and 34 deletions

View File

@ -4072,26 +4072,26 @@
"build/assets/workspace/ninjafightplug.py": "https://files.ballistica.net/cache/ba1/c5/09/4f10b8a21ba87aa5509cff7a164b",
"build/assets/workspace/onslaughtplug.py": "https://files.ballistica.net/cache/ba1/ff/0a/a354984f9c074dab0676ac7e4877",
"build/assets/workspace/runaroundplug.py": "https://files.ballistica.net/cache/ba1/2a/1c/9ee5db6d1bceca7fa6638fb8abde",
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/d6/cf/003cf0efa77173b016ed604d6a09",
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/82/b5/ee844698615a1520fb4cea0b89ee",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/2f/ec/9e48aecc3c832733a23da2285423",
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/b5/8f/36ebe9ffcda1c2168136b747c3d6",
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/42/02/409aedc600cceed6cb9a15fbcf04",
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/2a/aa/c369bdf43bf67629eb5761fae81a",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/ab/64/9d0c2baa399fe6bf2a661f3d183e",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/65/ac/6cec563654d4808a4c6c7f8309db",
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/b1/6f/4350d9bb6e95bac454c990a048f7",
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/eb/10/3d67fc054cb7a0f20452aa91a851",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/8f/2d/5d4e2056b28104ec113d9aa29fe9",
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/c4/7c/c4a0410a869395d686a72304a4a6",
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/39/49/2e8c420760fb17f14e385f0ec210",
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/78/1b/ae4c1d35d46ce77e5492024a9d8e",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/43/fa/32afbc2bc71a5896a91b80985cf4",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/e7/4f/d9e0cab203d543fa70fc98c3f129",
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/86/16/99ded1ba4c6b724ff070b7f6686b",
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/36/5c/a16a7cfaad130ba9cc81e2464536",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/d9/13/307c8d0df399a127efcea80938a9",
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/bb/09/67f08e389f6eaa07a54dcc564c3d",
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/0e/83/a30a9b21d0256eb7252a3aea77cb",
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/82/17/0ea5d85ff01573e2de91821dd8c9",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/46/12/88dfbcad582747150b6efe8fefe7",
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/62/1f/78a78ed612d81a2708d9948c72ee",
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/2c/2d/5c062b903d94b492d676e457ba81",
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/f3/15/b168df3090bcc2f1f156029934eb",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/6b/51/a39e9cf765dc9ec4052df4a6b33d",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/82/09/f2d830e10ae0c9a77071ba4a7008",
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/eb/80/ee6315adac4e758f1802683c24e9",
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/48/be/fbfd2e4eee8993b06bcd6a1562fa",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/a9/7d/bad58995ca27599d4000c9507ea1",
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/65/08/d274f08d7fb52896967cecc4af62",
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/3b/fa/db2bc0b2d4324a969e91add25bd1",
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/1b/42/fc1392fc5831d0e5717248608d04",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/cb/03/337ffd349762467008307c2afc99",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/37/62/81f812c8e28ea74ab8f9d0b1c7e4",
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/fb/96/05c6846f69abf6c69ed3a756d66f",
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/ff/79/6a67ceb295488a2659d57778cfd1",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/e1/e4/4e3dd2af6155d2f647a101551932",
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/e9/32/78bec9589f2271a5d70c48048815",
"build/prefab/lib/linux_arm64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/d4/6a/dd303a200b98a56ba3b100277057",
"build/prefab/lib/linux_arm64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/fc/2c/2996c558fb408a548fdd37398c9a",
"build/prefab/lib/linux_arm64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/ed/28/b7a72be7ae1bd2b58dda4b6902a0",
@ -4108,14 +4108,14 @@
"build/prefab/lib/mac_x86_64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/71/f6/691482915ad58ea1e953cc23d74c",
"build/prefab/lib/mac_x86_64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/b8/2b/6ec8c78980a62e3e0ee4b36ece04",
"build/prefab/lib/mac_x86_64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/4e/56/a95c987b2a371759896b037fea86",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/a7/63/d16db9ff142082aec0461beec11c",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/e4/5e/60168cdde3fbd04ed7291213f801",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/41/2b/471344cd500099c5ede70a2b4408",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/5b/d9/033740b8eb53c7006ef16ae2d089",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/8f/d5/76ae04fdbb893c96f60b06bd625c",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/eb/ae/1ac4b64db598510400c3142f4e50",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/02/17/b72e859683035b69ee0019338d57",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/6e/96/21d88cd36cafe73fc6e68188677b",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/32/a0/8bf135cfa577c08c1e223fcf2031",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/33/a6/428f8a5f54aa10495da308af1e33",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/ae/0a/020e5df843adc6c48c5d1531eac4",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/59/83/ba94efb820dbca8ea42944c045ab",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/c6/de/4100a3f3b8d69fea601fe2810d18",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/ed/9f/c3ebb7d1e0032da37d8f0a0e88ad",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/d4/72/128d744f26cdb804c08f8241a89a",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/1b/57/ba539fbf787b1cde81d12bcdfb37",
"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/b4/3d/e352190a0e5673d101c0f3ee3ad2",

View File

@ -1,4 +1,4 @@
### 1.7.20 (build 21029, api 8, 2023-05-30)
### 1.7.20 (build 21030, api 8, 2023-05-31)
- 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

View File

@ -31,7 +31,7 @@ if TYPE_CHECKING:
# Build number and version of the ballistica binary we expect to be
# using.
TARGET_BALLISTICA_BUILD = 21029
TARGET_BALLISTICA_BUILD = 21030
TARGET_BALLISTICA_VERSION = '1.7.20'
_g_env_config: EnvConfig | None = None

View File

@ -1106,6 +1106,15 @@ auto SceneV1Python::FilterChatMessage(std::string* message, int client_id)
-> bool {
assert(message);
base::ScopedSetContext ssc(nullptr);
// This string data can be coming straight in off the network; need
// to avoid letting malicious garbage through to Python api.
if (!Utils::IsValidUTF8(*message)) {
BA_LOG_ONCE(LogLevel::kWarning,
"FilterChatMessage got invalid UTF8 data; could be an attack.");
return false;
}
PythonRef args(Py_BuildValue("(si)", message->c_str(), client_id),
PythonRef::kSteal);
PythonRef result = objs().Get(ObjID::kFilterChatMessageCall).Call(args);

View File

@ -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 = 21029;
const int kEngineBuildNumber = 21030;
const char* kEngineVersion = "1.7.20";
auto MonolithicMain(const core::CoreConfig& core_config) -> int {

View File

@ -1036,7 +1036,7 @@ def cmake_prep_dir(dirname: str, verbose: bool = False) -> None:
if entry.current_value != previous_value:
print(
f'{Clr.BLU}{entry.name} changed from {previous_value}'
f' to {entry.current_value}; clearing existing build at'
f' to {entry.current_value}; clearing any existing build at'
f' "{dirname}".{Clr.RST}'
)
changed = True

View File

@ -31,6 +31,11 @@ if TYPE_CHECKING:
from batools.project import ProjectUpdater
# Tags that default_filter_file() looks for; these can be used to strip
# out sections that should never be included in spinoff projects.
STRIP_BEGIN_TAG = '# __SPINOFF_STRIP_BEGIN__'
STRIP_END_TAG = '# __SPINOFF_STRIP_END__'
class SpinoffContext:
"""Guts of the spinoff system."""
@ -685,6 +690,28 @@ class SpinoffContext:
def default_filter_file(self, src_path: str, text: str) -> str:
"""Run default filtering on a file."""
# Strip out any sections frames by our strip-begin/end tags.
if STRIP_BEGIN_TAG in text:
lines = text.splitlines()
while STRIP_BEGIN_TAG in lines:
index = lines.index(STRIP_BEGIN_TAG)
endindex = index
while lines[endindex] != STRIP_END_TAG:
endindex += 1
# If the line after us is blank,
# include it too to keep spacing clean.
if (
len(lines) > (endindex + 1)
and not lines[endindex + 1].strip()
):
endindex += 1
del lines[index : endindex + 1]
text = '\n'.join(lines) + '\n'
# Add warnings to some of the git-managed files that we write.
if src_path == 'README.md':
blurb = (

View File

@ -210,9 +210,12 @@ def _do_create(src_root: str | None, dst_root: str) -> None:
# on git so its best to always do this.
subprocess.run(['git', 'init'], cwd=path, check=True, capture_output=True)
# Go with green for interactive use since the command is 'done'.
# Otherwise go blue since its probably part of some larger picture.
doneclr = Clr.BLU if noninteractive else Clr.GRN
print(
f'{Clr.GRN}{Clr.BLD}Spinoff dst project created at'
f' {Clr.RST}{Clr.BLD}{path}{Clr.RST}{Clr.GRN}.{Clr.RST}'
f'{doneclr}{Clr.BLD}Spinoff dst project created at'
f' {Clr.RST}{Clr.BLD}{path}{Clr.RST}{doneclr}.{Clr.RST}'
)
if not noninteractive:
print(

View File

@ -130,6 +130,36 @@ def extract_arg(
return val
# FIXME: this has not been tested yet.
def replace_section(
text: str,
begin_marker: str,
end_marker: str,
replace_text: str = '',
error_if_missing: bool = True,
) -> str:
"""Replace all text between two marker strings (including the markers)."""
if begin_marker not in text:
if error_if_missing:
raise RuntimeError(f"Marker not found in text: '{begin_marker}'.")
return text
splits = text.split(begin_marker)
if len(splits) != 2:
raise RuntimeError(
f"Expected one marker '{begin_marker}'"
f'; found {text.count(begin_marker)}.'
)
before_begin, after_begin = splits
splits = after_begin.split(end_marker)
if len(splits) != 2:
raise RuntimeError(
f"Expected one marker '{end_marker}'"
f'; found {text.count(end_marker)}.'
)
_before_end, after_end = splits
return before_begin + replace_text + after_end
def get_public_license(style: str) -> str:
"""Return the license notice as used for our public facing stuff.