diff --git a/.idea/dictionaries/ericf.xml b/.idea/dictionaries/ericf.xml index 2491e0e9..3e8a2d1d 100644 --- a/.idea/dictionaries/ericf.xml +++ b/.idea/dictionaries/ericf.xml @@ -30,8 +30,8 @@ achname achs acinstance - ack'ed ack + ack'ed acked acks acnt @@ -156,8 +156,8 @@ bacommon badguy bafoundation - ballistica's ballistica + ballistica's ballisticacore ballisticacorecb bamaster @@ -816,8 +816,8 @@ gamedata gameinstance gamemap - gamepad's gamepad + gamepad's gamepadadvanced gamepads gamepadselect @@ -1208,8 +1208,8 @@ lsqlite lssl lstart - lstr's lstr + lstr's lstrs lsval ltex @@ -1848,8 +1848,8 @@ sessionname sessionplayer sessionplayers - sessionteam's sessionteam + sessionteam's sessionteams sessiontype setactivity @@ -1998,6 +1998,7 @@ subfolders subname subpath + subpaths subplatform subplatforms subprocess's @@ -2185,8 +2186,8 @@ txtw typeargs typecheck - typechecker's typechecker + typechecker's typedval typeshed typestr diff --git a/Makefile b/Makefile index ea0d4b9f..8af15283 100644 --- a/Makefile +++ b/Makefile @@ -638,6 +638,75 @@ pycharm-full: prereqs mypy-full pycharm pycharm-full +################################################################################ +# # +# Checking (Internal) # +# # +################################################################################ + +# Run all project checks in the cloud. +check-cloud: + @tools/cloudshell ${CLOUDSHELL_HOST_CHECK} --env ${CLOUDSHELL_ENV_CHECK} -- \ + make check + +# Cloud version of check-full +check-cloud-full: + @tools/cloudshell ${CLOUDSHELL_HOST_CHECK} --env ${CLOUDSHELL_ENV_CHECK} -- \ + make check-full + +# Cloud version of check2 +check2-cloud: + @tools/cloudshell ${CLOUDSHELL_HOST_CHECK} --env ${CLOUDSHELL_ENV_CHECK} \ + --lock pycharm -- \ + EFROTOOLS_FULL_PYCHARM_RECACHE=${EFROTOOLS_FULL_PYCHARM_RECACHE} \ + make check2 + +# Cloud version of check2-full +check2-cloud-full: + @tools/cloudshell ${CLOUDSHELL_HOST_CHECK} --env ${CLOUDSHELL_ENV_CHECK} \ + --lock pycharm -- \ + EFROTOOLS_FULL_PYCHARM_RECACHE=${EFROTOOLS_FULL_PYCHARM_RECACHE} \ + make check2-full + +# Cloud version of pylint check +pylint-cloud: + @tools/cloudshell ${CLOUDSHELL_HOST_CHECK} --env ${CLOUDSHELL_ENV_CHECK} -- \ + make pylint + +# Cloud version of pylint-full +pylint-cloud-full: + @tools/cloudshell ${CLOUDSHELL_HOST_CHECK} --env ${CLOUDSHELL_ENV_CHECK} -- \ + make pylint-full + +# Cloud version of mypy check +mypy-cloud: + @tools/cloudshell ${CLOUDSHELL_HOST_CHECK} --env ${CLOUDSHELL_ENV_CHECK} -- \ + make mypy + +# Cloud version of mypy-full check +mypy-cloud-full: + @tools/cloudshell ${CLOUDSHELL_HOST_CHECK} --env ${CLOUDSHELL_ENV_CHECK} -- \ + make mypy-full + +# Cloud version of pycharm check +pycharm-cloud: + @tools/cloudshell ${CLOUDSHELL_HOST_CHECK} --env ${CLOUDSHELL_ENV_CHECK} \ + --lock pycharm -- \ + EFROTOOLS_FULL_PYCHARM_RECACHE=${EFROTOOLS_FULL_PYCHARM_RECACHE} \ + make pycharm + +# Cloud version of pycharm-full +pycharm-cloud-full: + @tools/cloudshell ${CLOUDSHELL_HOST_CHECK} --env ${CLOUDSHELL_ENV_CHECK} \ + --lock pycharm -- \ + EFROTOOLS_FULL_PYCHARM_RECACHE=${EFROTOOLS_FULL_PYCHARM_RECACHE} \ + make pycharm-full + +# Tell make which of these targets don't represent files. +.PHONY: check-cloud check-cloud-full check2-cloud-full pylint-cloud \ + pylint-cloud-full mypy-cloud mypy-cloud-full pycharm-cloud pycharm-cloud-full + + ################################################################################ # # # Testing # @@ -671,6 +740,26 @@ test-entity: .PHONY: test test-full test-assetmanager +################################################################################ +# # +# Testing (Internal) # +# # +################################################################################ + +# Cloud version of test +test-cloud: + @tools/cloudshell ${CLOUDSHELL_HOST_TEST} --env ${CLOUDSHELL_ENV_CHECK} -- \ + make test + +# Cloud version of test-full +test-cloud-full: + @tools/cloudshell ${CLOUDSHELL_HOST_TEST} --env ${CLOUDSHELL_ENV_CHECK} -- \ + make test-full + +# Tell make which of these targets don't represent files. +.PHONY: test-cloud test-cloud-full + + ################################################################################ # # # Preflighting # @@ -709,6 +798,56 @@ preflight2-full: .PHONY: preflight preflight-full preflight2 preflight2-full +################################################################################ +# # +# Preflighting (Internal) # +# # +################################################################################ + +# TODO: If we add the ability to sync an entire env back, we could +# simply run preflight targets in their entirety in cloudshell instead +# of splitting them up like this. + +# Run preflight in the cloud. +preflight-cloud: + @${MAKE} format + @${MAKE} update + @tools/cloudshell ${CLOUDSHELL_HOST_CHECK} --env ${CLOUDSHELL_ENV_CHECK} -- \ + make -j4 cpplint pylint mypy test + @tools/pcommand echo SGRN BLD PREFLIGHT SUCCESSFUL! + +# Run preflight-full in the cloud. +preflight-cloud-full: + @${MAKE} format-full + @${MAKE} update + @tools/cloudshell ${CLOUDSHELL_HOST_CHECK} --env ${CLOUDSHELL_ENV_CHECK} \ + -- \ + make -j4 cpplint-full pylint-full mypy-full test-full + @tools/pcommand echo SGRN BLD PREFLIGHT SUCCESSFUL! + +# Run preflight2 in the cloud. +preflight2-cloud: + @${MAKE} format + @${MAKE} update + @tools/cloudshell ${CLOUDSHELL_HOST_CHECK} --env ${CLOUDSHELL_ENV_CHECK} \ + --lock pycharm -- \ + make -j5 cpplint pylint mypy pycharm test + @tools/pcommand echo SGRN BLD PREFLIGHT SUCCESSFUL! + +# Run preflight2-full in the cloud. +preflight2-cloud-full: + @${MAKE} format-full + @${MAKE} update + @tools/cloudshell ${CLOUDSHELL_HOST_CHECK} --env ${CLOUDSHELL_ENV_CHECK} \ + --lock pycharm -- \ + make -j5 cpplint-full pylint-full mypy-full pycharm-full test-full + @tools/pcommand echo SGRN BLD PREFLIGHT SUCCESSFUL! + +# Tell make which of these targets don't represent files. +.PHONY: preflight-cloud preflight-cloud-full preflight2-cloud \ + preflight2-cloud-full + + ################################################################################ # # # CMake # diff --git a/ballisticacore-cmake/.idea/dictionaries/ericf.xml b/ballisticacore-cmake/.idea/dictionaries/ericf.xml index ee568a11..69154db7 100644 --- a/ballisticacore-cmake/.idea/dictionaries/ericf.xml +++ b/ballisticacore-cmake/.idea/dictionaries/ericf.xml @@ -13,8 +13,8 @@ ack'ed acked acks - aclass's aclass + aclass's activityplayer addrs adjoint @@ -153,8 +153,8 @@ cmath cmds cmdvals - codewarrior's codewarrior + codewarrior's cofnodes collapseable collidable @@ -833,6 +833,7 @@ subclsssing subentities subitems + subpaths subplatform subscale subscr diff --git a/docs/ba_module.md b/docs/ba_module.md index 053011d2..042ef6fe 100644 --- a/docs/ba_module.md +++ b/docs/ba_module.md @@ -1,5 +1,5 @@ -

last updated on 2020-12-22 for Ballistica version 1.5.29 build 20263

+

last updated on 2020-12-22 for Ballistica version 1.5.30 build 20264

This page documents the Python classes and functions in the 'ba' module, which are the ones most relevant to modding in Ballistica. If you come across something you feel should be included here or could be better explained, please let me know. Happy modding!


diff --git a/tools/efro/entity/__init__.py b/tools/efro/entity/__init__.py index 19a83ba4..33aea854 100644 --- a/tools/efro/entity/__init__.py +++ b/tools/efro/entity/__init__.py @@ -4,11 +4,13 @@ A system for defining structured data, supporting both static and runtime type safety, serialization, efficient/sparse storage, per-field value -limits, etc. These are heavy-weight in comparison to things such as +limits, etc. This is a heavyweight option in comparison to things such as dataclasses, but the increased features can make the overhead worth it for certain use cases. Advantages compared to nested dataclasses: +- Field names separated from their data representation so can get more + concise json data, change variable names while preserving back-compat, etc. - Can wrap and preserve unmapped data (so fields can be added to new versions of something without breaking old versions' ability to read the data) - Incorrectly typed data is caught at runtime (for dataclasses we rely on diff --git a/tools/efrotools/code.py b/tools/efrotools/code.py index c09f7169..2030c23c 100644 --- a/tools/efrotools/code.py +++ b/tools/efrotools/code.py @@ -798,31 +798,41 @@ def check_pycharm(projroot: Path, full: bool, verbose: bool) -> None: # In full mode, clear out pycharm's caches first. # It seems we need to spin up the GUI and give it a bit to # re-cache system python for this to work... + # UPDATE: This really slows things down, so we now only do it in # very specific cases where time isn't important. # (such as our daily full-test-runs) + + # UPDATE 2: Looks like we might no longer need to do the GUI spin-up bit. + # If we can be certain of this, we can go back to simply blowing away + # the cache for 'full' mode checks without the env var. if full and os.environ.get('EFROTOOLS_FULL_PYCHARM_RECACHE') == '1': print('Clearing PyCharm caches...', flush=True) - subprocess.run('rm -rf ~/Library/Caches/PyCharmCE*', + subprocess.run('rm -rf ~/Library/Caches/JetBrains/PyCharmCE*', shell=True, check=True) - print('Launching GUI PyCharm to rebuild caches...', flush=True) - process = subprocess.Popen(str(pycharmbin)) - # Wait a bit and ask it nicely to die. - # We need to make sure it has enough time to do its cache updating - # thing even if the system is fully under load. - time.sleep(5 * 60) + # Hoping this isn't necessary anymore. Need to rework this if it is, + # since it now gets run through ssh and gui stuff doesn't seem to + # work that way. + if bool(False): + print('Launching GUI PyCharm to rebuild caches...', flush=True) + process = subprocess.Popen(str(pycharmbin)) - # Seems killing it via applescript is more likely to leave it - # in a working state for offline inspections than TERM signal.. - subprocess.run( - "osascript -e 'tell application \"PyCharm CE\" to quit'", - shell=True, - check=False) - # process.terminate() - print('Waiting for GUI PyCharm to quit...', flush=True) - process.wait() + # Wait a bit and ask it nicely to die. + # We need to make sure it has enough time to do its cache updating + # thing even if the system is fully under load. + time.sleep(5 * 60) + + # Seems killing it via applescript is more likely to leave it + # in a working state for offline inspections than TERM signal.. + subprocess.run( + "osascript -e 'tell application \"PyCharm CE\" to quit'", + shell=True, + check=False) + # process.terminate() + print('Waiting for GUI PyCharm to quit...', flush=True) + process.wait() _run_idea_inspections_cached(cachepath=cachepath, filenames=filenames, diff --git a/tools/efrotools/pcommand.py b/tools/efrotools/pcommand.py index 9a6ee018..6fa6ddc7 100644 --- a/tools/efrotools/pcommand.py +++ b/tools/efrotools/pcommand.py @@ -136,8 +136,14 @@ def _spelling(words: List[str]) -> None: with open(fname, 'w') as outfile: # Sort lines in the words section. assert all(l.startswith(' ') for l in lines[3:-3]) - outfile.write('\n'.join(lines[:3] + sorted(lines[3:-3]) + - lines[-3:])) + + # Note: need to pull the off the end of the line when sorting + # or it messes with the order and we get different results than + # Jetbrains stuff. + outfile.write('\n'.join( + lines[:3] + + sorted(lines[3:-3], key=lambda x: x.replace('', '')) + + lines[-3:])) print(f'Added {added_count} words to {fname}.')