Browse Source

Projucer: Added "--fix-missing-dependencies" option to the command line resave to add any required modules that may be missing

tags/2021-05-28
ed 4 years ago
parent
commit
47dc58620d
2 changed files with 24 additions and 9 deletions
  1. +16
    -5
      extras/Projucer/Source/Application/jucer_CommandLine.cpp
  2. +8
    -4
      extras/Projucer/Source/ProjectSaving/jucer_ProjectSaver.cpp

+ 16
- 5
extras/Projucer/Source/Application/jucer_CommandLine.cpp View File

@@ -90,13 +90,16 @@ namespace
preferredLineFeed = project->getProjectLineFeed().toRawUTF8();
}
void save (bool justSaveResources)
void save (bool justSaveResources, bool fixMissingDependencies)
{
if (project != nullptr)
{
if (! justSaveResources)
rescanModulePathsIfNecessary();
if (fixMissingDependencies)
tryToFixMissingModuleDependencies();
auto error = justSaveResources ? project->saveResourcesOnly()
: project->saveProject();
@@ -136,6 +139,14 @@ namespace
ProjucerApplication::getApp().rescanUserPathModules();
}
void tryToFixMissingModuleDependencies()
{
auto& modules = project->getEnabledModules();
for (const auto& m : modules.getModulesWithMissingDependencies())
modules.tryToFixMissingDependencies (m);
}
std::unique_ptr<Project> project;
};
@@ -152,7 +163,7 @@ namespace
: "Re-saving file: ")
<< proj.project->getFile().getFullPathName() << std::endl;
proj.save (justSaveResources);
proj.save (justSaveResources, args.containsOption ("--fix-missing-dependencies"));
}
//==============================================================================
@@ -175,7 +186,7 @@ namespace
std::cout << "Setting project version: " << version << std::endl;
proj.project->setProjectVersion (version);
proj.save (false);
proj.save (false, false);
}
//==============================================================================
@@ -192,7 +203,7 @@ namespace
std::cout << "Bumping project version to: " << version << std::endl;
proj.project->setProjectVersion (version);
proj.save (false);
proj.save (false, false);
}
static void gitTag (const ArgumentList& args)
@@ -809,7 +820,7 @@ namespace
<< "Usage: " << std::endl
<< std::endl
<< " " << appName << " --resave project_file" << std::endl
<< " Resaves all files and resources in a project." << std::endl
<< " Resaves all files and resources in a project. Add the \"--fix-missing-dependencies\" option to automatically fix any missing module dependencies." << std::endl
<< std::endl
<< " " << appName << " --resave-resources project_file" << std::endl
<< " Resaves just the binary resources for a project." << std::endl


+ 8
- 4
extras/Projucer/Source/ProjectSaving/jucer_ProjectSaver.cpp View File

@@ -250,20 +250,24 @@ OwnedArray<LibraryModule> ProjectSaver::getModules()
OwnedArray<LibraryModule> modules;
project.getEnabledModules().createRequiredModules (modules);
auto isCommandLine = ProjucerApplication::getApp().isRunningCommandLine;
for (auto* module : modules)
{
if (! module->isValid())
{
addError ("At least one of your JUCE module paths is invalid!\n"
"Please go to the Modules settings page and ensure each path points to the correct JUCE modules folder.");
addError (String ("At least one of your JUCE module paths is invalid!\n")
+ (isCommandLine ? "Please ensure each module path points to the correct JUCE modules folder."
: "Please go to the Modules settings page and ensure each path points to the correct JUCE modules folder."));
return {};
}
if (project.getEnabledModules().getExtraDependenciesNeeded (module->getID()).size() > 0)
{
addError ("At least one of your modules has missing dependencies!\n"
"Please go to the settings page of the highlighted modules and add the required dependencies.");
addError (String ("At least one of your modules has missing dependencies!\n")
+ (isCommandLine ? "Please add the required dependencies, or run the command again with the \"--fix-missing-dependencies\" option."
: "Please go to the settings page of the highlighted modules and add the required dependencies."));
return {};
}


Loading…
Cancel
Save