Skip to content

Commit 412c4fb

Browse files
committed
issue doxygen#9187 doxygen -x_noenv option to not expand environment variables
Adding the possibility to retain the environment variables (`$(...)`) in the doxyfile when looking for differences with the default settings.
1 parent 57efad4 commit 412c4fb

File tree

3 files changed

+26
-15
lines changed

3 files changed

+26
-15
lines changed

src/config.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
//#endif
4444
//! @}
4545

46+
enum class DoxyfileSettings { Full, Compressed, CompressedNoEnv };
4647
class TextStream;
4748

4849
/** \brief Public function to deal with the configuration file. */
@@ -60,7 +61,7 @@ namespace Config
6061
/*! Writes a the differences between the current configuration and the
6162
* template configuration to stream \a t.
6263
*/
63-
void compareDoxyfile(TextStream &t);
64+
void compareDoxyfile(TextStream &t, DoxyfileSettings diffList);
6465

6566
/*! Writes a the used settings of the current configuration as XML format
6667
* to stream \a t.
@@ -76,10 +77,10 @@ namespace Config
7677
/*! Post processed the parsed data. Replaces raw string values by the actual values.
7778
* and replaces environment variables.
7879
* \param clearHeaderAndFooter set to TRUE when writing header and footer templates.
79-
* \param compare signals if we in Doxyfile compare (`-x`) mode are or not. Influences
80-
* setting of the default value.
80+
* \param compare signals if we in Doxyfile compare (`-x` or `-x_noenv`) mode are or not.
81+
* Influences setting of the default value and replacement of environment variables.
8182
*/
82-
void postProcess(bool clearHeaderAndFooter, bool compare = FALSE);
83+
void postProcess(bool clearHeaderAndFooter, DoxyfileSettings compare = DoxyfileSettings::Full);
8384

8485
/*! Check the validity of the parsed options and correct or warn the user where needed.
8586
* \param quiet setting for the QUIET option (can have been overruled by means of a command line option)

src/configimpl.l

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2063,9 +2063,9 @@ void Config::writeTemplate(TextStream &t,bool shortList,bool update)
20632063
ConfigImpl::instance()->writeTemplate(t,shortList,update);
20642064
}
20652065

2066-
void Config::compareDoxyfile(TextStream &t)
2066+
void Config::compareDoxyfile(TextStream &t,DoxyfileSettings diffList)
20672067
{
2068-
postProcess(FALSE, TRUE);
2068+
postProcess(FALSE, diffList);
20692069
ConfigImpl::instance()->compareDoxyfile(t);
20702070
}
20712071

@@ -2087,10 +2087,10 @@ bool Config::parse(const QCString &fileName,bool update)
20872087
return parseRes;
20882088
}
20892089

2090-
void Config::postProcess(bool clearHeaderAndFooter, bool compare)
2090+
void Config::postProcess(bool clearHeaderAndFooter, DoxyfileSettings diffList)
20912091
{
2092-
ConfigImpl::instance()->substituteEnvironmentVars();
2093-
if (!compare)ConfigImpl::instance()->emptyValueToDefault();
2092+
if (diffList != DoxyfileSettings::CompressedNoEnv) ConfigImpl::instance()->substituteEnvironmentVars();
2093+
if (diffList == DoxyfileSettings::Full)ConfigImpl::instance()->emptyValueToDefault();
20942094
ConfigImpl::instance()->convertStrToVal();
20952095

20962096
// avoid bootstrapping issues when the g_config file already

src/doxygen.cpp

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9627,14 +9627,14 @@ static void generateConfigFile(const QCString &configFile,bool shortList,
96279627
}
96289628
}
96299629

9630-
static void compareDoxyfile()
9630+
static void compareDoxyfile(DoxyfileSettings diffList)
96319631
{
96329632
std::ofstream f;
96339633
bool fileOpened=openOutputFile("-",f);
96349634
if (fileOpened)
96359635
{
96369636
TextStream t(&f);
9637-
Config::compareDoxyfile(t);
9637+
Config::compareDoxyfile(t,diffList);
96389638
}
96399639
else
96409640
{
@@ -10640,6 +10640,9 @@ static void usage(const QCString &name,const QCString &versionString)
1064010640
msg(" If - is used for extensionsFile doxygen will write to standard output.\n\n");
1064110641
msg("7) Use doxygen to compare the used configuration file with the template configuration file\n");
1064210642
msg(" %s -x [configFile]\n\n",qPrint(name));
10643+
msg(" Use doxygen to compare the used configuration file with the template configuration file");
10644+
msg(" without replacing the environment variables\n");
10645+
msg(" %s -x_noenv [configFile]\n\n",qPrint(name));
1064310646
msg("8) Use doxygen to show a list of built-in emojis.\n");
1064410647
msg(" %s -f emoji outputFileName\n\n",qPrint(name));
1064510648
msg(" If - is used for outputFileName doxygen will write to standard output.\n\n");
@@ -10823,7 +10826,7 @@ void readConfiguration(int argc, char **argv)
1082310826
QCString listName;
1082410827
bool genConfig=FALSE;
1082510828
bool shortList=FALSE;
10826-
bool diffList=FALSE;
10829+
DoxyfileSettings diffList=DoxyfileSettings::Full;
1082710830
bool updateConfig=FALSE;
1082810831
int retVal;
1082910832
bool quiet = false;
@@ -10868,7 +10871,14 @@ void readConfiguration(int argc, char **argv)
1086810871
}
1086910872
break;
1087010873
case 'x':
10871-
diffList=TRUE;
10874+
if (!strcmp(argv[optInd]+1,"x_noenv")) diffList=DoxyfileSettings::CompressedNoEnv;
10875+
else if (!strcmp(argv[optInd]+1,"x")) diffList=DoxyfileSettings::Compressed;
10876+
else
10877+
{
10878+
err("option should be \"-x\" or \"-x_noenv\", found: \"%s\".\n",argv[optInd]);
10879+
cleanUpDoxygen();
10880+
exit(1);
10881+
}
1087210882
break;
1087310883
case 's':
1087410884
shortList=TRUE;
@@ -11187,10 +11197,10 @@ void readConfiguration(int argc, char **argv)
1118711197
exit(1);
1118811198
}
1118911199

11190-
if (diffList)
11200+
if (diffList!=DoxyfileSettings::Full)
1119111201
{
1119211202
Config::updateObsolete();
11193-
compareDoxyfile();
11203+
compareDoxyfile(diffList);
1119411204
cleanUpDoxygen();
1119511205
exit(0);
1119611206
}

0 commit comments

Comments
 (0)