| @@ -242,6 +242,9 @@ void Project::initialiseProjectValues() | |||
| binaryDataNamespaceValue.referTo (projectRoot, Ids::binaryDataNamespace, getUndoManager(), "BinaryData"); | |||
| compilerFlagSchemesValue.referTo (projectRoot, Ids::compilerFlagSchemes, getUndoManager(), Array<var>(), ","); | |||
| postExportShellCommandPosixValue.referTo (projectRoot, Ids::postExportShellCommandPosix, getUndoManager()); | |||
| postExportShellCommandWinValue.referTo (projectRoot, Ids::postExportShellCommandWin, getUndoManager()); | |||
| } | |||
| void Project::initialiseAudioPluginValues() | |||
| @@ -1046,6 +1049,14 @@ void Project::createPropertyEditors (PropertyListBuilder& props) | |||
| props.addSearchPathProperty (headerSearchPathsValue, "Header Search Paths", "Global header search paths."); | |||
| props.add (new TextPropertyComponent (postExportShellCommandPosixValue, "Post-Export Shell Command (macOS, Linux)", 1024, false), | |||
| "A command that will be executed by the system shell after saving this project on macOS or Linux. " | |||
| "The string \"%%1%%\" will be substituted with the absolute path to the project root folder."); | |||
| props.add (new TextPropertyComponent (postExportShellCommandWinValue, "Post-Export Shell Command (Windows)", 1024, false), | |||
| "A command that will be executed by the system shell after saving this project on Windows. " | |||
| "The string \"%%1%%\" will be substituted with the absolute path to the project root folder."); | |||
| props.add (new TextPropertyComponent (userNotesValue, "Notes", 32768, true), | |||
| "Extra comments: This field is not used for code or project generation, it's just a space where you can express your thoughts."); | |||
| } | |||
| @@ -133,6 +133,9 @@ public: | |||
| void addCompilerFlagScheme (const String&); | |||
| void removeCompilerFlagScheme (const String&); | |||
| String getPostExportShellCommandPosixString() const { return postExportShellCommandPosixValue.get(); } | |||
| String getPostExportShellCommandWinString() const { return postExportShellCommandWinValue.get(); } | |||
| //============================================================================== | |||
| String getPluginNameString() const { return pluginNameValue.get(); } | |||
| String getPluginDescriptionString() const { return pluginDescriptionValue.get();} | |||
| @@ -425,7 +428,7 @@ private: | |||
| ValueWithDefault projectNameValue, projectUIDValue, projectLineFeedValue, projectTypeValue, versionValue, bundleIdentifierValue, companyNameValue, | |||
| companyCopyrightValue, companyWebsiteValue, companyEmailValue, displaySplashScreenValue, reportAppUsageValue, splashScreenColourValue, cppStandardValue, | |||
| headerSearchPathsValue, preprocessorDefsValue, userNotesValue, maxBinaryFileSizeValue, includeBinaryDataInJuceHeaderValue, binaryDataNamespaceValue, | |||
| compilerFlagSchemesValue; | |||
| compilerFlagSchemesValue, postExportShellCommandPosixValue, postExportShellCommandWinValue; | |||
| ValueWithDefault pluginFormatsValue, pluginNameValue, pluginDescriptionValue, pluginManufacturerValue, pluginManufacturerCodeValue, | |||
| pluginCodeValue, pluginChannelConfigsValue, pluginCharacteristicsValue, pluginAUExportPrefixValue, pluginAAXIdentifierValue, | |||
| @@ -108,6 +108,7 @@ public: | |||
| writeAppHeader (modules); | |||
| writeModuleCppWrappers (modules); | |||
| writeProjects (modules, specifiedExporterToSave, ! showProgressBox); | |||
| runPostExportScript(); | |||
| // if the project root has changed after writing the other files then re-save it | |||
| if (project.getProjectRoot().toXmlString().hashCode() != projectRootHash) | |||
| @@ -708,6 +709,46 @@ private: | |||
| void writeProjects (const OwnedArray<LibraryModule>&, const String&, bool); | |||
| void runPostExportScript() | |||
| { | |||
| #if JUCE_WINDOWS | |||
| auto cmdString = project.getPostExportShellCommandWinString(); | |||
| #else | |||
| auto cmdString = project.getPostExportShellCommandPosixString(); | |||
| #endif | |||
| auto shellCommand = cmdString.replace ("%%1%%", project.getProjectFolder().getFullPathName()); | |||
| if (shellCommand.isNotEmpty()) | |||
| { | |||
| #if JUCE_WINDOWS | |||
| StringArray argList ("cmd.exe", "/c"); | |||
| #else | |||
| StringArray argList ("/bin/sh", "-c"); | |||
| #endif | |||
| argList.add (shellCommand); | |||
| ChildProcess shellProcess; | |||
| if (! shellProcess.start (argList)) | |||
| { | |||
| addError ("Failed to run shell command: " + argList.joinIntoString (" ")); | |||
| return; | |||
| } | |||
| if (! shellProcess.waitForProcessToFinish (10000)) | |||
| { | |||
| addError ("Timeout running shell command: " + argList.joinIntoString (" ")); | |||
| return; | |||
| } | |||
| auto exitCode = shellProcess.getExitCode(); | |||
| if (exitCode != 0) | |||
| addError ("Shell command: " + argList.joinIntoString (" ") + " failed with exit code: " + String (exitCode)); | |||
| } | |||
| } | |||
| void saveExporter (ProjectExporter* exporter, const OwnedArray<LibraryModule>& modules) | |||
| { | |||
| try | |||
| @@ -352,6 +352,8 @@ namespace Ids | |||
| DECLARE_ID (compilerFlagSchemes); | |||
| DECLARE_ID (compilerFlagScheme); | |||
| DECLARE_ID (dontQueryForUpdate); | |||
| DECLARE_ID (postExportShellCommandPosix); | |||
| DECLARE_ID (postExportShellCommandWin); | |||
| const Identifier ID ("id"); | |||
| const Identifier ID_uppercase ("ID"); | |||