From 503b802fafe13951e64dba6c0ec0f1404defdd5c Mon Sep 17 00:00:00 2001 From: Eric Date: Tue, 6 Jun 2023 10:39:43 -0700 Subject: [PATCH] cleaning up dummymodule generation --- .efrocachemap | 32 ++--- .idea/dictionaries/ericf.xml | 5 + Makefile | 112 +++++------------- .../.idea/dictionaries/ericf.xml | 5 + src/assets/ba_data/python/babase/_app.py | 1 - .../ba_data/python/babase/_appsubsystem.py | 2 +- src/assets/ba_data/python/babase/_asyncio.py | 1 - src/assets/ba_data/python/babase/_hooks.py | 4 +- src/assets/ba_data/python/babase/_net.py | 1 - tools/batools/build.py | 50 ++++++-- tools/batools/dummymodule.py | 4 +- tools/batools/pcommand.py | 4 +- tools/batools/toplevelmakefile.py | 23 ++-- tools/efrotools/lazybuild.py | 7 -- 14 files changed, 117 insertions(+), 134 deletions(-) diff --git a/.efrocachemap b/.efrocachemap index 89a6ee07..5a8997ed 100644 --- a/.efrocachemap +++ b/.efrocachemap @@ -4080,18 +4080,18 @@ "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/7b/c1/2dfb7c5fc6a31dd4ac4be9ef69bb", "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/af/9b/8de9876d0e3db5ccc49ce80c8e2a", "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/16/63/7bedf858ae0dc1e91acf76c1cbd6", - "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/76/d8/e2d3ae9228e1dd7b8fdbfcb676e0", + "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/b9/94/14e96f6497e7d79148194ee6a7cb", "build/prefab/full/mac_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/cc/d0/f0c1c32c948f5349e91071107d9a", - "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/51/2c/23125061df4f8d2c62bac5787979", + "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/4c/2e/475331e7531640a05e43b4a08120", "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/fc/34/1623d3a8d0ff13a71f819300c091", - "build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/dd/8d/c73ee71bfd88d0af120ff17d551b", + "build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/fb/bd/4395fa6dc06f077fe0cc5c5b4be1", "build/prefab/full/mac_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/84/38/e6f2c8c7607161c76e7c2d65ffd1", - "build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/7b/ea/d4b485f9f702619046631f74fcc2", + "build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/18/4a/3df0a4f45e6aeb92341194b3405c", "build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/08/dd/98f18c4d39850dafbf3efdfbc305", - "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/bb/dc/546b55bf1e7cfa297dbc74f3b335", - "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/83/8a/bb8485797aae51bca7edcf62dc96", - "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/d1/2d/9850c8bc21b31c627386fa44c96a", - "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/b4/fb/efce666ea6a479f1310d9aa27300", + "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/14/b1/12cff0cf6314c5476e6c7f6920a5", + "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/75/c7/48d7c37f280b875e398cb340f533", + "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/07/ea/fc994e8da3d8eb2d397a84e0c375", + "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/0f/08/4c5d8367112ee73bc9d239e2b05a", "build/prefab/lib/linux_arm64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/98/32/43c61f1e11520f764158cf0e76d2", "build/prefab/lib/linux_arm64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/ca/65/cba463f21a8f76c5bbfe27cae124", "build/prefab/lib/linux_arm64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/73/20/119211f1700bb5a410cedf4e76f2", @@ -4108,14 +4108,14 @@ "build/prefab/lib/mac_x86_64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/90/9b/94f733c3a48691e02240e04dc792", "build/prefab/lib/mac_x86_64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/2e/c7/873af48627997b6fab4b2c4ba6bc", "build/prefab/lib/mac_x86_64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/3a/94/4780fada10f0fc3f43a54f29c86f", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/e5/c9/1fafb53497e7d4ff19ecddc31d09", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/98/26/04e281a4cfa6a334abcb7e79dcbe", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/46/8b/eaee1191df159ad37a437429bbd9", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/82/fc/bbd1be0784b9d4ad46aa7da5dc24", - "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/c7/e7/a74ee82202fb7ae828f5066d1c79", - "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/f5/c3/eac894e0bfaacf4ec4740d54869d", - "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/d1/9f/f5e35440c800af9f002c795a2814", - "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/ff/fc/b6ff2a5bf8c73e1a5fa987944548", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/4f/69/a8254d42f8347e4951fc479a1d39", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/49/1a/d361e1f0f1d0d8f68fb2b3f8e2f5", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/33/34/524165a684cc56828dc7cb1be254", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/45/9c/def4dc35037b5da3b43a85473cda", + "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/6e/8b/60bbd66f58dd133af1904420905d", + "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/e8/dd/0ed0c7ef302308d47c2e898f46f9", + "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/5c/13/53ebf825ed88053908d7952359f0", + "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/c1/e4/c1a3657c0e255d5e348436b374c7", "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/4e/07/87dd93e7ef29b8b78d0b4791d6f8", diff --git a/.idea/dictionaries/ericf.xml b/.idea/dictionaries/ericf.xml index b9eb3330..531bd1c9 100644 --- a/.idea/dictionaries/ericf.xml +++ b/.idea/dictionaries/ericf.xml @@ -113,6 +113,7 @@ appengine appiconset appid + appintent appintentsmetadataprocessor appinvite appkit @@ -121,12 +122,14 @@ appletvos appletvsimulator appmode + appmodeselector appname appnameupper appnow appspot appstate appstore + appsubsystem apptime apptimer apptimers @@ -1546,6 +1549,7 @@ libxm libxmu libxz + lifecyclelog linbeast lindex lindexorig @@ -1740,6 +1744,7 @@ modders modename modestr + modetype modeval modpack modstr diff --git a/Makefile b/Makefile index 2a4a64ed..05cbddd1 100644 --- a/Makefile +++ b/Makefile @@ -150,8 +150,10 @@ clean-list: # Build/update dummy python modules. # IMPORTANT - building this target can kick off full builds/cleans and so # it should not be built in parallel with other targets. -# See py_check_prepass target for more info. -dummymodules: build/dummymodules/.dummy_modules_state +# See py_check_prereqs target for more info. +dummymodules: prereqs meta + @tools/pcommand lazybuild dummymodules_src $(LAZYBUILDDIR)/$@ \ + rm -rf build/dummymodules \&\& ./tools/pcommand gen_dummy_modules dummymodules-clean: rm -rf build/dummymodules @@ -698,7 +700,7 @@ format-makefile: prereqs ################################################################################ # Run all project checks. (static analysis) -check: py_check_prepass +check: py_check_prereqs # TEMP - disabling some checks during 1.7.20 refactor. @$(DMAKE) -j$(CPUS) update-check cpplint mypy @tools/pcommand echo SGRN BLD ALL CHECKS PASSED! @@ -706,7 +708,7 @@ check: py_check_prepass # @tools/pcommand echo SGRN BLD ALL CHECKS PASSED! # Same as check but no caching (all files are checked). -check-full: py_check_prepass +check-full: py_check_prereqs # TEMP - disabling some checks during 1.7.20 refactor. @$(DMAKE) -j$(CPUS) update-check cpplint-full mypy-full @tools/pcommand echo SGRN BLD ALL CHECKS PASSED! @@ -714,7 +716,7 @@ check-full: py_check_prepass # @tools/pcommand echo SGRN BLD ALL CHECKS PASSED! # Same as 'check' plus optional/slow extra checks. -check2: py_check_prepass +check2: py_check_prereqs # TEMP - disabling some during 1.7.20 refactor. @$(DMAKE) -j$(CPUS) update-check cpplint mypy @tools/pcommand echo SGRN BLD ALL CHECKS PASSED! @@ -723,7 +725,7 @@ check2: py_check_prepass # Same as check2 but no caching (all files are checked). # TEMP - disabling some checks during 1.7.20 refactor. -check2-full: py_check_prepass +check2-full: py_check_prereqs @$(DMAKE) -j$(CPUS) update-check cpplint-full mypy-full @tools/pcommand echo SGRN BLD ALL CHECKS PASSED! # @$(DMAKE) -j$(CPUS) update-check cpplint-full pylint-full mypy-full \ @@ -739,45 +741,42 @@ cpplint-full: prereqs meta @tools/pcommand cpplint -full # Run Pylint checks on all Python Code. -pylint: py_check_prepass +pylint: py_check_prereqs @tools/pcommand pylint # Run Pylint checks without caching (all files are checked). -pylint-full: py_check_prepass +pylint-full: py_check_prereqs @tools/pcommand pylint -full # Run Mypy checks on all Python code. -mypy: py_check_prepass +mypy: py_check_prereqs @tools/pcommand mypy # Run Mypy checks without caching (all files are checked). -mypy-full: py_check_prepass +mypy-full: py_check_prereqs @tools/pcommand mypy -full # Run Mypy checks on all Python code using daemon mode. -dmypy: py_check_prepass +dmypy: py_check_prereqs @tools/pcommand dmypy # Stop the mypy daemon -dmypy-stop: py_check_prepass +dmypy-stop: py_check_prereqs @tools/pcommand dmypy -stop # Run PyCharm checks on all Python code. -pycharm: py_check_prepass +pycharm: py_check_prereqs @tools/pcommand pycharm # Run PyCharm checks without caching (all files are checked). -pycharm-full: py_check_prepass +pycharm-full: py_check_prereqs @tools/pcommand pycharm -full # Run extra mypy checks with various dependency permutations. # ensures packages don't depend on thing they're not supposed to. -depchecks: py_check_prepass +depchecks: py_check_prereqs @tools/pcommand depchecks -featuresettest: py_check_prepass - echo WOULD DO FS - # Build prerequisites needed for python checks. # # IMPORTANT - this target may kick off new meta/asset/binary builds/cleans as @@ -790,63 +789,12 @@ featuresettest: py_check_prepass # others (such as by the 'check-full' target) the parent target should # explicitly built this beforehand to ensure it does not happen during the # parallel part. -# Note to self: Originally prereqs and meta were listed as deps of -# .dummy_modules_state, but because prereqs has no output dependencies -# it always fires which meant dummy modules would get rebuilt every run. -# This config should do the right thing without violating the above rules. -py_check_prepass: prereqs meta - @$(MAKE) dummymodules - -# The following section is auto-generated; do not edit by hand. -# __AUTOGENERATED_DUMMY_MODULES_BEGIN__ - -# Update dummy Python modules when source files contributing to them change. -build/dummymodules/.dummy_modules_state: \ - src/ballistica/base/python/class/python_class_app_timer.cc \ - src/ballistica/base/python/class/python_class_context_call.cc \ - src/ballistica/base/python/class/python_class_context_ref.cc \ - src/ballistica/base/python/class/python_class_display_timer.cc \ - src/ballistica/base/python/class/python_class_feature_set_data.cc \ - src/ballistica/base/python/class/python_class_simple_sound.cc \ - src/ballistica/base/python/class/python_class_vec3.cc \ - src/ballistica/base/python/methods/python_methods_app.cc \ - src/ballistica/base/python/methods/python_methods_graphics.cc \ - src/ballistica/base/python/methods/python_methods_misc.cc \ - src/ballistica/classic/python/methods/python_methods_classic.cc \ - src/ballistica/scene_v1/python/class/python_class_activity_data.cc \ - src/ballistica/scene_v1/python/class/python_class_base_timer.cc \ - src/ballistica/scene_v1/python/class/python_class_input_device.cc \ - src/ballistica/scene_v1/python/class/python_class_material.cc \ - src/ballistica/scene_v1/python/class/python_class_node.cc \ - src/ballistica/scene_v1/python/class/python_class_scene_collision_mesh.cc \ - src/ballistica/scene_v1/python/class/python_class_scene_data_asset.cc \ - src/ballistica/scene_v1/python/class/python_class_scene_mesh.cc \ - src/ballistica/scene_v1/python/class/python_class_scene_sound.cc \ - src/ballistica/scene_v1/python/class/python_class_scene_texture.cc \ - src/ballistica/scene_v1/python/class/python_class_scene_timer.cc \ - src/ballistica/scene_v1/python/class/python_class_session_data.cc \ - src/ballistica/scene_v1/python/class/python_class_session_player.cc \ - src/ballistica/scene_v1/python/methods/python_methods_assets.cc \ - src/ballistica/scene_v1/python/methods/python_methods_input.cc \ - src/ballistica/scene_v1/python/methods/python_methods_networking.cc \ - src/ballistica/scene_v1/python/methods/python_methods_scene.cc \ - src/ballistica/template_fs/python/class/python_class_hello.cc \ - src/ballistica/template_fs/python/methods/python_methods_template_fs.cc \ - src/ballistica/ui_v1/python/class/python_class_ui_mesh.cc \ - src/ballistica/ui_v1/python/class/python_class_ui_sound.cc \ - src/ballistica/ui_v1/python/class/python_class_ui_texture.cc \ - src/ballistica/ui_v1/python/class/python_class_widget.cc \ - src/ballistica/ui_v1/python/methods/python_methods_ui_v1.cc - @tools/pcommand with_build_lock gen_dummy_modules_lock \ - rm -rf build/dummymodules \&\& mkdir -p build/dummymodules \ - \&\& ./tools/pcommand gen_dummy_modules \ - \&\& touch build/dummymodules/.dummy_modules_state -# __AUTOGENERATED_DUMMY_MODULES_END__ +py_check_prereqs: dummymodules # Tell make which of these targets don't represent files. .PHONY: check check-full check2 check2-full \ cpplint cpplint-full pylint pylint-full mypy \ - mypy-full dmypy dmypy-stop pycharm pycharm-full py_check_prepass + mypy-full dmypy dmypy-stop pycharm pycharm-full py_check_prereqs ################################################################################ @@ -864,39 +812,35 @@ build/dummymodules/.dummy_modules_state: \ TEST_TARGET ?= tests # Run all tests. (live execution verification) -test: py_check_prepass +test: py_check_prereqs @tools/pcommand echo BLU Running all tests... @tools/pcommand pytest -v $(TEST_TARGET) -test-verbose: py_check_prepass +test-verbose: py_check_prereqs @tools/pcommand echo BLU Running all tests... - @tools/pcommand pytest -o log_cli=true -o log_cli_level=debug -s -vv $(TEST_TARGET) + @tools/pcommand pytest -o log_cli=true -o log_cli_level=debug \ + -s -vv $(TEST_TARGET) # Run tests with any caching disabled. test-full: test -# Individual test with extra output enabled. -test-assetmanager: - @tools/pcommand pytest -o log_cli=true -o log_cli_level=debug -s -vv \ - tests/test_babase/test_assetmanager.py::test_assetmanager - -# Individual test with extra output enabled. +# Shortcut to test efro.message only. test-message: @tools/pcommand pytest -o log_cli=true -o log_cli_level=debug -s -vv \ tests/test_efro/test_message.py -# Individual test with extra output enabled. +# Shortcut to test efro.dataclassio only. test-dataclassio: - @tools/pcommand pytest -o log_cli=true -o log_cli_level=debug -s -vv \ + @tools/pcommand pytest -o log_cli=true -o log_cli_level=debug -s -vv \ tests/test_efro/test_dataclassio.py -# Individual test with extra output enabled. +# Shortcut to test efro.rpc only. test-rpc: @tools/pcommand pytest -o log_cli=true -o log_cli_level=debug -s -vv \ tests/test_efro/test_rpc.py # Tell make which of these targets don't represent files. -.PHONY: test test-full test-assetmanager +.PHONY: test test-verbose test-full test-message test-dataclassio test-rpc ################################################################################ diff --git a/ballisticakit-cmake/.idea/dictionaries/ericf.xml b/ballisticakit-cmake/.idea/dictionaries/ericf.xml index e61ef3f1..260f3713 100644 --- a/ballisticakit-cmake/.idea/dictionaries/ericf.xml +++ b/ballisticakit-cmake/.idea/dictionaries/ericf.xml @@ -75,15 +75,18 @@ apost appcomponent appconfig + appintent appintentsmetadataprocessor appletvos appletvsimulator appmode + appmodeselector appname appnameupper appnow appspot appstate + appsubsystem apptime apptimer apptimers @@ -886,6 +889,7 @@ libbzip libutf libuuid + lifecyclelog lightshad linearsize linearstep @@ -994,6 +998,7 @@ modder modders modelview + modetype modstr modtime moduletype diff --git a/src/assets/ba_data/python/babase/_app.py b/src/assets/ba_data/python/babase/_app.py index 99308cd3..b476cf48 100644 --- a/src/assets/ba_data/python/babase/_app.py +++ b/src/assets/ba_data/python/babase/_app.py @@ -25,7 +25,6 @@ if TYPE_CHECKING: from typing import Any, Callable from concurrent.futures import Future - from efro.log import LogHandler import babase from babase import AppIntent, AppMode, AppSubsystem from babase._apputils import AppHealthMonitor diff --git a/src/assets/ba_data/python/babase/_appsubsystem.py b/src/assets/ba_data/python/babase/_appsubsystem.py index 4a5a4c2c..311bb2be 100644 --- a/src/assets/ba_data/python/babase/_appsubsystem.py +++ b/src/assets/ba_data/python/babase/_appsubsystem.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import _babase if TYPE_CHECKING: - from babase._app import App + pass class AppSubsystem: diff --git a/src/assets/ba_data/python/babase/_asyncio.py b/src/assets/ba_data/python/babase/_asyncio.py index 2a3e642a..591bfae3 100644 --- a/src/assets/ba_data/python/babase/_asyncio.py +++ b/src/assets/ba_data/python/babase/_asyncio.py @@ -31,7 +31,6 @@ def setup_asyncio() -> asyncio.AbstractEventLoop: import _babase import babase - from babase._mgen.enums import TimeType assert _babase.in_logic_thread() diff --git a/src/assets/ba_data/python/babase/_hooks.py b/src/assets/ba_data/python/babase/_hooks.py index b2890380..2062ecb7 100644 --- a/src/assets/ba_data/python/babase/_hooks.py +++ b/src/assets/ba_data/python/babase/_hooks.py @@ -20,9 +20,7 @@ from typing import TYPE_CHECKING import _babase if TYPE_CHECKING: - from typing import Sequence, Any - - import babase + pass def on_app_bootstrapping_complete() -> None: diff --git a/src/assets/ba_data/python/babase/_net.py b/src/assets/ba_data/python/babase/_net.py index 64774d52..a02e3c31 100644 --- a/src/assets/ba_data/python/babase/_net.py +++ b/src/assets/ba_data/python/babase/_net.py @@ -8,7 +8,6 @@ import threading from typing import TYPE_CHECKING if TYPE_CHECKING: - from typing import Any, Callable import socket # Timeout for standard functions talking to the master-server/etc. diff --git a/tools/batools/build.py b/tools/batools/build.py index f5c17a9f..58d1998b 100644 --- a/tools/batools/build.py +++ b/tools/batools/build.py @@ -103,12 +103,13 @@ class LazyBuildCategory(Enum): META = 'meta_src' CMAKE = 'cmake_src' WIN = 'win_src' + DUMMYMODULES = 'dummymodules_src' def lazybuild(target: str, category: LazyBuildCategory, command: str) -> None: """Run some lazybuild presets.""" - # Everything possibly affecting meta builds. + # Meta builds. if category is LazyBuildCategory.META: LazyBuildContext( target=target, @@ -135,14 +136,14 @@ def lazybuild(target: str, category: LazyBuildCategory, command: str) -> None: 'tools/batoolsinternal', 'config/featuresets', ], - # Also enable an option to maintain a hash of all file paths - # in the above sets and do a full-clean whenever that changes. - # Takes care of orphaned files if remove a featureset/etc. - manifest_file='.cache/lazybuild/meta_manifest', + # Maintain a hash of all srcpaths and do a full-clean + # whenever that changes. Takes care of orphaned files if a + # featureset is removed/etc. + manifest_file=f'.cache/lazybuild/manifest_{category.value}', command_fullclean='make meta-clean', ).run() - # Everything possibly affecting CMake builds. + # CMake builds. elif category is LazyBuildCategory.CMAKE: LazyBuildContext( target=target, @@ -165,7 +166,7 @@ def lazybuild(target: str, category: LazyBuildCategory, command: str) -> None: command=command, ).run() - # Everything possibly affecting Windows binary builds. + # Windows binary builds. elif category is LazyBuildCategory.WIN: def _win_dirfilter(root: str, dirname: str) -> bool: @@ -192,7 +193,7 @@ def lazybuild(target: str, category: LazyBuildCategory, command: str) -> None: command=command, ).run() - # Everything possibly affecting resource builds. + # Resource builds. elif category is LazyBuildCategory.RESOURCES: LazyBuildContext( target=target, @@ -208,7 +209,7 @@ def lazybuild(target: str, category: LazyBuildCategory, command: str) -> None: command=command, ).run() - # Everything possibly affecting asset builds. + # Asset builds. elif category is LazyBuildCategory.ASSETS: def _filefilter(root: str, filename: str) -> bool: @@ -234,6 +235,37 @@ def lazybuild(target: str, category: LazyBuildCategory, command: str) -> None: filefilter=_filefilter, ).run() + # Dummymodule builds. + elif category is LazyBuildCategory.DUMMYMODULES: + + def _filefilter(root: str, filename: str) -> bool: + # In our C++ sources, only look at stuff with 'python' in the + # name. + if root.startswith('ballistica'): + return 'python' in filename + + # In other srcpaths use everything. + return True + + LazyBuildContext( + target=target, + # This category builds binaries and other crazy stuff + # so we definitely want to restrict to one at a time. + buildlockname=category.value, + srcpaths=[ + 'config/featuresets', + 'tools/batools/dummymodule.py', + 'src/ballistica', + ], + command=command, + filefilter=_filefilter, + # Maintain a hash of all srcpaths and do a full-clean + # whenever that changes. Takes care of orphaned files if a + # featureset is removed/etc. + manifest_file=f'.cache/lazybuild/manifest_{category.value}', + command_fullclean='make dummymodules-clean', + ).run() + else: assert_never(category) diff --git a/tools/batools/dummymodule.py b/tools/batools/dummymodule.py index 005cb581..1b080138 100755 --- a/tools/batools/dummymodule.py +++ b/tools/batools/dummymodule.py @@ -886,7 +886,7 @@ class Generator: outfile.write(out) -def generate(projroot: str) -> None: +def generate_dummy_modules(projroot: str) -> None: """Generate all dummy-modules.""" from batools.featureset import FeatureSet @@ -970,6 +970,8 @@ def generate(projroot: str) -> None: featuresets = [f for f in featuresets if f.has_native_python_module] mnames: list[str] = [fs.name_python_binary_module for fs in featuresets] + os.makedirs('build/dummymodules', exist_ok=True) + gencount = 0 for mname in mnames: gencount += 1 diff --git a/tools/batools/pcommand.py b/tools/batools/pcommand.py index b5be8920..2e17e5ec 100644 --- a/tools/batools/pcommand.py +++ b/tools/batools/pcommand.py @@ -979,12 +979,12 @@ def gen_python_init_module() -> None: def gen_dummy_modules() -> None: """Generate all dummy modules.""" from efro.error import CleanError - from batools.dummymodule import generate + from batools.dummymodule import generate_dummy_modules if len(sys.argv) != 2: raise CleanError(f'Expected no args; got {len(sys.argv)-2}.') - generate(projroot=str(PROJROOT)) + generate_dummy_modules(projroot=str(PROJROOT)) def version() -> None: diff --git a/tools/batools/toplevelmakefile.py b/tools/batools/toplevelmakefile.py index 9e72458b..48c68421 100755 --- a/tools/batools/toplevelmakefile.py +++ b/tools/batools/toplevelmakefile.py @@ -21,17 +21,24 @@ def generate_top_level_makefile(projroot: str, existing_data: str) -> str: assert isinstance(public, bool) original = existing_data - lines = original.splitlines() - auto_start = lines.index('# __AUTOGENERATED_DUMMY_MODULES_BEGIN__') - auto_end = lines.index('# __AUTOGENERATED_DUMMY_MODULES_END__') + # NOTE: no longer doing this; our dummy module generation stuff is + # now a nice static lazybuild target. Can remove this whole file + # soon if no other uses for it come up. + if bool(False): + lines = original.splitlines() - our_lines = [ - _get_dummy_module_target(projroot), - ] + auto_start = lines.index('# __AUTOGENERATED_DUMMY_MODULES_BEGIN__') + auto_end = lines.index('# __AUTOGENERATED_DUMMY_MODULES_END__') - filtered = lines[: auto_start + 1] + our_lines + lines[auto_end:] - out = '\n'.join(filtered) + '\n' + our_lines = [ + _get_dummy_module_target(projroot), + ] + + filtered = lines[: auto_start + 1] + our_lines + lines[auto_end:] + out = '\n'.join(filtered) + '\n' + else: + out = original return out diff --git a/tools/efrotools/lazybuild.py b/tools/efrotools/lazybuild.py index 971c4912..fbdc8f49 100644 --- a/tools/efrotools/lazybuild.py +++ b/tools/efrotools/lazybuild.py @@ -86,13 +86,6 @@ class LazyBuildContext: # as dependency relationships in a Makefile. self.srcpaths_fullclean = srcpaths_fullclean self.command_fullclean = command_fullclean - if (self.srcpaths_fullclean is None) != ( - self.command_fullclean is None - ): - raise RuntimeError( - 'Must provide both srcpaths_fullclean and' - ' command_fullclean together' - ) # We also support a 'manifest' file which is a hash of all filenames # processed as part of srcpaths OR srcpaths_fullclean. If defined,