Merge pull request #95189 from bruvzg/fix_mono_bundle

[macOS] Fix `generate_bundle` build flag for .NET builds.
This commit is contained in:
Rémi Verschelde 2024-08-06 12:32:18 +02:00
commit 8ba212f188
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -23,10 +23,10 @@ def generate_bundle(target, source, env):
prefix += ".double" prefix += ".double"
# Lipo editor executable. # Lipo editor executable.
target_bin = lipo(bin_dir + "/" + prefix, env.extra_suffix) target_bin = lipo(bin_dir + "/" + prefix, env.extra_suffix + env.module_version_string)
# Assemble .app bundle and update version info. # Assemble .app bundle and update version info.
app_dir = Dir("#bin/" + (prefix + env.extra_suffix).replace(".", "_") + ".app").abspath app_dir = Dir("#bin/" + (prefix + env.extra_suffix + env.module_version_string).replace(".", "_") + ".app").abspath
templ = Dir("#misc/dist/macos_tools.app").abspath templ = Dir("#misc/dist/macos_tools.app").abspath
if os.path.exists(app_dir): if os.path.exists(app_dir):
shutil.rmtree(app_dir) shutil.rmtree(app_dir)
@ -35,6 +35,8 @@ def generate_bundle(target, source, env):
os.mkdir(app_dir + "/Contents/MacOS") os.mkdir(app_dir + "/Contents/MacOS")
if target_bin != "": if target_bin != "":
shutil.copy(target_bin, app_dir + "/Contents/MacOS/Godot") shutil.copy(target_bin, app_dir + "/Contents/MacOS/Godot")
if "mono" in env.module_version_string:
shutil.copytree(Dir("#bin/GodotSharp").abspath, app_dir + "/Contents/Resources/GodotSharp")
version = get_build_version(False) version = get_build_version(False)
short_version = get_build_version(True) short_version = get_build_version(True)
with open(Dir("#misc/dist/macos").abspath + "/editor_info_plist.template", "rt", encoding="utf-8") as fin: with open(Dir("#misc/dist/macos").abspath + "/editor_info_plist.template", "rt", encoding="utf-8") as fin:
@ -76,8 +78,8 @@ def generate_bundle(target, source, env):
dbg_prefix += ".double" dbg_prefix += ".double"
# Lipo template executables. # Lipo template executables.
rel_target_bin = lipo(bin_dir + "/" + rel_prefix, env.extra_suffix) rel_target_bin = lipo(bin_dir + "/" + rel_prefix, env.extra_suffix + env.module_version_string)
dbg_target_bin = lipo(bin_dir + "/" + dbg_prefix, env.extra_suffix) dbg_target_bin = lipo(bin_dir + "/" + dbg_prefix, env.extra_suffix + env.module_version_string)
# Assemble .app bundle. # Assemble .app bundle.
app_dir = Dir("#bin/macos_template.app").abspath app_dir = Dir("#bin/macos_template.app").abspath
@ -93,7 +95,7 @@ def generate_bundle(target, source, env):
shutil.copy(dbg_target_bin, app_dir + "/Contents/MacOS/godot_macos_debug.universal") shutil.copy(dbg_target_bin, app_dir + "/Contents/MacOS/godot_macos_debug.universal")
# ZIP .app bundle. # ZIP .app bundle.
zip_dir = Dir("#bin/" + (app_prefix + env.extra_suffix).replace(".", "_")).abspath zip_dir = Dir("#bin/" + (app_prefix + env.extra_suffix + env.module_version_string).replace(".", "_")).abspath
shutil.make_archive(zip_dir, "zip", root_dir=bin_dir, base_dir="macos_template.app") shutil.make_archive(zip_dir, "zip", root_dir=bin_dir, base_dir="macos_template.app")
shutil.rmtree(app_dir) shutil.rmtree(app_dir)