doxygen: add support for EXCLUDE keyword
authorAntoine Musso <hashar@users.mediawiki.org>
Sat, 5 Feb 2011 13:54:26 +0000 (13:54 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Sat, 5 Feb 2011 13:54:26 +0000 (13:54 +0000)
maintenance/Doxyfile
maintenance/mwdocgen.php

index 54af6e0..6596801 100644 (file)
@@ -134,9 +134,9 @@ FILE_PATTERNS          = *.c \
                          *.MM \
                          *.PY
 RECURSIVE              = YES
-EXCLUDE                = 
+EXCLUDE                = {{EXCLUDE}} 
 EXCLUDE_SYMLINKS       = YES
-EXCLUDE_PATTERNS       = LocalSettings.php AdminSettings.php StartProfiler.php .svn */.git/* {{EXCLUDE}}
+EXCLUDE_PATTERNS       = LocalSettings.php AdminSettings.php StartProfiler.php .svn */.git/* {{EXCLUDE_PATTERNS}}
 EXAMPLE_PATH           = 
 EXAMPLE_PATTERNS       = *
 EXAMPLE_RECURSIVE      = NO
index 9fceeb2..790a27c 100644 (file)
@@ -69,9 +69,15 @@ $mwPathL = $mwPath . 'languages/';
 $mwPathM = $mwPath . 'maintenance/';
 $mwPathS = $mwPath . 'skins/';
 
+/** Ignored paths relative to $mwPath */
+$mwExcludePaths = array(
+       'images',
+       'static',
+);
+
 /** Variable to get user input */
 $input = '';
-$exclude = '';
+$exclude_patterns = '';
 
 #
 # Functions
@@ -142,13 +148,18 @@ function getSvnRevision( $dir ) {
  * @param $currentVersion String: Version number of the software
  * @param $svnstat String: path to the svnstat file
  * @param $input String: Path to analyze.
- * @param $exclude String: Additionals path regex to exclude
+ * @param $exclude_patterns String: Additionals path regex to exclude
  *                 (LocalSettings.php, AdminSettings.php, .svn and .git directories are always excluded)
  */
-function generateConfigFile( $doxygenTemplate, $outputDirectory, $stripFromPath, $currentVersion, $svnstat, $input, $exclude ) {
+function generateConfigFile( $doxygenTemplate, $outputDirectory, $stripFromPath, $currentVersion, $svnstat, $input, $exclude_patterns ) {
 
        $template = file_get_contents( $doxygenTemplate );
 
+       // Generate path exclusions
+       global $mwExcludePaths, $mwPath;
+       $excludedPaths = $mwPath . join( " $mwPath", $mwExcludePaths ); 
+       print "EXCLUDE: $excludedPaths\n\n";
+
        // Replace template placeholders by correct values.
        $replacements = array(
                '{{OUTPUT_DIRECTORY}}' => $outputDirectory,
@@ -156,7 +167,8 @@ function generateConfigFile( $doxygenTemplate, $outputDirectory, $stripFromPath,
                '{{CURRENT_VERSION}}'  => $currentVersion,
                '{{SVNSTAT}}'          => $svnstat,
                '{{INPUT}}'            => $input,
-               '{{EXCLUDE}}'          => $exclude,
+               '{{EXCLUDE}}'          => $excludedPaths,
+               '{{EXCLUDE_PATTERNS}}' => $exclude_patterns,
                '{{HAVE_DOT}}'         => `which dot` ? 'YES' : 'NO',
        );
        $tmpCfg = str_replace( array_keys( $replacements ), array_values( $replacements ), $template );
@@ -224,7 +236,7 @@ case 5:
        $input = $mwPath . $file;
 case 6:
        $input = $mwPath;
-       $exclude = 'extensions';
+       $exclude_patterns = 'extensions';
 }
 
 $versionNumber = getSvnRevision( $input );
@@ -235,7 +247,7 @@ if ( $versionNumber === false ) { # Not using subversion ?
        $version = "trunk (r$versionNumber)";
 }
 
-$generatedConf = generateConfigFile( $doxygenTemplate, $doxyOutput, $mwPath, $version, $svnstat, $input, $exclude );
+$generatedConf = generateConfigFile( $doxygenTemplate, $doxyOutput, $mwPath, $version, $svnstat, $input, $exclude_patterns );
 $command = $doxygenBin . ' ' . $generatedConf;
 
 echo <<<TEXT