fix(tvos): copy project resource dirs into the .app bundle#4787
Merged
Conversation
bundle_for_tvos never called copy_bundle_resource_dirs, unlike the iOS, watchOS, and visionOS bundlers. The dropped comment claimed tvOS apps consume assets via the metallib / embedded JS bundle, but games read asset files (levels, sprite sheets, sounds) at runtime through bloom_read_file / bloom_load_texture, which resolve relative paths against the bundle's [[NSBundle mainBundle] resourcePath]. With no resource copy, the project assets/ directory was absent from the bundle and every asset read failed. Copy the project resource directories after staging native artifacts, the same as the other Apple targets.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
bundle_for_tvosnever copied the project's resource directories into the.app, so theassets/directory (levels, sprite sheets, sounds) was absent from every tvOS bundle. The iOS, watchOS, and visionOS bundlers all callcopy_bundle_resource_dirs; the tvOS path skipped it, with a comment claiming "tvOS apps consume assets via the metallib / embedded JS bundle."That assumption is wrong for any app that reads asset files at runtime:
bloom_read_file/bloom_load_texture(and equivalents) resolve relative paths against[[NSBundle mainBundle] resourcePath]. With nothing copied, every asset read failed — a platformer compiled for--target tvos-simulatorbooted to its title screen (procedural drawing) but loaded an empty level, becauseassets/levels/*.txtandassets/sprites/*.pngweren't in the bundle.Change
Add the same resource-copy block the other Apple targets use, right after
stage_native_library_artifacts:Validation
Rebuilt the
perrybinary and recompiled a Bloom Engine game fortvos-simulator. A clean build (rm -rf *.appfirst) now bundlesassets/levels/,assets/sprites/,assets/sounds/, etc. automatically, and the game loads and renders a real level on the Apple TV simulator (previously the level was empty).