-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New feature: add-file functionality to Projucer #1349
Open
tesseiko
wants to merge
5
commits into
juce-framework:develop
Choose a base branch
from
tesseiko:projucer_add_file_cli_develop
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
New feature: add-file functionality to Projucer #1349
tesseiko
wants to merge
5
commits into
juce-framework:develop
from
tesseiko:projucer_add_file_cli_develop
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Added new subcommand to Projucer command line. Projucer --add-file jucerfile.jucer path/to/file/or/directory/to/add/project
Here is the patch, in case anybody wants to patch this feature to a previous version. Tested in 6.1.6. ================================================================================= diff --git a/extras/Projucer/Source/Application/jucer_CommandLine.cpp b/extras/Projucer/Source/Application/jucer_CommandLine.cpp
index 3f861e891..555a80289 100644
--- a/extras/Projucer/Source/Application/jucer_CommandLine.cpp
+++ b/extras/Projucer/Source/Application/jucer_CommandLine.cpp
@@ -152,6 +152,22 @@ namespace
modules.tryToFixMissingDependencies (m);
}
+ void clearMainGroup()
+ {
+ auto mainGroup = project->getMainGroup();
+ auto mainGrouID = mainGroup.getID();
+
+ mainGroup.removeItemFromProject();
+ Project::Item cleanMainGroup (*project, ValueTree ("MAINGROUP"), false);
+ cleanMainGroup.setID(mainGrouID);
+ project->getProjectRoot().addChild (cleanMainGroup.state, 0, nullptr);
+ }
+
+ void addFile (const File& file)
+ {
+ project->getMainGroup().addFileRetainingSortOrder (file, true);
+ }
+
std::unique_ptr<Project> project;
};
@@ -171,6 +187,39 @@ namespace
proj.save (justSaveResources, args.containsOption ("--fix-missing-dependencies"));
}
+ static void clearMainGroup (const ArgumentList& args)
+ {
+ args.checkMinNumArguments (2);
+ LoadedProject proj (args[1]);
+
+ std::cout << "Clearing MAINGROUP: "
+ << std::endl;
+
+ proj.clearMainGroup ();
+
+ std::cout << "Re-saving file: "
+ << proj.project->getFile().getFullPathName() << std::endl;
+
+ proj.save (true, args.containsOption ("--fix-missing-dependencies"));
+ }
+
+ static void addFile (const ArgumentList& args)
+ {
+ args.checkMinNumArguments (3);
+ LoadedProject proj (args[1]);
+ auto fileToAdd = args[2].resolveAsExistingFile();
+
+ std::cout << "Adding File: "
+ << fileToAdd.getFileName() << std::endl;
+
+ proj.addFile (fileToAdd.getFullPathName());
+
+ std::cout << "Re-saving file: "
+ << proj.project->getFile().getFullPathName() << std::endl;
+
+ proj.save (true, args.containsOption ("--fix-missing-dependencies"));
+ }
+
//==============================================================================
static void getVersion (const ArgumentList& args)
{
@@ -830,6 +879,12 @@ namespace
<< " " << appName << " --resave-resources project_file" << std::endl
<< " Resaves just the binary resources for a project." << std::endl
<< std::endl
+ << " " << appName << " --clear-maingroup project_file" << std::endl
+ << " Removes all resource file references from a project." << std::endl
+ << std::endl
+ << " " << appName << " --add-file project_file path_to_file_to_add" << std::endl
+ << " Adds an existing file or directory to a project." << std::endl
+ << std::endl
<< " " << appName << " --get-version project_file" << std::endl
<< " Returns the version number of a project." << std::endl
<< std::endl
@@ -906,6 +961,8 @@ int performCommandLine (const ArgumentList& args)
if (matchCommand ("help")) { showHelp(); return 0; }
if (matchCommand ("h")) { showHelp(); return 0; }
if (matchCommand ("resave")) { resaveProject (args, false); return 0; }
+ if (matchCommand ("clear-maingroup")) { clearMainGroup (args); return 0; }
+ if (matchCommand ("add-file")) { addFile (args); return 0; }
if (matchCommand ("resave-resources")) { resaveProject (args, true); return 0; }
if (matchCommand ("get-version")) { getVersion (args); return 0; }
if (matchCommand ("set-version")) { setVersion (args); return 0; }
copy the patch and save it to a file, e.g., |
Added new subcommand to Projucer command line. Projucer --clear-maingroup jucerfile.jucer
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Added new subcommands to Projucer command line.
Projucer --clear-maingroup jucerfile.jucer
Projucer --add-file jucerfile.jucer path/to/file/or/directory/to/add/project
Feature request https://forum.juce.com/t/projucer-add-folder-file-via-command-line/50732