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.

134 lines
4.8KB

  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. if (isAudioPluginProject && shouldEnableIAA)
  40. entitlements.set ("inter-app-audio", "<true/>");
  41. if (isiCloudPermissionsEnabled)
  42. {
  43. entitlements.set ("com.apple.developer.icloud-container-identifiers",
  44. "<array>\n"
  45. " <string>iCloud.$(CFBundleIdentifier)</string>\n"
  46. " </array>");
  47. entitlements.set ("com.apple.developer.icloud-services",
  48. "<array>\n"
  49. " <string>CloudDocuments</string>\n"
  50. " </array>");
  51. entitlements.set ("com.apple.developer.ubiquity-container-identifiers",
  52. "<array>\n"
  53. " <string>iCloud.$(CFBundleIdentifier)</string>\n"
  54. " </array>");
  55. }
  56. }
  57. if (isPushNotificationsEnabled)
  58. entitlements.set (isiOS ? "aps-environment"
  59. : "com.apple.developer.aps-environment",
  60. "<string>development</string>");
  61. if (isAppGroupsEnabled)
  62. {
  63. auto appGroups = StringArray::fromTokens (appGroupIdString, ";", {});
  64. String groups = "<array>";
  65. for (auto group : appGroups)
  66. groups += "\n\t\t<string>" + group.trim() + "</string>";
  67. groups += "\n\t</array>";
  68. entitlements.set ("com.apple.security.application-groups", groups);
  69. }
  70. if (isHardenedRuntimeEnabled)
  71. for (auto& option : hardenedRuntimeOptions)
  72. entitlements.set (option, "<true/>");
  73. if (isAppSandboxEnabled || (! isiOS && isAudioPluginProject && type == ProjectType::Target::AudioUnitv3PlugIn))
  74. {
  75. entitlements.set ("com.apple.security.app-sandbox", "<true/>");
  76. if (isAppSandboxInhertianceEnabled)
  77. {
  78. // no other sandbox options can be specified if sandbox inheritance is enabled!
  79. jassert (appSandboxOptions.isEmpty());
  80. jassert (appSandboxTemporaryPaths.empty());
  81. entitlements.set ("com.apple.security.inherit", "<true/>");
  82. }
  83. if (isAppSandboxEnabled)
  84. {
  85. for (auto& option : appSandboxOptions)
  86. entitlements.set (option, "<true/>");
  87. for (auto& option : appSandboxTemporaryPaths)
  88. {
  89. String paths = "<array>";
  90. for (const auto& path : option.values)
  91. paths += "\n\t\t<string>" + path + "</string>";
  92. paths += "\n\t</array>";
  93. entitlements.set (option.key, paths);
  94. }
  95. }
  96. }
  97. if (isNetworkingMulticastEnabled)
  98. entitlements.set ("com.apple.developer.networking.multicast", "<true/>");
  99. return entitlements;
  100. }
  101. }
  102. }