Skip to content

Commit 1f0f810

Browse files
committed
Merge pull request godotengine#90476 from mihe/revert-pack-trimming
Revert pack trimming introduced by godotengine#82084
2 parents 5d4507b + a057158 commit 1f0f810

File tree

8 files changed

+37
-59
lines changed

8 files changed

+37
-59
lines changed

editor/debugger/editor_file_server.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ void EditorFileServer::poll() {
201201
// Scan files to send.
202202
_scan_files_changed(EditorFileSystem::get_singleton()->get_filesystem(), tags, files_to_send, cached_files);
203203
// Add forced export files
204-
Vector<String> forced_export = EditorExportPlatform::get_main_pack_forced_export_files();
204+
Vector<String> forced_export = EditorExportPlatform::get_forced_export_files();
205205
for (int i = 0; i < forced_export.size(); i++) {
206206
_add_custom_file(forced_export[i], files_to_send, cached_files);
207207
}

editor/export/editor_export_platform.cpp

Lines changed: 25 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -864,19 +864,23 @@ String EditorExportPlatform::_get_script_encryption_key(const Ref<EditorExportPr
864864
return p_preset->get_script_encryption_key().to_lower();
865865
}
866866

867-
Vector<String> EditorExportPlatform::get_main_pack_forced_export_files() {
868-
// First, get files required by any PCK.
869-
Vector<String> files = get_forced_export_files();
867+
Vector<String> EditorExportPlatform::get_forced_export_files() {
868+
Vector<String> files;
869+
870+
files.push_back(ProjectSettings::get_singleton()->get_global_class_list_path());
870871

871872
String icon = GLOBAL_GET("application/config/icon");
873+
String splash = GLOBAL_GET("application/boot_splash/image");
872874
if (!icon.is_empty() && FileAccess::exists(icon)) {
873875
files.push_back(icon);
874876
}
875-
876-
String splash = GLOBAL_GET("application/boot_splash/image");
877-
if (!splash.is_empty() && icon != splash && FileAccess::exists(splash)) {
877+
if (!splash.is_empty() && FileAccess::exists(splash) && icon != splash) {
878878
files.push_back(splash);
879879
}
880+
String resource_cache_file = ResourceUID::get_cache_file();
881+
if (FileAccess::exists(resource_cache_file)) {
882+
files.push_back(resource_cache_file);
883+
}
880884

881885
String extension_list_config_file = GDExtension::get_extension_list_config_file();
882886
if (FileAccess::exists(extension_list_config_file)) {
@@ -909,19 +913,7 @@ Vector<String> EditorExportPlatform::get_main_pack_forced_export_files() {
909913
return files;
910914
}
911915

912-
Vector<String> EditorExportPlatform::get_forced_export_files() {
913-
Vector<String> files;
914-
files.push_back(ProjectSettings::get_singleton()->get_global_class_list_path());
915-
916-
String resource_cache_file = ResourceUID::get_cache_file();
917-
if (FileAccess::exists(resource_cache_file)) {
918-
files.push_back(resource_cache_file);
919-
}
920-
921-
return files;
922-
}
923-
924-
Error EditorExportPlatform::export_project_files(bool p_main_pack, const Ref<EditorExportPreset> &p_preset, bool p_debug, EditorExportSaveFunction p_func, void *p_udata, EditorExportSaveSharedObject p_so_func) {
916+
Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> &p_preset, bool p_debug, EditorExportSaveFunction p_func, void *p_udata, EditorExportSaveSharedObject p_so_func) {
925917
//figure out paths of files that will be exported
926918
HashSet<String> paths;
927919
Vector<String> path_remaps;
@@ -968,11 +960,9 @@ Error EditorExportPlatform::export_project_files(bool p_main_pack, const Ref<Edi
968960
}
969961
}
970962

971-
if (p_main_pack) {
972-
// Add native icons to non-resource include list.
973-
_edit_filter_list(paths, String("*.icns"), false);
974-
_edit_filter_list(paths, String("*.ico"), false);
975-
}
963+
//add native icons to non-resource include list
964+
_edit_filter_list(paths, String("*.icns"), false);
965+
_edit_filter_list(paths, String("*.ico"), false);
976966

977967
_edit_filter_list(paths, p_preset->get_include_filter(), false);
978968
_edit_filter_list(paths, p_preset->get_exclude_filter(), true);
@@ -1404,12 +1394,7 @@ Error EditorExportPlatform::export_project_files(bool p_main_pack, const Ref<Edi
14041394
}
14051395
}
14061396

1407-
Vector<String> forced_export;
1408-
if (p_main_pack) {
1409-
forced_export = get_main_pack_forced_export_files();
1410-
} else {
1411-
forced_export = get_forced_export_files();
1412-
}
1397+
Vector<String> forced_export = get_forced_export_files();
14131398
for (int i = 0; i < forced_export.size(); i++) {
14141399
Vector<uint8_t> array = FileAccess::get_file_as_bytes(forced_export[i]);
14151400
err = p_func(p_udata, forced_export[i], array, idx, total, enc_in_filters, enc_ex_filters, key);
@@ -1418,19 +1403,13 @@ Error EditorExportPlatform::export_project_files(bool p_main_pack, const Ref<Edi
14181403
}
14191404
}
14201405

1421-
if (p_main_pack) {
1422-
String config_file = "project.binary";
1423-
String engine_cfb = EditorPaths::get_singleton()->get_cache_dir().path_join("tmp" + config_file);
1424-
ProjectSettings::get_singleton()->save_custom(engine_cfb, custom_map, custom_list);
1425-
Vector<uint8_t> data = FileAccess::get_file_as_bytes(engine_cfb);
1426-
DirAccess::remove_file_or_error(engine_cfb);
1427-
err = p_func(p_udata, "res://" + config_file, data, idx, total, enc_in_filters, enc_ex_filters, key);
1428-
if (err != OK) {
1429-
return err;
1430-
}
1431-
}
1406+
String config_file = "project.binary";
1407+
String engine_cfb = EditorPaths::get_singleton()->get_cache_dir().path_join("tmp" + config_file);
1408+
ProjectSettings::get_singleton()->save_custom(engine_cfb, custom_map, custom_list);
1409+
Vector<uint8_t> data = FileAccess::get_file_as_bytes(engine_cfb);
1410+
DirAccess::remove_file_or_error(engine_cfb);
14321411

1433-
return OK;
1412+
return p_func(p_udata, "res://" + config_file, data, idx, total, enc_in_filters, enc_ex_filters, key);
14341413
}
14351414

14361415
Error EditorExportPlatform::_add_shared_object(void *p_userdata, const SharedObject &p_so) {
@@ -1559,7 +1538,7 @@ void EditorExportPlatform::zip_folder_recursive(zipFile &p_zip, const String &p_
15591538
da->list_dir_end();
15601539
}
15611540

1562-
Error EditorExportPlatform::save_pack(bool p_main_pack, const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, Vector<SharedObject> *p_so_files, bool p_embed, int64_t *r_embedded_start, int64_t *r_embedded_size) {
1541+
Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, Vector<SharedObject> *p_so_files, bool p_embed, int64_t *r_embedded_start, int64_t *r_embedded_size) {
15631542
EditorProgress ep("savepack", TTR("Packing"), 102, true);
15641543

15651544
// Create the temporary export directory if it doesn't exist.
@@ -1578,7 +1557,7 @@ Error EditorExportPlatform::save_pack(bool p_main_pack, const Ref<EditorExportPr
15781557
pd.f = ftmp;
15791558
pd.so_files = p_so_files;
15801559

1581-
Error err = export_project_files(p_main_pack, p_preset, p_debug, _save_pack_file, &pd, _add_shared_object);
1560+
Error err = export_project_files(p_preset, p_debug, _save_pack_file, &pd, _add_shared_object);
15821561

15831562
// Close temp file.
15841563
pd.f.unref();
@@ -1796,7 +1775,7 @@ Error EditorExportPlatform::save_zip(const Ref<EditorExportPreset> &p_preset, bo
17961775
zd.ep = &ep;
17971776
zd.zip = zip;
17981777

1799-
Error err = export_project_files(false, p_preset, p_debug, _save_zip_file, &zd);
1778+
Error err = export_project_files(p_preset, p_debug, _save_zip_file, &zd);
18001779
if (err != OK && err != ERR_SKIP) {
18011780
add_message(EXPORT_MESSAGE_ERROR, TTR("Save ZIP"), TTR("Failed to export project files."));
18021781
}
@@ -1808,7 +1787,7 @@ Error EditorExportPlatform::save_zip(const Ref<EditorExportPreset> &p_preset, bo
18081787

18091788
Error EditorExportPlatform::export_pack(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags) {
18101789
ExportNotifier notifier(*this, p_preset, p_debug, p_path, p_flags);
1811-
return save_pack(false, p_preset, p_debug, p_path);
1790+
return save_pack(p_preset, p_debug, p_path);
18121791
}
18131792

18141793
Error EditorExportPlatform::export_zip(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags) {

editor/export/editor_export_platform.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,6 @@ class EditorExportPlatform : public RefCounted {
203203
return worst_type;
204204
}
205205

206-
static Vector<String> get_main_pack_forced_export_files();
207206
static Vector<String> get_forced_export_files();
208207

209208
virtual bool fill_log_messages(RichTextLabel *p_log, Error p_err);
@@ -217,9 +216,9 @@ class EditorExportPlatform : public RefCounted {
217216
virtual String get_name() const = 0;
218217
virtual Ref<Texture2D> get_logo() const = 0;
219218

220-
Error export_project_files(bool p_main_pack, const Ref<EditorExportPreset> &p_preset, bool p_debug, EditorExportSaveFunction p_func, void *p_udata, EditorExportSaveSharedObject p_so_func = nullptr);
219+
Error export_project_files(const Ref<EditorExportPreset> &p_preset, bool p_debug, EditorExportSaveFunction p_func, void *p_udata, EditorExportSaveSharedObject p_so_func = nullptr);
221220

222-
Error save_pack(bool p_main_pack, const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, Vector<SharedObject> *p_so_files = nullptr, bool p_embed = false, int64_t *r_embedded_start = nullptr, int64_t *r_embedded_size = nullptr);
221+
Error save_pack(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, Vector<SharedObject> *p_so_files = nullptr, bool p_embed = false, int64_t *r_embedded_start = nullptr, int64_t *r_embedded_size = nullptr);
223222
Error save_zip(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path);
224223

225224
virtual bool poll_export() { return false; }

editor/export/editor_export_platform_pc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ Error EditorExportPlatformPC::export_project_data(const Ref<EditorExportPreset>
194194

195195
int64_t embedded_pos;
196196
int64_t embedded_size;
197-
Error err = save_pack(true, p_preset, p_debug, pck_path, &so_files, p_preset->get("binary_format/embed_pck"), &embedded_pos, &embedded_size);
197+
Error err = save_pack(p_preset, p_debug, pck_path, &so_files, p_preset->get("binary_format/embed_pck"), &embedded_pos, &embedded_size);
198198
if (err == OK && p_preset->get("binary_format/embed_pck")) {
199199
if (embedded_size >= 0x100000000 && String(p_preset->get("binary_format/architecture")).contains("32")) {
200200
add_message(EXPORT_MESSAGE_ERROR, TTR("PCK Embedding"), TTR("On 32-bit exports the embedded PCK cannot be bigger than 4 GiB."));

platform/android/export/export_plugin.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2658,7 +2658,7 @@ String EditorExportPlatformAndroid::get_apk_expansion_fullpath(const Ref<EditorE
26582658

26592659
Error EditorExportPlatformAndroid::save_apk_expansion_file(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path) {
26602660
String fullpath = get_apk_expansion_fullpath(p_preset, p_path);
2661-
Error err = save_pack(false, p_preset, p_debug, fullpath);
2661+
Error err = save_pack(p_preset, p_debug, fullpath);
26622662
return err;
26632663
}
26642664

@@ -3102,9 +3102,9 @@ Error EditorExportPlatformAndroid::export_project_helper(const Ref<EditorExportP
31023102
user_data.libs_directory = gradle_build_directory.path_join("libs");
31033103
user_data.debug = p_debug;
31043104
if (p_flags & DEBUG_FLAG_DUMB_CLIENT) {
3105-
err = export_project_files(true, p_preset, p_debug, ignore_apk_file, &user_data, copy_gradle_so);
3105+
err = export_project_files(p_preset, p_debug, ignore_apk_file, &user_data, copy_gradle_so);
31063106
} else {
3107-
err = export_project_files(true, p_preset, p_debug, rename_and_store_file_in_gradle_project, &user_data, copy_gradle_so);
3107+
err = export_project_files(p_preset, p_debug, rename_and_store_file_in_gradle_project, &user_data, copy_gradle_so);
31083108
}
31093109
if (err != OK) {
31103110
add_message(EXPORT_MESSAGE_ERROR, TTR("Export"), TTR("Could not export project files to gradle project."));
@@ -3489,7 +3489,7 @@ Error EditorExportPlatformAndroid::export_project_helper(const Ref<EditorExportP
34893489
APKExportData ed;
34903490
ed.ep = &ep;
34913491
ed.apk = unaligned_apk;
3492-
err = export_project_files(true, p_preset, p_debug, ignore_apk_file, &ed, save_apk_so);
3492+
err = export_project_files(p_preset, p_debug, ignore_apk_file, &ed, save_apk_so);
34933493
} else {
34943494
if (apk_expansion) {
34953495
err = save_apk_expansion_file(p_preset, p_debug, p_path);
@@ -3501,7 +3501,7 @@ Error EditorExportPlatformAndroid::export_project_helper(const Ref<EditorExportP
35013501
APKExportData ed;
35023502
ed.ep = &ep;
35033503
ed.apk = unaligned_apk;
3504-
err = export_project_files(true, p_preset, p_debug, save_apk_file, &ed, save_apk_so);
3504+
err = export_project_files(p_preset, p_debug, save_apk_file, &ed, save_apk_so);
35053505
}
35063506
}
35073507

platform/ios/export/export_plugin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1662,7 +1662,7 @@ Error EditorExportPlatformIOS::_export_project_helper(const Ref<EditorExportPres
16621662
}
16631663
String pack_path = binary_dir + ".pck";
16641664
Vector<SharedObject> libraries;
1665-
Error err = save_pack(true, p_preset, p_debug, pack_path, &libraries);
1665+
Error err = save_pack(p_preset, p_debug, pack_path, &libraries);
16661666
if (err) {
16671667
// Message is supplied by the subroutine method.
16681668
return err;

platform/macos/export/export_plugin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1774,7 +1774,7 @@ Error EditorExportPlatformMacOS::export_project(const Ref<EditorExportPreset> &p
17741774

17751775
String pack_path = tmp_app_path_name + "/Contents/Resources/" + pkg_name + ".pck";
17761776
Vector<SharedObject> shared_objects;
1777-
err = save_pack(true, p_preset, p_debug, pack_path, &shared_objects);
1777+
err = save_pack(p_preset, p_debug, pack_path, &shared_objects);
17781778

17791779
bool lib_validation = p_preset->get("codesign/entitlements/disable_library_validation");
17801780
if (!shared_objects.is_empty() && sign_enabled && ad_hoc && !lib_validation) {

platform/web/export/export_plugin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ Error EditorExportPlatformWeb::export_project(const Ref<EditorExportPreset> &p_p
479479
// Export pck and shared objects
480480
Vector<SharedObject> shared_objects;
481481
String pck_path = base_path + ".pck";
482-
Error error = save_pack(true, p_preset, p_debug, pck_path, &shared_objects);
482+
Error error = save_pack(p_preset, p_debug, pck_path, &shared_objects);
483483
if (error != OK) {
484484
add_message(EXPORT_MESSAGE_ERROR, TTR("Export"), vformat(TTR("Could not write file: \"%s\"."), pck_path));
485485
return error;

0 commit comments

Comments
 (0)