Add xcprivacy file generation

This commit is contained in:
Mikhail Lobotskiy
2025-09-26 16:49:54 +04:00
parent 8ebc7dba86
commit c60dc81694
7 changed files with 37 additions and 14 deletions

View File

@@ -911,7 +911,7 @@ def qt_copy_icu(out):
tests = [get_env("QT_DEPLOY") + "/../lib"]
prefix = ""
postfixes = [""]
# TODO add for linux arm desktop build
if config.option("sysroot") != "":
prefix = config.option("sysroot")
@@ -919,7 +919,7 @@ def qt_copy_icu(out):
prefix = ""
postfixes += ["/x86_64-linux-gnu"]
postfixes += ["/i386-linux-gnu"]
for postfix in postfixes:
tests += [prefix + "/lib" + postfix]
tests += [prefix + "/lib64" + postfix]
@@ -1013,7 +1013,7 @@ def generate_doctrenderer_config(path, root, product, vendor = "", dictionaries
file.close()
return
def generate_plist_framework_folder(file, platform):
def generate_plist(file, platform):
bundle_id_url = "com.onlyoffice."
if ("" != get_env("PUBLISHER_BUNDLE_ID")):
bundle_id_url = get_env("PUBLISHER_BUNDLE_ID")
@@ -1064,7 +1064,29 @@ def generate_plist_framework_folder(file, platform):
fileInfo.close()
return
def generate_plist(path, platform, max_depth=512):
def generate_xcprivacy(file, platform):
content = \
"""<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
\t<key>NSPrivacyTracking</key>
\t<false/>
\t<key>NSPrivacyCollectedDataTypes</key>
\t<array/>
\t<key>NSPrivacyTrackingDomains</key>
\t<array/>
\t<key>NSPrivacyAccessedAPITypes</key>
\t<array/>
</dict>
</plist>"""
fileDst = os.path.join(file, "PrivacyInfo.xcprivacy")
fileInfo = codecs.open(fileDst, "w", "utf-8")
fileInfo.write(content)
fileInfo.close()
return
def for_each_framework(path, platform, callbacks, max_depth=512):
if not config.check_option("config", "bundle_dylibs"):
return
if max_depth == 0:
@@ -1076,9 +1098,10 @@ def generate_plist(path, platform, max_depth=512):
for file in glob.glob(src_folder):
if (is_dir(file)):
if file.endswith(".framework"):
generate_plist_framework_folder(file, platform)
for callback in callbacks:
callback(file, platform)
else:
generate_plist(file, platform, max_depth - 1)
for_each_framework(file, platform, callbacks, max_depth - 1)
return
def correct_bundle_identifier(bundle_identifier):

View File

@@ -108,13 +108,13 @@ def make():
# correct ios frameworks
if ("ios" == platform):
base.generate_plist(root_dir, "ios")
base.for_each_framework(root_dir, "ios", callbacks=[base.generate_plist, base.generate_xcprivacy])
if (0 == platform.find("linux")):
base.linux_correct_rpath_docbuilder(root_dir)
if (0 == platform.find("mac")):
base.generate_plist(root_dir, "mac", max_depth=1)
base.for_each_framework(root_dir, "mac", callbacks=[base.generate_plist], max_depth=1)
base.mac_correct_rpath_x2t(root_dir)
base.mac_correct_rpath_docbuilder(root_dir)

View File

@@ -69,7 +69,7 @@ def make():
# correct mac frameworks
if (0 == platform.find("mac")):
base.generate_plist(archive_dir, "mac", max_depth=1)
base.for_each_framework(archive_dir, "mac", callbacks=[base.generate_plist], max_depth=1)
base.mac_correct_rpath_x2t(archive_dir)
# js cache

View File

@@ -240,7 +240,7 @@ def make():
if (isUseAgent):
agent_plugin_dir = git_dir + "/desktop-sdk/ChromiumBasedEditors/plugins/ai-agent"
if (False):
if (False):
base.cmd_in_dir(agent_plugin_dir, "npm", ["install"], True)
base.cmd_in_dir(agent_plugin_dir, "npm", ["run", "build"], True)
base.copy_dir(agent_plugin_dir + "/{9DC93CDB-B576-4F0C-B55E-FCC9C48DD777}", root_dir + "/editors/sdkjs-plugins/{9DC93CDB-B576-4F0C-B55E-FCC9C48DD777}")
@@ -296,7 +296,7 @@ def make():
if (0 == platform.find("mac")):
# gen plists with max_depth 2 because frameworks are only located in root_dir and converter subdirectory
base.generate_plist(root_dir, "mac", max_depth=2)
base.for_each_framework(root_dir, "mac", callbacks=[base.generate_plist], max_depth=2)
base.mac_correct_rpath_desktop(root_dir)
if is_host_not_arm:

View File

@@ -80,7 +80,7 @@ def make():
# correct ios frameworks
if ("ios" == platform):
base.generate_plist(root_dir, "ios")
base.for_each_framework(root_dir, "ios", callbacks=[base.generate_plist, base.generate_xcprivacy])
deploy_fonts(git_dir, root_dir)
base.copy_dictionaries(git_dir + "/dictionaries", root_dir + "/dictionaries", True, False)

View File

@@ -37,7 +37,7 @@ def make():
# correct ios frameworks
if ("ios" == platform):
base.generate_plist(root_dir, "ios")
base.for_each_framework(root_dir, "ios", callbacks=[base.generate_plist, base.generate_xcprivacy])
for native_platform in platforms:
if native_platform == "android":

View File

@@ -112,7 +112,7 @@ def make():
# correct mac frameworks
if (0 == platform.find("mac")):
base.generate_plist(converter_dir, "mac", max_depth=1)
base.for_each_framework(converter_dir, "mac", callbacks=[base.generate_plist], max_depth=1)
# js
js_dir = root_dir