diff options
author | Dimitri van Heesch <doxygen@gmail.com> | 2020-07-30 09:36:55 (GMT) |
---|---|---|
committer | Dimitri van Heesch <doxygen@gmail.com> | 2020-07-30 09:36:55 (GMT) |
commit | 4ae47ae6f238d465eefa1b5a85c0cf3f7857bc57 (patch) | |
tree | 82d3a308c856cd7380fa8671bd2fe861d667bf7c | |
parent | d24fde41af551a2e6b2592e0b4084b6f449abf83 (diff) | |
download | Doxygen-4ae47ae6f238d465eefa1b5a85c0cf3f7857bc57.zip Doxygen-4ae47ae6f238d465eefa1b5a85c0cf3f7857bc57.tar.gz Doxygen-4ae47ae6f238d465eefa1b5a85c0cf3f7857bc57.tar.bz2 |
Added configuration options to better control the sqlite3 output.
Still requires cmake -Duse_sqlite=YES to compile in support (and
libsqlite3)
New configuration options available:
- GENERATE_SQLITE3 enable/disable SQLITE3 output
- SQLITE3_OUTPUT configure directory where output is written to
(default: sqlite3)
- SQLITE3_RECREATE_DB controls if existing database file is overwritten
(default: YES)
-rw-r--r-- | src/config.xml | 17 | ||||
-rwxr-xr-x | src/configgen.py | 5 | ||||
-rw-r--r-- | src/doxygen.cpp | 20 | ||||
-rw-r--r-- | src/sqlite3gen.cpp | 20 |
4 files changed, 43 insertions, 19 deletions
diff --git a/src/config.xml b/src/config.xml index bc5f696..81610c0 100644 --- a/src/config.xml +++ b/src/config.xml @@ -3034,9 +3034,8 @@ front of it. </docs> </option> </group> -<!-- - <group name='Sqlite3' docs='Configuration options related to Sqlite3 output'> - <option type='bool' id='GENERATE_SQLITE3' defval='0'> + <group name='Sqlite3' setting='USE_SQLITE3' docs='Configuration options related to Sqlite3 output'> + <option type='bool' id='GENERATE_SQLITE3' setting='USE_SQLITE3' defval='0'> <docs> <![CDATA[ If the \c GENERATE_SQLITE3 tag is set to \c YES doxygen will generate a @@ -3044,7 +3043,7 @@ If the \c GENERATE_SQLITE3 tag is set to \c YES doxygen will generate a ]]> </docs> </option> - <option type='string' id='SQLITE3_OUTPUT' format='dir' defval='sqlite3' depends='GENERATE_SQLITE3'> + <option type='string' id='SQLITE3_OUTPUT' format='dir' defval='sqlite3' setting='USE_SQLITE3' depends='GENERATE_SQLITE3'> <docs> <![CDATA[ The \c SQLITE3_OUTPUT tag is used to specify where the \c Sqlite3 database will be put. @@ -3053,9 +3052,17 @@ put in front of it. ]]> </docs> </option> + <option type='bool' id='SQLITE3_RECREATE_DB' defval='1' setting='USE_SQLITE3' depends='GENERATE_SQLITE3'> + <docs> +<![CDATA[ +The \c SQLITE3_OVERWRITE_DB tag is set to \c YES, the existing doxygen_sqlite3.db +database file will be recreated with each doxygen run. +If set to \c NO, doxygen will warn if an a database file is already found and not modify it. +]]> + </docs> + </option> </group> ---> <group name='PerlMod' docs='Configuration options related to the Perl module output'> <option type='bool' id='GENERATE_PERLMOD' defval='0'> <docs> diff --git a/src/configgen.py b/src/configgen.py index 89eff6d..4ffa8f8 100755 --- a/src/configgen.py +++ b/src/configgen.py @@ -345,6 +345,9 @@ def parseOption(node): def parseGroups(node): name = node.getAttribute('name') doc = node.getAttribute('docs') + setting = node.getAttribute('setting') + if len(setting) > 0: + print("#if %s" % (setting)) print("%s%s" % (" //-----------------------------------------", "----------------------------------")) print(" cfg->addInfo(\"%s\",\"%s\");" % (name, doc)) @@ -354,6 +357,8 @@ def parseGroups(node): for n in node.childNodes: if n.nodeType == Node.ELEMENT_NODE: parseOption(n) + if len(setting) > 0: + print("#endif") def parseGroupMapGetter(node): diff --git a/src/doxygen.cpp b/src/doxygen.cpp index bc8eed7..dab7549 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -10920,13 +10920,15 @@ void parseInput() Config_updateString(MAN_OUTPUT,manOutput); } - //QCString sqlOutput; - //bool &generateSql = Config_getBool(GENERATE_SQLITE3); - //if (generateSql) - //{ - // sqlOutput = createOutputDirectory(outputDirectory,Config_getString(SQLITE3_OUTPUT),"/sqlite3"); - // Config_update(SQLITE3_OUTPUT,sqlOutput); - //} +#if USE_SQLITE3 + QCString sqlOutput; + bool generateSql = Config_getBool(GENERATE_SQLITE3); + if (generateSql) + { + sqlOutput = createOutputDirectory(outputDirectory,Config_getString(SQLITE3_OUTPUT),"/sqlite3"); + Config_updateString(SQLITE3_OUTPUT,sqlOutput); + } +#endif if (Config_getBool(HAVE_DOT)) { @@ -11543,12 +11545,14 @@ void generateOutput() Doxygen::generatingXmlOutput=FALSE; g_s.end(); } - if (USE_SQLITE3) +#if USE_SQLITE3 + if (Config_getBool(GENERATE_SQLITE3)) { g_s.begin("Generating SQLITE3 output...\n"); generateSqlite3(); g_s.end(); } +#endif if (Config_getBool(GENERATE_AUTOGEN_DEF)) { diff --git a/src/sqlite3gen.cpp b/src/sqlite3gen.cpp index 77aab68..2f72221 100644 --- a/src/sqlite3gen.cpp +++ b/src/sqlite3gen.cpp @@ -2503,11 +2503,10 @@ static void generateSqlite3ForPage(const PageDef *pd,bool isExample) static sqlite3* openDbConnection() { - QCString outputDirectory = Config_getString(OUTPUT_DIRECTORY); + QCString outputDirectory = Config_getString(SQLITE3_OUTPUT); QDir sqlite3Dir(outputDirectory); sqlite3 *db; int rc; - struct stat buf; rc = sqlite3_initialize(); if (rc != SQLITE_OK) @@ -2516,15 +2515,24 @@ static sqlite3* openDbConnection() return NULL; } + QCString dbFileName = "doxygen_sqlite3.db"; + QFileInfo fi(outputDirectory+"/"+dbFileName); - if (stat (outputDirectory+"/doxygen_sqlite3.db", &buf) == 0) + if (fi.exists()) { - err("doxygen_sqlite3.db already exists! Rename, remove, or archive it to regenerate\n"); - return NULL; + if (Config_getBool(SQLITE3_RECREATE_DB)) + { + QDir().remove(fi.absFilePath()); + } + else + { + err("doxygen_sqlite3.db already exists! Rename, remove, or archive it to regenerate\n"); + return NULL; + } } rc = sqlite3_open_v2( - outputDirectory+"/doxygen_sqlite3.db", + fi.absFilePath().utf8(), &db, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, 0 |