diff --git a/extras/Introjucer/Source/Application/jucer_CommandLine.cpp b/extras/Introjucer/Source/Application/jucer_CommandLine.cpp index 3b577e8500..239eb68f5c 100644 --- a/extras/Introjucer/Source/Application/jucer_CommandLine.cpp +++ b/extras/Introjucer/Source/Application/jucer_CommandLine.cpp @@ -36,6 +36,17 @@ namespace return File::getCurrentWorkingDirectory().getChildFile (filename.unquoted()); } + bool checkArgumentCount (const StringArray& tokens, int minNumArgs) + { + if (tokens.size() < minNumArgs) + { + std::cout << "Not enough arguments!" << std::endl; + return false; + } + + return true; + } + //============================================================================== /* Running a command-line of the form "introjucer --resave foobar.jucer" will try to load that project and re-export all of its targets. @@ -125,11 +136,8 @@ namespace int buildModules (const StringArray& tokens, const bool buildAllWithIndex) { - if (tokens.size() < 3) - { - std::cout << "Not enough arguments!" << std::endl; + if (! checkArgumentCount (tokens, 3)) return 1; - } const File targetFolder (getFile (tokens[1])); @@ -196,6 +204,37 @@ namespace return 0; } + + int showStatus (const StringArray& tokens) + { + if (! checkArgumentCount (tokens, 2)) + return 1; + + const File projectFile (getFile (tokens[1])); + + Project proj (projectFile); + + if (proj.loadDocument (projectFile).isNotEmpty()) + { + std::cout << "Failed to load project: " << projectFile.getFullPathName() << std::endl; + return 1; + } + + std::cout << "Project file: " << projectFile.getFullPathName() << std::endl + << "Name: " << proj.getProjectName().toString() << std::endl + << "UID: " << proj.getProjectUID() << std::endl; + + const int numModules = proj.getNumModules(); + if (numModules > 0) + { + std::cout << "Modules:" << std::endl; + + for (int i = 0; i < numModules; ++i) + std::cout << " " << proj.getModuleID (i) << std::endl; + } + + return 0; + } } //============================================================================== @@ -217,5 +256,8 @@ int performCommandLine (const String& commandLine) if (tokens[0] == "listmodules") return listModules(); + if (tokens[0] == "status") + return showStatus (tokens); + return commandLineNotPerformed; } diff --git a/extras/Introjucer/Source/Project Saving/jucer_ProjectSaver.h b/extras/Introjucer/Source/Project Saving/jucer_ProjectSaver.h index 33ddfa09a6..699645253d 100644 --- a/extras/Introjucer/Source/Project Saving/jucer_ProjectSaver.h +++ b/extras/Introjucer/Source/Project Saving/jucer_ProjectSaver.h @@ -196,7 +196,7 @@ private: static bool shouldFileBeKept (const String& filename) { - const char* filesToKeep = { ".svn", ".cvs", "CMakeLists.txt" }; + const char* filesToKeep[] = { ".svn", ".cvs", "CMakeLists.txt" }; for (int i = 0; i < numElementsInArray (filesToKeep); ++i) if (filename == filesToKeep[i]) @@ -256,9 +256,8 @@ private: const String headerGuard ("__JUCE_APPCONFIG_" + project.getProjectUID().toUpperCase() + "__"); out << "#ifndef " << headerGuard << newLine << "#define " << headerGuard << newLine - << newLine; - - out << "//==============================================================================" << newLine; + << newLine + << "//==============================================================================" << newLine; const int longestName = findLongestModuleName (modules); diff --git a/extras/Introjucer/Source/Project/jucer_Project.cpp b/extras/Introjucer/Source/Project/jucer_Project.cpp index 1577937b6c..a5f0710383 100644 --- a/extras/Introjucer/Source/Project/jucer_Project.cpp +++ b/extras/Introjucer/Source/Project/jucer_Project.cpp @@ -878,6 +878,16 @@ void Project::createRequiredModules (const ModuleList& availableModules, OwnedAr modules.add (availableModules.modules.getUnchecked(i)->create()); } +int Project::getNumModules() const +{ + return projectRoot.getChildWithName (Tags::modulesGroup).getNumChildren(); +} + +String Project::getModuleID (int index) const +{ + return projectRoot.getChildWithName (Tags::modulesGroup).getChild (index) [Ids::id_].toString(); +} + //============================================================================== ValueTree Project::getConfigurations() const { diff --git a/extras/Introjucer/Source/Project/jucer_Project.h b/extras/Introjucer/Source/Project/jucer_Project.h index 78a03c278a..5a3e0b7e63 100644 --- a/extras/Introjucer/Source/Project/jucer_Project.h +++ b/extras/Introjucer/Source/Project/jucer_Project.h @@ -275,6 +275,8 @@ public: void addModule (const String& moduleID); void removeModule (const String& moduleID); + int getNumModules() const; + String getModuleID (int index) const; void createRequiredModules (const ModuleList& availableModules, OwnedArray& modules) const;