mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-16 18:09:58 -04:00
Keep the processor's level on an update over 0.5.0's leftovers, let Rebuild the Game retune, and lift again after the build cache was dropped.
An update decided the lifted code was 0.5.0's generic build from any old-format entry in objects.json, and 0.5.0's runtime objects stay there for good, so 0.5.0 to 0.6.0 to 0.6.1 recompiled the whole game for generic x86-64. Only the lifted objects' entries decide now, and entries of objects a build no longer makes are dropped. Rebuild the Game could not undo it: the compile step's key names no level, so the step read as done before; it now runs when the recorded level is not this processor's. With Keep Build Cache off the lift is deleted but its key still matched, and the next compile found nothing to compile: the lift runs again when the compile step will. The two reads of the compiler's version no longer fail on bytes outside the system's code page. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -1716,11 +1716,29 @@ class MakeGameTest(Tmp):
|
||||
self.assertEqual(self.mg.lifted_level(obj, 3, update=True), 3) # nothing recorded, no old cache
|
||||
(obj / 'objects.json').write_text(json.dumps({'main_main_0000.o': {'key': 'k', 'deps': {'a.c': 'ab'}}}))
|
||||
self.assertEqual(self.mg.lifted_level(obj, 3, update=True), 0) # 0.5.0's cache: compiled for no level
|
||||
# 0.5.0's runtime objects left in a cache whose lifted code a later version compiled: not an old cache
|
||||
(obj / 'objects.json').write_text(json.dumps({
|
||||
'main_main_0000.o': {'key': 'k', 'deps': {'a.c': ['ab', 1, 2]}}, 'rt_amiibo.o': {'key': 'k', 'deps': {'b.c': 'cd'}}}))
|
||||
self.assertEqual(self.mg.lifted_level(obj, 3, update=True), 3)
|
||||
cache = self.mg.ObjectCache(obj / 'objects.json')
|
||||
self.assertEqual(cache.keep_only({'main_main_0000.o'}), 1) # what this build no longer makes
|
||||
self.assertEqual(list(cache.entries), ['main_main_0000.o'])
|
||||
(obj / 'objects.json').write_text(json.dumps({'main_main_0000.o': {'key': 'k', 'deps': {'a.c': 'ab'}}}))
|
||||
(obj / self.mg.LIFTED_BUILD).write_text(json.dumps({'level': 2}))
|
||||
self.assertEqual(self.mg.lifted_level(obj, 3, update=True), 2) # as recorded
|
||||
self.assertEqual(self.mg.lifted_level(obj, 1, update=True), 1) # never above this processor's
|
||||
self.assertEqual(self.mg.lifted_level(obj, 3, update=False), 3)
|
||||
|
||||
def test_retune_due_when_the_level_differs(self):
|
||||
obj = self.tmp / 'obj'
|
||||
obj.mkdir()
|
||||
with mock.patch.object(self.mg, 'cpu_level', lambda clang, env: 3), mock.patch.object(self.mg, 'toolchain', lambda msys: (None, None, {}, None)):
|
||||
self.assertTrue(self.mg.retune_due(obj, None)) # nothing recorded
|
||||
(obj / self.mg.LIFTED_BUILD).write_text(json.dumps({'level': 0}))
|
||||
self.assertTrue(self.mg.retune_due(obj, None)) # generic objects on a v3 processor
|
||||
(obj / self.mg.LIFTED_BUILD).write_text(json.dumps({'level': 3}))
|
||||
self.assertFalse(self.mg.retune_due(obj, None))
|
||||
|
||||
def test_updates_skip_shader_preparation(self):
|
||||
"""An update leaves the shaders to the game (shader_carry) only when they were prepared and the cache names the
|
||||
translator they were made with: without that the game has nothing to carry them over by."""
|
||||
|
||||
Reference in New Issue
Block a user