diff --git a/.efrocachemap b/.efrocachemap index 7f10ca4b..7513517c 100644 --- a/.efrocachemap +++ b/.efrocachemap @@ -3933,6 +3933,7 @@ "assets/build/windows/Win32/ucrtbased.dll": "https://files.ballistica.net/cache/ba1/f5/8b/14895df9caf46f326a3c939b34a4", "assets/build/windows/Win32/vc_redist.x86.exe": "https://files.ballistica.net/cache/ba1/1c/e1/4a1a2eddda2f4aebd5f8b64ab08e", "assets/build/windows/Win32/vcruntime140d.dll": "https://files.ballistica.net/cache/ba1/50/8d/bc2600ac9491f1b14d659709451f", + "ballisticacore-windows/Generic/BallisticaCore.ico": "https://files.ballistica.net/cache/ba1/89/c0/e32c7d2a35dc9aef57cc73b0911a", "build/prefab/full/linux_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/6c/4a/ea20aa40a0336346481db7a3e7cc", "build/prefab/full/linux_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/74/1d/fc9e33e565475daaac80da5252f0", "build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/79/a4/151c407676751226822b7f3fea28", @@ -3976,6 +3977,5 @@ "build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/36/05/bdbffaab5039230c2fbcb7d8c878", "build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/e7/c4/324bb33d12a37d46c6a38da7a63d", "build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/2a/d8/77387d2781de3bb624538c80a2cc", - "build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/b1/51/67daef6f5638ddf3ebeb61186539", - "resources/../ballisticacore-windows/Generic/BallisticaCore.ico": "https://files.ballistica.net/cache/ba1/c8/8e/2b54b5f52bf21e27a893aeef75c9" + "build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/b1/51/67daef6f5638ddf3ebeb61186539" } \ No newline at end of file diff --git a/assets/Makefile b/assets/Makefile index 78441f0e..5ab35ecc 100644 --- a/assets/Makefile +++ b/assets/Makefile @@ -1558,7 +1558,7 @@ SCRIPT_TARGETS_PYC_PRIVATE_APPLE = \ # Rule to copy src asset scripts to dst. # (and make non-writable so I'm less likely to accidentally edit them there) $(SCRIPT_TARGETS_PY_PRIVATE_APPLE) : ../.efrocachemap - @cd .. && tools/pcommand efrocache_get resources/$@ + @cd .. && tools/pcommand efrocache_get assets/$@ # These are too complex to define in a pattern rule; # Instead we generate individual targets in a loop. @@ -2430,7 +2430,7 @@ SCRIPT_TARGETS_PYC_PRIVATE_ANDROID = \ # Rule to copy src asset scripts to dst. # (and make non-writable so I'm less likely to accidentally edit them there) $(SCRIPT_TARGETS_PY_PRIVATE_ANDROID) : ../.efrocachemap - @cd .. && tools/pcommand efrocache_get resources/$@ + @cd .. && tools/pcommand efrocache_get assets/$@ # These are too complex to define in a pattern rule; # Instead we generate individual targets in a loop. @@ -2482,7 +2482,7 @@ SCRIPT_TARGETS_PYC_PRIVATE_COMMON = \ # Rule to copy src asset scripts to dst. # (and make non-writable so I'm less likely to accidentally edit them there) $(SCRIPT_TARGETS_PY_PRIVATE_COMMON) : ../.efrocachemap - @cd .. && tools/pcommand efrocache_get resources/$@ + @cd .. && tools/pcommand efrocache_get assets/$@ # These are too complex to define in a pattern rule; # Instead we generate individual targets in a loop. @@ -3362,7 +3362,7 @@ SCRIPT_TARGETS_PYC_PRIVATE_WIN_WIN32 = \ # Rule to copy src asset scripts to dst. # (and make non-writable so I'm less likely to accidentally edit them there) $(SCRIPT_TARGETS_PY_PRIVATE_WIN_WIN32) : ../.efrocachemap - @cd .. && tools/pcommand efrocache_get resources/$@ + @cd .. && tools/pcommand efrocache_get assets/$@ # These are too complex to define in a pattern rule; # Instead we generate individual targets in a loop. @@ -4242,7 +4242,7 @@ SCRIPT_TARGETS_PYC_PRIVATE_WIN_X64 = \ # Rule to copy src asset scripts to dst. # (and make non-writable so I'm less likely to accidentally edit them there) $(SCRIPT_TARGETS_PY_PRIVATE_WIN_X64) : ../.efrocachemap - @cd .. && tools/pcommand efrocache_get resources/$@ + @cd .. && tools/pcommand efrocache_get assets/$@ # These are too complex to define in a pattern rule; # Instead we generate individual targets in a loop. @@ -6895,7 +6895,7 @@ EXTRAS_TARGETS_WIN_WIN32 = \ # Rule to copy src extras to build. $(EXTRAS_TARGETS_WIN_WIN32) : ../.efrocachemap - @cd .. && tools/pcommand efrocache_get resources/$@ + @cd .. && tools/pcommand efrocache_get assets/$@ EXTRAS_TARGETS_WIN_X64 = \ @@ -6982,53 +6982,53 @@ EXTRAS_TARGETS_WIN_X64 = \ # Rule to copy src extras to build. $(EXTRAS_TARGETS_WIN_X64) : ../.efrocachemap - @cd .. && tools/pcommand efrocache_get resources/$@ + @cd .. && tools/pcommand efrocache_get assets/$@ #__AUTOGENERATED_END_PRIVATE__ ASSET_TARGETS_COMMON += $(MODEL_TARGETS) build/%.bob : ../.efrocachemap - @cd .. && tools/pcommand efrocache_get resources/$@ + @cd .. && tools/pcommand efrocache_get assets/$@ build/%.cob : ../.efrocachemap - @cd .. && tools/pcommand efrocache_get resources/$@ + @cd .. && tools/pcommand efrocache_get assets/$@ build/%.ogg : ../.efrocachemap - @cd .. && tools/pcommand efrocache_get resources/$@ + @cd .. && tools/pcommand efrocache_get assets/$@ build/%.fdata : ../.efrocachemap - @cd .. && tools/pcommand efrocache_get resources/$@ + @cd .. && tools/pcommand efrocache_get assets/$@ # Langdata one-off json file. build/ba_data/data/langdata.json : ../.efrocachemap - @cd .. && tools/pcommand efrocache_get resources/$@ + @cd .. && tools/pcommand efrocache_get assets/$@ # Languages json files. build/ba_data/data/languages/%.json : ../.efrocachemap - @cd .. && tools/pcommand efrocache_get resources/$@ + @cd .. && tools/pcommand efrocache_get assets/$@ # Map json files. build/ba_data/data/maps/%.json : ../.efrocachemap - @cd .. && tools/pcommand efrocache_get resources/$@ + @cd .. && tools/pcommand efrocache_get assets/$@ src/ba_data/%.tex2d.png : ../.efrocachemap - @cd .. && tools/pcommand efrocache_get resources/$@ + @cd .. && tools/pcommand efrocache_get assets/$@ src/ba_data/%_+x.tex2d.png : ../.efrocachemap - @cd .. && tools/pcommand efrocache_get resources/$@ + @cd .. && tools/pcommand efrocache_get assets/$@ build/ba_data/%_preview.png : ../.efrocachemap - @cd .. && tools/pcommand efrocache_get resources/$@ + @cd .. && tools/pcommand efrocache_get assets/$@ build/%.dds : ../.efrocachemap - @cd .. && tools/pcommand efrocache_get resources/$@ + @cd .. && tools/pcommand efrocache_get assets/$@ build/%.pvr : ../.efrocachemap - @cd .. && tools/pcommand efrocache_get resources/$@ + @cd .. && tools/pcommand efrocache_get assets/$@ build/%.ktx : ../.efrocachemap - @cd .. && tools/pcommand efrocache_get resources/$@ + @cd .. && tools/pcommand efrocache_get assets/$@ audio: $(AUDIO_TARGETS) clean-audio: diff --git a/resources/Makefile b/resources/Makefile index 48dd5f61..55768ad4 100644 --- a/resources/Makefile +++ b/resources/Makefile @@ -21,7 +21,7 @@ clean-private: rm -f "../ballisticacore-windows/Generic/BallisticaCore.ico" ../ballisticacore-windows/Generic/BallisticaCore.ico : ../.efrocachemap - @cd .. && tools/pcommand efrocache_get assets/$@ + @cd .. && tools/pcommand efrocache_get resources/$@ efrocache-list: diff --git a/tools/efrotools/efrocache.py b/tools/efrotools/efrocache.py index 01c4c404..2536918b 100644 --- a/tools/efrotools/efrocache.py +++ b/tools/efrotools/efrocache.py @@ -45,10 +45,23 @@ def get_file_hash(path: str) -> str: return md5.hexdigest() +def _project_centric_path(path: str) -> str: + """Convert something like foo/../bar to simply bar.""" + projpath = f'{os.getcwd()}/' + abspath = os.path.abspath(path) + if not abspath.startswith(projpath): + raise RuntimeError( + f'Path "{path}" is not under project root "{projpath}"') + return abspath[len(projpath):] + + def get_target(path: str) -> None: """Fetch a target path from the cache, downloading if need be.""" from efro.error import CleanError from efrotools import run + + path = _project_centric_path(path) + with open(CACHE_MAP_NAME) as infile: efrocachemap = json.loads(infile.read()) if path not in efrocachemap: @@ -186,7 +199,7 @@ def update_cache(makefile_dirs: List[str]) -> None: # Break these into 2 lists, one of which will be included in the # starter-cache. for rawpath in rawpaths: - fullpath = os.path.join(path, rawpath) + fullpath = _project_centric_path(os.path.join(path, rawpath)) # The main reason for this cache is to reduce round trips to # the staging server for tiny files, so let's include small files