port_harness: horizon-prepare writes the data generator's reports into the candidate, not through regen's link to the version store
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -51,6 +51,20 @@ class ClassifyTests(unittest.TestCase):
|
||||
|
||||
|
||||
class AssetTests(unittest.TestCase):
|
||||
def test_the_reports_link_goes_before_horizon_prepare(self):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
root, store = Path(tmp) / "candidate", Path(tmp) / "store-reports"
|
||||
(store / "minecraft").mkdir(parents=True)
|
||||
reports = root / ".local" / "datagen" / "out" / "reports"
|
||||
reports.parent.mkdir(parents=True)
|
||||
reports.symlink_to(store)
|
||||
harness.own_reports(root)
|
||||
self.assertFalse(reports.exists() or reports.is_symlink())
|
||||
self.assertTrue((store / "minecraft").is_dir())
|
||||
reports.mkdir() # its own reports, from an earlier horizon-prepare, stay
|
||||
harness.own_reports(root)
|
||||
self.assertTrue(reports.is_dir())
|
||||
|
||||
def test_sounds_and_panorama_only(self):
|
||||
self.assertTrue(harness.wanted_asset("minecraft/sounds.json"))
|
||||
self.assertTrue(harness.wanted_asset("minecraft/sounds/mob/cow/say1.ogg"))
|
||||
|
||||
@@ -56,8 +56,18 @@ def launcher_assets(tree, manifest, jobs=8):
|
||||
return len(hashes)
|
||||
|
||||
|
||||
def own_reports(root):
|
||||
"""Replace the candidate's link to the store's data generator reports (regen reads them) by nothing:
|
||||
horizon-prepare runs the data generator itself, and it must write into the candidate, not through the link
|
||||
into the version store (the generator also deletes the link as stale)."""
|
||||
reports = root / ".local" / "datagen" / "out" / "reports"
|
||||
if reports.is_symlink():
|
||||
reports.unlink()
|
||||
|
||||
|
||||
def prepare_resources(root, version, store):
|
||||
"""horizon-prepare against the candidate's version: {status: ok | failed, error, compile_errors}."""
|
||||
own_reports(root)
|
||||
log = root / ".local" / "port-regen" / "horizon-prepare.log"
|
||||
log.parent.mkdir(parents=True, exist_ok=True)
|
||||
env = dict(os.environ, CARGO_TARGET_DIR=str(root / ".local" / "port-target"))
|
||||
|
||||
Reference in New Issue
Block a user