-
-
Notifications
You must be signed in to change notification settings - Fork 23.7k
Filter out metadata of excluded files on export #111294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
6c62e9a to
b538f9f
Compare
KoBeWi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR looks fine overall. Might need some more testing, but I verified that it works as expected.
I'm not sure if searching the list of all files multiple times is a good idea, but I didn't test if it visibly impacts export time.
| } | ||
|
|
||
| Vector<String> forced_export = get_forced_export_files(p_preset); | ||
| for (int i = 0; i < forced_export.size(); i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be changed to a range loop.
| // Same binary format as in ResourceUID::save_to_cache(): | ||
| Ref<StreamPeerBuffer> buffer; | ||
| buffer.instantiate(); | ||
| buffer->put_u32(valid_entries.size()); | ||
|
|
||
| for (const Pair<ResourceUID::ID, String> &entry : valid_entries) { | ||
| buffer->put_u64(uint64_t(entry.first)); | ||
| CharString cs = entry.second.utf8(); | ||
| buffer->put_u32(cs.length()); | ||
| buffer->put_data((const uint8_t *)cs.ptr(), cs.length()); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice if this code wasn't duplicated.
| Ref<ConfigFile> cf; | ||
| cf.instantiate(); | ||
| if (cf->load(p_cache_path) != OK) { | ||
| return Vector<uint8_t>(); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be fetched from ScriptServer, although it's more code duplication or refactoring, so I think it's fine for now.
| for (const Variant &item : original_list) { | ||
| const Dictionary class_dict = item; | ||
| ERR_CONTINUE(!class_dict.has("path")); | ||
| if (p_paths.has(class_dict["path"])) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just realized that p_paths can be super big (it contains all files in the project), and now we'll have 3 methods that search it multiple times. It can be done much more efficiently, by iterating the path list and adding to filtered array if the corresponding cache has the entry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean to load extension list and global class cache in advance and create all three filtered cache files in a single loop over the paths?
To think about it, do we even need to put paths to those cache files into the intermediate "forced export" array? I can remove them from get_forced_export_files and check directly in the main export_project_files method, right?
| if (filtered_list.size() == original_list.size()) { | ||
| return FileAccess::get_file_as_bytes(p_cache_path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if reading the file again is better than encoding it from memory. You already have the data, comparing it with the original is unnecessary.
Closes godotengine/godot-proposals#12701
Excludes metadata of excluded files from pck. Generates the UID cache for exported files instead of force-exporting the entire
uid_cache.binand filters the contents ofglobal_script_class_cache.cfgExample project: exportfilter.zip
Export config:
Occurences of "unreleased" in pck:
40