16 docs_filter <<
"*.dox" <<
"Doxyfile" <<
"footer.html" <<
"header.html" <<
"customdoxygen.css" <<
"*.dia" <<
"*.uml" <<
"*.txt" <<
"*.pdf" <<
"*.doc" <<
"*.docx" <<
"*.tcw" <<
"*.tct" <<
"*.dwg" ;
19 source_filter <<
"*.c" <<
"*.cpp" <<
"*.h" <<
".hpp" <<
"*.ui" <<
"*.pro" <<
"*.pro.user" <<
"*.qrc" <<
"*.php" <<
"*.php" <<
"*.php4" <<
"*.php5" <<
"*.py" <<
"*.f" <<
"*.for" <<
"*.js" <<
"*.sh" <<
"*.sql";
26 const QString Message)
30 log_entry.
Mode = Mode;
109 if (!doxygen.waitForStarted())
118 doxygen.closeWriteChannel();
119 if (!doxygen.waitForFinished( 480000 ))
129 QFile file(source_file);
150 QMap<QString, QString> subs_map = Project->
SubsMap;
157 QString found_key = SourceLine.sliced(key_start, (key_end - key_start));
158 QString found_value = subs_map.value(found_key);
159 SourceLine.replace(found_key, found_value);
174 QFile output_file( DestinationFile );
177 if ( output_file.remove() )
183 if (output_file.exists())
197 if (output_file.open(QIODevice::ReadWrite))
199 QTextStream out( &output_file );
201 QFile input_file( SourceFile );
202 if (input_file.open(QIODevice::ReadOnly))
204 QTextStream in( &input_file );
208 QString line = in.readLine();
209 QString output_line =
UpdateLine(Project, line);
210 out << output_line <<
"\n";
214 LogAdd(
LOG_DEBUG,
MODE_FILE, QString(
"Update of File " ) + SourceFile +
" to " + DestinationFile + QString(
" completed." ) );
235 QFileInfo srcFileInfo(srcFilePath);
236 if (srcFileInfo.isDir())
239 QDir targetDir(tgtFilePath);
240 if ( !targetDir.exists() )
244 if (!targetDir.mkpath (QFileInfo (tgtFilePath).fileName ()))
251 QDir sourceDir(srcFilePath);
252 QStringList fileNames = sourceDir.entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot | QDir::Hidden | QDir::System);
253 foreach (
const QString &fileName, fileNames) {
254 const QString newSrcFilePath
255 = srcFilePath + QLatin1Char(
'/') + fileName;
256 const QString newTgtFilePath
257 = tgtFilePath + QLatin1Char(
'/') + fileName;
268 if (!
UpdateFile(Store, srcFilePath, tgtFilePath ))
270 LogAdd(
LOG_ERROR,
MODE_FILE, QString(
"Error in file translation from '" ) + srcFilePath + QString(
"' to '") + tgtFilePath +
"." );
285 QString code_directory = source_directory +
"/source/" + ProjectInfo->
ProjectDesc.
ExeName;
294 if (!dir.mkpath(destination_directory +
"/html"))
296 LogAdd(
LOG_ERROR,
MODE_FILE, QString(
"Default webpage directory for Project %1 was NOT created.").arg(project_ident));
303 if (
UpdateFile (ProjectInfo, source_directory +
"/defaults/index.html", destination_directory +
"/html/index.html"))
320 QString cloc_output =
CountLines(ProjectInfo, code_directory);
321 ProjectInfo->
SubsMap.insert(
"[#CLOC_INFO#]", cloc_output);
325 ProjectInfo->
SubsMap.insert(
"[#LIBRARY_LIST#]", ldd_output);
331 cpp_check =
CppCheck( ProjectInfo );
335 cpp_check =
"Currently Only available for C/C++ language.";
337 ProjectInfo->
SubsMap.insert(
"[#CPP_CHECK#]", cpp_check);
340 QString dir_name = source_directory +
"/autosrc";
352 QString source_image_directory = source_directory +
"/images";
353 QString destination_image_directory = destination_directory +
"/images";
355 if (
RecursiveCopy(source_image_directory, destination_image_directory))
365 QString source_docs_directory = source_directory +
"/docs";
366 QString destination_docs_directory = destination_directory +
"/docs";
369 if (
RecursiveCopy(source_docs_directory, destination_docs_directory))
396 dir.removeRecursively();
400 result = dir.mkpath(Directory);
416 dir.setNameFilters(FileFilter);
417 QStringList file_list = dir.entryList(QDir::Files | QDir::NoDotAndDotDot | QDir::NoSymLinks, QDir::NoSort);
418 for (
int index = 0; index < file_list.size(); ++index)
420 if (!dir.remove(file_list.at(index))) result =
false;
428 QString html_result_table =
"<TABLE BORDER=1><TR><TH>Language</TH><TH>Files</TH><TH>Blank</TH><TH>Comment</TH><TH>Code</TH></TR>";
429 QString html_result_rows =
"";
430 QString html_result_totals =
"";
432 QDir::setCurrent( Directory );
436 QString output_file = scratchdir +
"cloc_output.txt";
438 cloc.setStandardErrorFile( scratchdir +
"cloc_error.txt", QIODevice::WriteOnly | QIODevice::Text );
439 cloc.setStandardOutputFile( scratchdir +
"cloc_output.txt", QIODevice::WriteOnly | QIODevice::Text );
441 Arg << Directory <<
"--no-recurse";
442 cloc.start(
"cloc", QStringList() << Arg );
443 if (!cloc.waitForStarted())
446 html_result_table +=
"<TR><TD COLSPAN=5>Unable to Count Lines of Code.</TD></TR>";
452 if (!cloc.waitForFinished(100000))
455 html_result_table +=
"<TR><TD COLSPAN=5>Error occurred during Count Lines of Code.</TD></TR>";
462 QFile cloc_file(output_file);
463 if ( !cloc_file.open( QIODevice::ReadOnly | QIODevice::Text ) )
466 html_result_table +=
"<TR><TD COLSPAN=5>Error occurred reading cloc results.</TD></TR>";
470 int comment_count = 0;
473 while( !cloc_file.atEnd() )
475 text_line = cloc_file.readLine();
476 if ( text_line.contains(
"----", Qt::CaseInsensitive ) )
483 if ( comment_count == 1 )
485 QStringList tokens= text_line.split(
" ",Qt::SkipEmptyParts);
487 html_result_table +=
"<TR><TD>" + tokens[0] +
"</TD><TD>" + tokens[1] +
"</TD><TD>" + tokens[2] +
"</TD><TD>" +
488 tokens[3] +
"</TD><TD>" + tokens[4] +
"</TD></TR>";
492 else if ( comment_count == 2 )
495 QString language_name = text_line.first(25);
496 language_name = language_name.trimmed();
497 text_line = text_line.mid(25);
498 QStringList tokens= text_line.split(
" ",Qt::SkipEmptyParts);
500 html_result_rows +=
"<TR><TD><B><span style=\"color:red\">" + language_name +
"</span></B></TD><TD><B><span style=\"color:red\">" + tokens[0] +
501 "</span></B></TD><TD><B><span style=\"color:red\">" + tokens[1] +
"</span></B></TD><TD><B><span style=\"color:red\">" +
502 tokens[2] +
"</span></B></TD><TD><B><span style=\"color:red\">" + tokens[3] +
"</span></B></TD></TR>";
504 else if (comment_count ==3)
506 QStringList tokens= text_line.split(
" ",Qt::SkipEmptyParts);
508 html_result_totals =
"<TR><TD><B>" + tokens[0] +
"</B></TD><TD>" + tokens[1] +
"</TD><TD>" + tokens[2] +
"</TD><TD>" +
509 tokens[3] +
"</TD><TD>" + tokens[4] +
"</TD></TR>";
517 html_result_table += html_result_rows + html_result_totals +
"</TABLE>";
522 return ( html_result_table );
528 QString table_string;
530 QFile ldd_file( ResultFilename );
531 if ( !ldd_file.open( QIODevice::ReadOnly | QIODevice::Text ) )
534 table_string +=
"<tr><td>Error occurred reading ldd results.</td></tr>";
538 while( !ldd_file.atEnd() )
540 QString text_line = ldd_file.readLine();
541 table_string += QString(
"<tr><td>" + text_line + QString(
"</td></tr>" ) );
546 table_string += QString(
"</table>" );
548 return( table_string );
556 QString html_result_table =
"<table><tr><th>Dynamic Libraries Linked to Program</th></tr>";
557 if ( QSysInfo::kernelType() ==
"linux" )
559 QFile exe_file(program_file);
562 if (exe_file.exists())
564 QFileDevice::Permissions permissions = exe_file.permissions();
565 if(permissions & QFileDevice::ExeOwner)
569 ldd.setStandardErrorFile( scratchdir +
"ldd_error.txt", QIODevice::WriteOnly | QIODevice::Text );
570 ldd.setStandardOutputFile( scratchdir +
"ldd_output.txt", QIODevice::WriteOnly | QIODevice::Text );
573 ldd.start(
"ldd", QStringList() << Arg );
574 if (!ldd.waitForStarted(10000))
577 html_result_table +=
"<tr><td>Error - Unable to find dynamically lined libraries.</td></tr>";
583 if ( !ldd.waitForFinished(100000))
586 html_result_table +=
"<tr><td>Error occurred while finding Dynamically Linked Libraries.</td></tr>";
595 QFile::remove( scratchdir +
"ldd_error.txt" );
596 QFile::remove( scratchdir +
"ldd_output.txt" );
600 html_result_table +=
"<tr><td>File is not currently directly executable.</td></tr>";
605 html_result_table +=
"<tr><td>File does not currently exist.</td></tr>";
610 html_result_table +=
"Currently only Linux Files can be checked for library requirements.</td></tr>";
612 html_result_table +=
"</TABLE>";
614 return ( html_result_table );
619 QString search_string =
"ProjectExplorer.ProjectConfiguration.DefaultDisplayName";
620 QString target_string;
621 QString version_string;
623 QTextStream in (&ProUserFile);
627 line = in.readLine();
628 if (!line.contains(search_string, Qt::CaseSensitive))
630 target_string = line;
634 while (!line.isNull());
637 if (!target_string.isNull())
639 int qt_index = line.indexOf(
"Qt");
642 int version_start = qt_index + 3;
643 int space_index = line.indexOf(
" ", version_start);
644 version_string = line.sliced(version_start, space_index - version_start);
647 return(version_string);
663 if (!dir.mkpath(destination_path))
673 dir.cd( source_path );
674 QString archive_file = destination_path +
"/" + ProjectInfo->
ProjectDesc.
ExeName +
".tar.gz";
678 Arg <<
"-czf" << archive_file <<
"--exclude=build" << source_path;
679 tar.start(
"tar", QStringList() << Arg );
680 if (!tar.waitForStarted())
688 tar.closeWriteChannel();
689 if (!tar.waitForFinished())
707 QString dev_language = DevLanguage.toUpper();
710 QStringList file_filter;
713 if ( dev_language ==
"ASM" )
715 file_filter <<
"*.asm" <<
"*.s";
717 else if ( dev_language ==
"BASH" )
719 file_filter <<
"*.sh";
721 else if ( dev_language ==
"BASIC" )
723 file_filter <<
"*.bas" <<
"*.vb";
725 else if ( dev_language ==
"C++" )
727 file_filter <<
"*.cpp" <<
"*.c" <<
"*.cxx" <<
"*.ino" <<
"*.h" <<
"*.hpp";
729 else if ( dev_language ==
"CAD" )
731 file_filter <<
"*.tcw" <<
"*.tct" <<
"*.dwg" <<
"*.stl" <<
"*.dxf";
733 else if ( dev_language ==
"FORTRAN" )
735 file_filter <<
"*.f" <<
"*.f90" <<
"*.f95" <<
"*.f03";
737 else if ( dev_language ==
"HTML" )
739 file_filter <<
"*.htm" <<
"*.html" <<
"*.css" <<
"*.js" <<
"*.php";
741 else if ( dev_language ==
"JAVA" )
743 file_filter <<
"*.java" <<
"*.jar" <<
"*.ins";
745 else if ( dev_language ==
"JAVASCRIPT" )
747 file_filter <<
"*.js";
749 else if ( dev_language ==
"OCTAVE" )
751 file_filter <<
"*.m";
753 else if ( dev_language ==
"PERL" )
755 file_filter <<
"*.pl" <<
"*.pm";
757 else if ( dev_language ==
"PHP" )
759 file_filter <<
"*.php" <<
"*.phtml" <<
"*.php3" <<
"*.php4" <<
"*.php5" <<
"*.php7" <<
"*.phps";
761 else if (dev_language ==
"LINDENSCRIPT")
763 file_filter <<
"*.lsl" <<
"*.osl" <<
"*.conf" <<
"*.config";
767 QDir source_directory( Directory );
768 source_directory.setFilter( QDir::Files | QDir::NoDotAndDotDot | QDir::Readable );
771 QStringList file_list;
772 file_list = source_directory.entryList( file_filter );
775 QFile result_file( ResultFileName );
776 if ( !result_file.open( QIODevice::WriteOnly | QIODevice::Text ) )
785 QTextStream out( &result_file );
788 for (
const auto& filename : file_list )
790 out << filename <<
"\n";
805 QString result_table;
811 QFile file(file_list);
823 QDir::setCurrent(directory);
830 cppcheck.setStandardErrorFile( error_file, QIODevice::WriteOnly | QIODevice::Text );
831 cppcheck.setStandardOutputFile( output_file, QIODevice::WriteOnly | QIODevice::Text );
833 arg <<
"--enable=all" <<
"-UDEBUG" <<
"--inconclusive" << QString(
"--file-list=" ) + file_list;
835 cppcheck.start(
"cppcheck", arg );
836 if (!cppcheck.waitForStarted(10000))
839 result_table +=
"ERROR - Unable to scan .cpp code.<BR>";
845 if (!cppcheck.waitForFinished(100000))
848 result_table +=
"ERROR - cppcheck failed during execution.<BR>";
855 QFile ccpcheck_file( error_file );
856 if ( !ccpcheck_file.open( QIODevice::ReadOnly | QIODevice::Text ) )
859 result_table +=
"ERROR - Unable to read ccpcheck results.<BR>";
863 while( !ccpcheck_file.atEnd() )
865 QString line = ccpcheck_file.readLine();
866 line.replace(
"/*!<",
"[").replace(
"*/",
"]");
867 result_table += line +
"<BR>";
872 QFile cpp_file(check_filename);
873 if (cpp_file.open(QIODevice::ReadWrite))
875 QTextStream stream(&cpp_file);
876 stream << result_table << Qt::endl;
891 return(result_table);
898 QFileInfo srcFileInfo(Source);
899 if (srcFileInfo.isDir())
902 QDir targetDir(Destination);
903 if ( !targetDir.exists() )
907 if (!targetDir.mkpath(QFileInfo(Destination).fileName()))
914 QDir sourceDir(Source);
915 QStringList fileNames = sourceDir.entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot | QDir::Hidden | QDir::System);
916 foreach (
const QString &fileName, fileNames)
918 const QString newSrcFilePath = Source + QLatin1Char(
'/') + fileName;
919 const QString newTgtFilePath = Destination + QLatin1Char(
'/') + fileName;
930 if (!QFile(Source).copy(Destination))
return(
false);
QString FindQtBuildVersion(QString ConfigFile)
Find the Qt Builder Version.
Worker(QObject *parent=nullptr)
Worker Class Constructor.
QStringList source_filter
void DoWork(PROJECT_INFORMATION *ProjectInfo)
Process the Generation of Documentation by Doxygen & other processes.
void DoDoxygen(PROJECT_INFORMATION *ProjectInfo)
Run Doxygen to Generate the Source Documentaiton.
bool CreateSourceListFile(const QString Directory, const QString ResultFileName, const QString DevLanguage)
Create a List of Project Software Source Files.
QString ParserLddResults(QString ResultFilename)
Converts the Library List into an HTML compatible format.
bool TrimDirectory(QString Directory, QStringList FileFilter)
Remove files defined by the FileFilter from the Directory.
bool CreateInstallScript(PROJECT_INFORMATION *ProjectInfo)
bool CleanDirectory(QString Directory)
Clean a Directory Tree by recursively removing all files and subdirectories.
QString CountLines(PROJECT_INFORMATION *Store, QString Directory)
bool TranslateRecursively(PROJECT_INFORMATION *Store, const QString &srcFilePath, const QString &tgtFilePath)
Recursively process text substituition for a Directory Tree.
void LogAdd(LOGGING_SEVERITY Severity, LOGGING_MODE Mode, const QString Message)
Send Message to the Log.
QString CppCheck(PROJECT_INFORMATION *ProjectInfo)
Conduct Static Analysis of C++ code.
void SendLogEntry(REMOTE_LOG_ENTRY LogEntry)
QString UpdateLine(PROJECT_INFORMATION *Project, QString SourceLine)
Process text substitutions for a single line.
bool UpdateFile(PROJECT_INFORMATION *Project, QString SourceFile, QString DestinationFile)
Process text substituitions for a complete text file.
bool CreateSourceArchive(PROJECT_INFORMATION *Store)
Create an Archive using git.
bool RecursiveCopy(QString Source, QString Destination)
void WorkDone(PROJECT_INFORMATION *ProjectInfo)
QString FindLibraries(PROJECT_INFORMATION *Store)
Find the shared libraries the program needs to run.
bool PreProcessProject(PROJECT_INFORMATION *ProjectInfo)
Preprocess the Project's Documentation.
bool CreatePublishList(PROJECT_INFORMATION *ProjectInfo)
#define DOXY_LOG_FILE
The name of the Doxygen Log File.
#define EXCLUDE_PROJECT_LIST
Exclude Project from Public List Mask.
#define CONTROL_DOC_ACCESS
Control Document Access to Public Mask.
@ TARGET_OPEN_SIM_PROJECT
#define ONLY_DEFAULT_PAGE
Only Display Default Page to Public Mask.
#define CREATE_SOURCE_ARCHIVE
Create a SOurce Archive when Documentation Generated.
LOGGING_SEVERITY
Log Severity allow the selection of logging events based on Severity.
LOGGING_MODE
Log Severity allow the selection of logging events based on the mode.
ProjectOptionsManager * project_opts_manager
Class Controlling the Database Creation.
Class for Reading Projects.
LOGGING_SEVERITY Severity