From ddb6b969ea03884b4c6f23013840de16b2546be4 Mon Sep 17 00:00:00 2001 From: jules Date: Sat, 5 Jan 2013 15:42:05 +0000 Subject: [PATCH] Introjucer: new plist format for AU plugins. --- .../jucer_ProjectExport_XCode.h | 18 +++++----- .../Source/Project/jucer_AudioPluginModule.h | 36 +++++++++++++++++++ .../Source/Project/jucer_Project.cpp | 9 +++-- .../Introjucer/Source/Project/jucer_Project.h | 1 + .../Source/Utility/jucer_MiscUtilities.cpp | 35 ++++++++++++++++++ .../Source/Utility/jucer_MiscUtilities.h | 4 +++ .../Builds/MacOSX/Info.plist | 19 ++++++++++ 7 files changed, 111 insertions(+), 11 deletions(-) diff --git a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_XCode.h b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_XCode.h index b312aa8acb..fe26e68f5a 100644 --- a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_XCode.h +++ b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_XCode.h @@ -704,17 +704,17 @@ private: if (xcodeOtherRezFlags.isNotEmpty()) s.add ("OTHER_REZFLAGS = \"" + xcodeOtherRezFlags + "\""); + if (config.getTargetBinaryRelativePathString().isNotEmpty()) + { + RelativePath binaryPath (config.getTargetBinaryRelativePathString(), RelativePath::projectFolder); + binaryPath = binaryPath.rebased (projectFolder, getTargetFolder(), RelativePath::buildTargetFolder); + + s.add ("DSTROOT = " + sanitisePath (binaryPath.toUnixStyle())); + s.add ("SYMROOT = " + sanitisePath (binaryPath.toUnixStyle())); + } + if (projectType.isLibrary()) { - if (config.getTargetBinaryRelativePathString().isNotEmpty()) - { - RelativePath binaryPath (config.getTargetBinaryRelativePathString(), RelativePath::projectFolder); - binaryPath = binaryPath.rebased (projectFolder, getTargetFolder(), RelativePath::buildTargetFolder); - - s.add ("DSTROOT = " + sanitisePath (binaryPath.toUnixStyle())); - s.add ("SYMROOT = " + sanitisePath (binaryPath.toUnixStyle())); - } - s.add ("CONFIGURATION_BUILD_DIR = \"$(BUILD_DIR)\""); s.add ("DEPLOYMENT_LOCATION = YES"); } diff --git a/extras/Introjucer/Source/Project/jucer_AudioPluginModule.h b/extras/Introjucer/Source/Project/jucer_AudioPluginModule.h index fcd6d5a47b..1942142253 100644 --- a/extras/Introjucer/Source/Project/jucer_AudioPluginModule.h +++ b/extras/Introjucer/Source/Project/jucer_AudioPluginModule.h @@ -82,6 +82,20 @@ namespace return s; } + String getAUMainTypeCode (Project& project) + { + String s (getPluginAUMainType (project).toString()); + + if (s.isEmpty()) + { + if (getPluginIsSynth (project).getValue()) s = "aumu"; + else if (getPluginWantsMidiInput (project).getValue()) s = "aumf"; + else s = "aufx"; + } + + return s; + } + int countMaxPluginChannels (const String& configString, bool isInput) { StringArray configs; @@ -496,6 +510,28 @@ namespace AUHelpers subGroup.getChild (subGroup.getNumChildren() - 1).getShouldInhibitWarningsValue() = true; } } + + if (exporter.isXcode()) + { + XmlElement plistKey ("key"); + plistKey.addTextElement ("AudioComponents"); + + XmlElement plistEntry ("array"); + XmlElement* dict = plistEntry.createNewChildElement ("dict"); + + Project& project = exporter.getProject(); + + addPlistDictionaryKey (dict, "name", getPluginName (project).toString()); + addPlistDictionaryKey (dict, "description", getPluginDesc (project).toString()); + addPlistDictionaryKey (dict, "factoryFunction", getPluginAUExportPrefix (project).toString() + "Factory"); + addPlistDictionaryKey (dict, "manufacturer", getPluginManufacturerCode (project).toString().trim().substring (0, 4)); + addPlistDictionaryKey (dict, "type", getAUMainTypeCode (project)); + addPlistDictionaryKey (dict, "subtype", getPluginCode (project).toString().trim().substring (0, 4)); + addPlistDictionaryKeyInt (dict, "version", project.getVersionAsHexInteger()); + + exporter.xcodeExtraPListEntries.add (plistKey); + exporter.xcodeExtraPListEntries.add (plistEntry); + } } } } diff --git a/extras/Introjucer/Source/Project/jucer_Project.cpp b/extras/Introjucer/Source/Project/jucer_Project.cpp index 291a9df0f4..1bab65ca9c 100644 --- a/extras/Introjucer/Source/Project/jucer_Project.cpp +++ b/extras/Introjucer/Source/Project/jucer_Project.cpp @@ -387,7 +387,7 @@ static StringArray getConfigs (const Project& p) return configs; } -String Project::getVersionAsHex() const +int Project::getVersionAsHexInteger() const { const StringArray configs (getConfigs (*this)); @@ -396,7 +396,12 @@ String Project::getVersionAsHex() const if (configs.size() >= 4) value = (value << 8) + configs[3].getIntValue(); - return "0x" + String::toHexString (value); + return value; +} + +String Project::getVersionAsHex() const +{ + return "0x" + String::toHexString (getVersionAsHexInteger()); } StringPairArray Project::getPreprocessorDefs() const diff --git a/extras/Introjucer/Source/Project/jucer_Project.h b/extras/Introjucer/Source/Project/jucer_Project.h index 869e258892..eb19d97593 100644 --- a/extras/Introjucer/Source/Project/jucer_Project.h +++ b/extras/Introjucer/Source/Project/jucer_Project.h @@ -83,6 +83,7 @@ public: Value getVersionValue() { return getProjectValue (Ids::version); } String getVersionString() const { return projectRoot [Ids::version]; } String getVersionAsHex() const; + int getVersionAsHexInteger() const; Value getBundleIdentifier() { return getProjectValue (Ids::bundleIdentifier); } String getDefaultBundleIdentifier() { return "com.yourcompany." + CodeHelpers::makeValidIdentifier (getTitle(), false, true, false); } diff --git a/extras/Introjucer/Source/Utility/jucer_MiscUtilities.cpp b/extras/Introjucer/Source/Utility/jucer_MiscUtilities.cpp index 3c1e3ff657..6b0dbabcce 100644 --- a/extras/Introjucer/Source/Utility/jucer_MiscUtilities.cpp +++ b/extras/Introjucer/Source/Utility/jucer_MiscUtilities.cpp @@ -172,6 +172,41 @@ StringArray getSearchPathsFromString (const String& searchPath) return s; } +void addPlistDictionaryKey (XmlElement* xml, const String& key, const String& value) +{ + forEachXmlChildElementWithTagName (*xml, e, "key") + { + if (e->getAllSubText().trim().equalsIgnoreCase (key)) + { + if (e->getNextElement() != nullptr && e->getNextElement()->hasTagName ("key")) + { + // try to fix broken plist format.. + xml->removeChildElement (e, true); + break; + } + else + { + return; // (value already exists) + } + } + } + + xml->createNewChildElement ("key") ->addTextElement (key); + xml->createNewChildElement ("string")->addTextElement (value); +} + +void addPlistDictionaryKeyBool (XmlElement* xml, const String& key, const bool value) +{ + xml->createNewChildElement ("key")->addTextElement (key); + xml->createNewChildElement (value ? "true" : "false"); +} + +void addPlistDictionaryKeyInt (XmlElement* xml, const String& key, int value) +{ + xml->createNewChildElement ("key")->addTextElement (key); + xml->createNewChildElement ("integer")->addTextElement (String (value)); +} + //============================================================================== void autoScrollForMouseEvent (const MouseEvent& e, bool scrollX, bool scrollY) { diff --git a/extras/Introjucer/Source/Utility/jucer_MiscUtilities.h b/extras/Introjucer/Source/Utility/jucer_MiscUtilities.h index bd2b30d583..159641a5de 100644 --- a/extras/Introjucer/Source/Utility/jucer_MiscUtilities.h +++ b/extras/Introjucer/Source/Utility/jucer_MiscUtilities.h @@ -41,6 +41,10 @@ StringArray getSearchPathsFromString (const String& searchPath); void setValueIfVoid (Value value, const var& defaultValue); +void addPlistDictionaryKey (XmlElement* xml, const String& key, const String& value); +void addPlistDictionaryKeyBool (XmlElement* xml, const String& key, bool value); +void addPlistDictionaryKeyInt (XmlElement* xml, const String& key, int value); + //============================================================================== int indexOfLineStartingWith (const StringArray& lines, const String& text, int startIndex); diff --git a/extras/audio plugin demo/Builds/MacOSX/Info.plist b/extras/audio plugin demo/Builds/MacOSX/Info.plist index 295d5cad4d..4299c3fefe 100644 --- a/extras/audio plugin demo/Builds/MacOSX/Info.plist +++ b/extras/audio plugin demo/Builds/MacOSX/Info.plist @@ -23,5 +23,24 @@ Raw Material Software Ltd. NSHighResolutionCapable + AudioComponents + + + name + Juce Demo Plugin + description + Juce Demo Plugin + factoryFunction + JuceDemoProjectAUFactory + manufacturer + RawM + type + aumf + subtype + Jcdm + version + 65536 + +