mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Projucer: Made it possible to specify a semicolon-separated list of user modules paths to override the global default when generating a project from a PIP using the "--create-project-from-pip" command-line option
This commit is contained in:
parent
a3f20c0d08
commit
9761a03334
3 changed files with 70 additions and 25 deletions
|
|
@ -27,6 +27,7 @@
|
|||
#include "../../Application/jucer_Headers.h"
|
||||
#include "../../ProjectSaving/jucer_ProjectExporter.h"
|
||||
#include "jucer_PIPGenerator.h"
|
||||
#include "../../Project/jucer_Module.h"
|
||||
|
||||
//==============================================================================
|
||||
static String removeEnclosed (const String& input, const String& start, const String& end)
|
||||
|
|
@ -97,9 +98,10 @@ static bool isMobileExporter (const String& exporterName)
|
|||
}
|
||||
|
||||
//==============================================================================
|
||||
PIPGenerator::PIPGenerator (const File& pip, const File& output, const File& juceDir)
|
||||
PIPGenerator::PIPGenerator (const File& pip, const File& output, const File& jucePath, const Array<File>& userPaths)
|
||||
: pipFile (pip),
|
||||
juceDirectory (juceDir),
|
||||
juceModulesPath (jucePath),
|
||||
userModulesPaths (userPaths),
|
||||
metadata (parsePIPMetadata())
|
||||
{
|
||||
if (output != File())
|
||||
|
|
@ -118,6 +120,12 @@ PIPGenerator::PIPGenerator (const File& pip, const File& output, const File& juc
|
|||
|
||||
outputDirectory = outputDirectory.getChildFile (metadata[Ids::name].toString());
|
||||
useLocalCopy = metadata[Ids::useLocalCopy].toString().isNotEmpty() || isClipboard;
|
||||
|
||||
if (! userModulesPaths.isEmpty())
|
||||
{
|
||||
availableUserModules.reset (new AvailableModuleList());
|
||||
availableUserModules->scanPaths (userModulesPaths);
|
||||
}
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -291,7 +299,7 @@ ValueTree PIPGenerator::createModulePathChild (const String& moduleID)
|
|||
ValueTree modulePath (Ids::MODULEPATH);
|
||||
|
||||
modulePath.setProperty (Ids::ID, moduleID, nullptr);
|
||||
modulePath.setProperty (Ids::path, juceDirectory.getFullPathName(), nullptr);
|
||||
modulePath.setProperty (Ids::path, getPathForModule (moduleID).getFullPathName(), nullptr);
|
||||
|
||||
return modulePath;
|
||||
}
|
||||
|
|
@ -348,12 +356,7 @@ ValueTree PIPGenerator::createExporterChild (const String& exporterName)
|
|||
auto modules = StringArray::fromTokens (metadata[Ids::dependencies_].toString(), ",", {});
|
||||
|
||||
for (auto m : modules)
|
||||
{
|
||||
m = m.trim();
|
||||
|
||||
if (isJUCEModule (m))
|
||||
modulePaths.addChild (createModulePathChild (m), -1, nullptr);
|
||||
}
|
||||
modulePaths.addChild (createModulePathChild (m.trim()), -1, nullptr);
|
||||
|
||||
exporter.addChild (modulePaths, -1, nullptr);
|
||||
}
|
||||
|
|
@ -368,7 +371,7 @@ ValueTree PIPGenerator::createModuleChild (const String& moduleID)
|
|||
module.setProperty (Ids::ID, moduleID, nullptr);
|
||||
module.setProperty (Ids::showAllCode, 1, nullptr);
|
||||
module.setProperty (Ids::useLocalCopy, 0, nullptr);
|
||||
module.setProperty (Ids::useGlobalPath, (juceDirectory == File() ? 1 : 0), nullptr);
|
||||
module.setProperty (Ids::useGlobalPath, (getPathForModule (moduleID) == File() ? 1 : 0), nullptr);
|
||||
|
||||
return module;
|
||||
}
|
||||
|
|
@ -407,12 +410,7 @@ void PIPGenerator::addModules (ValueTree& jucerTree)
|
|||
modules.mergeArray (getModulesRequiredForAudioProcessor());
|
||||
|
||||
for (auto& m : modules)
|
||||
{
|
||||
m = m.trim();
|
||||
|
||||
if (isJUCEModule (m))
|
||||
modulesTree.addChild (createModuleChild (m), -1, nullptr);
|
||||
}
|
||||
modulesTree.addChild (createModuleChild (m.trim()), -1, nullptr);
|
||||
|
||||
jucerTree.addChild (modulesTree, -1, nullptr);
|
||||
}
|
||||
|
|
@ -597,3 +595,18 @@ StringArray PIPGenerator::getPluginCharacteristics() const
|
|||
|
||||
return {};
|
||||
}
|
||||
|
||||
File PIPGenerator::getPathForModule (const String& moduleID) const
|
||||
{
|
||||
if (isJUCEModule (moduleID))
|
||||
{
|
||||
if (juceModulesPath != File())
|
||||
return juceModulesPath;
|
||||
}
|
||||
else if (availableUserModules != nullptr)
|
||||
{
|
||||
return availableUserModules->getModuleWithID (moduleID).second.getParentDirectory();
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue