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.

136 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:: build_tools
  19. {
  20. String EntitlementOptions::getEntitlementsFileContent() const
  21. {
  22. String content =
  23. "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
  24. "<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n"
  25. "<plist version=\"1.0\">\n"
  26. "<dict>\n";
  27. const auto entitlements = getEntitlements();
  28. for (auto& key : entitlements.getAllKeys())
  29. content += "\t<key>" + key + "</key>\n\t" + entitlements[key] + "\n";
  30. return content + "</dict>\n</plist>\n";
  31. }
  32. StringPairArray EntitlementOptions::getEntitlements() const
  33. {
  34. StringPairArray entitlements;
  35. if (isiOS)
  36. {
  37. // The Inter-App Audio entitlement is currently deprecated, but it
  38. // also "provides access to Audio Unit extensions". Without the
  39. // entitlement iOS apps are unable to access AUv3 plug-ins.
  40. if ((isAudioPluginProject && shouldEnableIAA) || isAUPluginHost)
  41. entitlements.set ("inter-app-audio", "<true/>");
  42. if (isiCloudPermissionsEnabled)
  43. {
  44. entitlements.set ("com.apple.developer.icloud-container-identifiers",
  45. "<array>\n"
  46. " <string>iCloud.$(CFBundleIdentifier)</string>\n"
  47. " </array>");
  48. entitlements.set ("com.apple.developer.icloud-services",
  49. "<array>\n"
  50. " <string>CloudDocuments</string>\n"
  51. " </array>");
  52. entitlements.set ("com.apple.developer.ubiquity-container-identifiers",
  53. "<array>\n"
  54. " <string>iCloud.$(CFBundleIdentifier)</string>\n"
  55. " </array>");
  56. }
  57. }
  58. if (isPushNotificationsEnabled)
  59. entitlements.set (isiOS ? "aps-environment"
  60. : "com.apple.developer.aps-environment",
  61. "<string>development</string>");
  62. if (isAppGroupsEnabled)
  63. {
  64. auto appGroups = StringArray::fromTokens (appGroupIdString, ";", {});
  65. String groups = "<array>";
  66. for (auto group : appGroups)
  67. groups += "\n\t\t<string>" + group.trim() + "</string>";
  68. groups += "\n\t</array>";
  69. entitlements.set ("com.apple.security.application-groups", groups);
  70. }
  71. if (isHardenedRuntimeEnabled)
  72. for (auto& option : hardenedRuntimeOptions)
  73. entitlements.set (option, "<true/>");
  74. if (isAppSandboxEnabled || (! isiOS && isAudioPluginProject && type == ProjectType::Target::AudioUnitv3PlugIn))
  75. {
  76. entitlements.set ("com.apple.security.app-sandbox", "<true/>");
  77. if (isAppSandboxInhertianceEnabled)
  78. {
  79. // no other sandbox options can be specified if sandbox inheritance is enabled!
  80. jassert (appSandboxOptions.isEmpty());
  81. jassert (appSandboxTemporaryPaths.empty());
  82. entitlements.set ("com.apple.security.inherit", "<true/>");
  83. }
  84. if (isAppSandboxEnabled)
  85. {
  86. for (auto& option : appSandboxOptions)
  87. entitlements.set (option, "<true/>");
  88. for (auto& option : appSandboxTemporaryPaths)
  89. {
  90. String paths = "<array>";
  91. for (const auto& path : option.values)
  92. paths += "\n\t\t<string>" + path + "</string>";
  93. paths += "\n\t</array>";
  94. entitlements.set (option.key, paths);
  95. }
  96. }
  97. }
  98. if (isNetworkingMulticastEnabled)
  99. entitlements.set ("com.apple.developer.networking.multicast", "<true/>");
  100. return entitlements;
  101. }
  102. } // namespace juce::build_tools