The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

137 lines
5.0KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2022 - Raw Material Software Limited
  5. JUCE is an open source library subject to commercial or open-source
  6. licensing.
  7. By using JUCE, you agree to the terms of both the JUCE 7 End-User License
  8. Agreement and JUCE Privacy Policy.
  9. End User License Agreement: www.juce.com/juce-7-licence
  10. Privacy Policy: www.juce.com/juce-privacy-policy
  11. Or: You may also use this code under the terms of the GPL v3 (see
  12. www.gnu.org/licenses).
  13. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  14. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  15. DISCLAIMED.
  16. ==============================================================================
  17. */
  18. namespace juce
  19. {
  20. namespace build_tools
  21. {
  22. String EntitlementOptions::getEntitlementsFileContent() const
  23. {
  24. String content =
  25. "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
  26. "<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n"
  27. "<plist version=\"1.0\">\n"
  28. "<dict>\n";
  29. const auto entitlements = getEntitlements();
  30. for (auto& key : entitlements.getAllKeys())
  31. content += "\t<key>" + key + "</key>\n\t" + entitlements[key] + "\n";
  32. return content + "</dict>\n</plist>\n";
  33. }
  34. StringPairArray EntitlementOptions::getEntitlements() const
  35. {
  36. StringPairArray entitlements;
  37. if (isiOS)
  38. {
  39. // The Inter-App Audio entitlement is currently deprecated, but it
  40. // also "provides access to Audio Unit extensions". Without the
  41. // entitlement iOS apps are unable to access AUv3 plug-ins.
  42. if ((isAudioPluginProject && shouldEnableIAA) || isAUPluginHost)
  43. entitlements.set ("inter-app-audio", "<true/>");
  44. if (isiCloudPermissionsEnabled)
  45. {
  46. entitlements.set ("com.apple.developer.icloud-container-identifiers",
  47. "<array>\n"
  48. " <string>iCloud.$(CFBundleIdentifier)</string>\n"
  49. " </array>");
  50. entitlements.set ("com.apple.developer.icloud-services",
  51. "<array>\n"
  52. " <string>CloudDocuments</string>\n"
  53. " </array>");
  54. entitlements.set ("com.apple.developer.ubiquity-container-identifiers",
  55. "<array>\n"
  56. " <string>iCloud.$(CFBundleIdentifier)</string>\n"
  57. " </array>");
  58. }
  59. }
  60. if (isPushNotificationsEnabled)
  61. entitlements.set (isiOS ? "aps-environment"
  62. : "com.apple.developer.aps-environment",
  63. "<string>development</string>");
  64. if (isAppGroupsEnabled)
  65. {
  66. auto appGroups = StringArray::fromTokens (appGroupIdString, ";", {});
  67. String groups = "<array>";
  68. for (auto group : appGroups)
  69. groups += "\n\t\t<string>" + group.trim() + "</string>";
  70. groups += "\n\t</array>";
  71. entitlements.set ("com.apple.security.application-groups", groups);
  72. }
  73. if (isHardenedRuntimeEnabled)
  74. for (auto& option : hardenedRuntimeOptions)
  75. entitlements.set (option, "<true/>");
  76. if (isAppSandboxEnabled || (! isiOS && isAudioPluginProject && type == ProjectType::Target::AudioUnitv3PlugIn))
  77. {
  78. entitlements.set ("com.apple.security.app-sandbox", "<true/>");
  79. if (isAppSandboxInhertianceEnabled)
  80. {
  81. // no other sandbox options can be specified if sandbox inheritance is enabled!
  82. jassert (appSandboxOptions.isEmpty());
  83. jassert (appSandboxTemporaryPaths.empty());
  84. entitlements.set ("com.apple.security.inherit", "<true/>");
  85. }
  86. if (isAppSandboxEnabled)
  87. {
  88. for (auto& option : appSandboxOptions)
  89. entitlements.set (option, "<true/>");
  90. for (auto& option : appSandboxTemporaryPaths)
  91. {
  92. String paths = "<array>";
  93. for (const auto& path : option.values)
  94. paths += "\n\t\t<string>" + path + "</string>";
  95. paths += "\n\t</array>";
  96. entitlements.set (option.key, paths);
  97. }
  98. }
  99. }
  100. if (isNetworkingMulticastEnabled)
  101. entitlements.set ("com.apple.developer.networking.multicast", "<true/>");
  102. return entitlements;
  103. }
  104. }
  105. }