r36636 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r36635‎ | r36636 | r36637 >
Date:13:42, 25 June 2008
Author:ialex
Status:old
Tags:
Comment:
Some tweaks to the doxygen doc:
* Removed maintenance/mwdoxygen.cfg file and "make doxydoc", doxygen is already supported by default in mwdocgen.php
* Added svn revisions numbers to the doc if Subversion is installed.
Modified paths:
  • /trunk/phase3/bin/svnstat (modified) (history)
  • /trunk/phase3/maintenance/Doxyfile (modified) (history)
  • /trunk/phase3/maintenance/Makefile (modified) (history)
  • /trunk/phase3/maintenance/mwdocgen.php (modified) (history)
  • /trunk/phase3/maintenance/mwdoxygen.cfg (deleted) (history)

Diff [purge]

Index: trunk/phase3/maintenance/mwdoxygen.cfg
@@ -1,230 +0,0 @@
2 -# Doxyfile 1.5.1
3 -
4 -#---------------------------------------------------------------------------
5 -# Project related configuration options
6 -#---------------------------------------------------------------------------
7 -PROJECT_NAME = MediaWiki
8 -PROJECT_NUMBER = MW_VERSION_PLACEHOLDER
9 -OUTPUT_DIRECTORY = docs
10 -CREATE_SUBDIRS = NO
11 -OUTPUT_LANGUAGE = English
12 -USE_WINDOWS_ENCODING = NO
13 -BRIEF_MEMBER_DESC = YES
14 -REPEAT_BRIEF = YES
15 -ABBREVIATE_BRIEF =
16 -ALWAYS_DETAILED_SEC = YES
17 -INLINE_INHERITED_MEMB = NO
18 -FULL_PATH_NAMES = YES
19 -STRIP_FROM_PATH =
20 -STRIP_FROM_INC_PATH =
21 -SHORT_NAMES = NO
22 -JAVADOC_AUTOBRIEF = YES
23 -MULTILINE_CPP_IS_BRIEF = NO
24 -DETAILS_AT_TOP = YES
25 -INHERIT_DOCS = YES
26 -SEPARATE_MEMBER_PAGES = NO
27 -TAB_SIZE = 4
28 -ALIASES =
29 -OPTIMIZE_OUTPUT_FOR_C = NO
30 -OPTIMIZE_OUTPUT_JAVA = NO
31 -BUILTIN_STL_SUPPORT = NO
32 -DISTRIBUTE_GROUP_DOC = NO
33 -SUBGROUPING = YES
34 -#---------------------------------------------------------------------------
35 -# Build related configuration options
36 -#---------------------------------------------------------------------------
37 -EXTRACT_ALL = YES
38 -EXTRACT_PRIVATE = YES
39 -EXTRACT_STATIC = YES
40 -EXTRACT_LOCAL_CLASSES = YES
41 -EXTRACT_LOCAL_METHODS = NO
42 -HIDE_UNDOC_MEMBERS = NO
43 -HIDE_UNDOC_CLASSES = NO
44 -HIDE_FRIEND_COMPOUNDS = NO
45 -HIDE_IN_BODY_DOCS = NO
46 -INTERNAL_DOCS = NO
47 -CASE_SENSE_NAMES = YES
48 -HIDE_SCOPE_NAMES = NO
49 -SHOW_INCLUDE_FILES = YES
50 -INLINE_INFO = YES
51 -SORT_MEMBER_DOCS = YES
52 -SORT_BRIEF_DOCS = NO
53 -SORT_BY_SCOPE_NAME = NO
54 -GENERATE_TODOLIST = YES
55 -GENERATE_TESTLIST = YES
56 -GENERATE_BUGLIST = YES
57 -GENERATE_DEPRECATEDLIST= YES
58 -ENABLED_SECTIONS =
59 -MAX_INITIALIZER_LINES = 30
60 -SHOW_USED_FILES = YES
61 -SHOW_DIRECTORIES = YES
62 -FILE_VERSION_FILTER = bin/svnstat
63 -#---------------------------------------------------------------------------
64 -# configuration options related to warning and progress messages
65 -#---------------------------------------------------------------------------
66 -QUIET = NO
67 -WARNINGS = YES
68 -WARN_IF_UNDOCUMENTED = YES
69 -WARN_IF_DOC_ERROR = YES
70 -WARN_NO_PARAMDOC = NO
71 -WARN_FORMAT = "$file:$line: $text"
72 -WARN_LOGFILE =
73 -#---------------------------------------------------------------------------
74 -# configuration options related to the input files
75 -#---------------------------------------------------------------------------
76 -INPUT = config \
77 - includes \
78 - maintenance \
79 - skins \
80 - tests
81 -FILE_PATTERNS = *.php \
82 - *.inc
83 -RECURSIVE = NO
84 -EXCLUDE =
85 -EXCLUDE_SYMLINKS = NO
86 -EXCLUDE_PATTERNS =
87 -EXAMPLE_PATH =
88 -EXAMPLE_PATTERNS =
89 -EXAMPLE_RECURSIVE = NO
90 -IMAGE_PATH =
91 -INPUT_FILTER =
92 -FILTER_PATTERNS =
93 -FILTER_SOURCE_FILES = NO
94 -#---------------------------------------------------------------------------
95 -# configuration options related to source browsing
96 -#---------------------------------------------------------------------------
97 -SOURCE_BROWSER = NO
98 -INLINE_SOURCES = NO
99 -STRIP_CODE_COMMENTS = YES
100 -REFERENCED_BY_RELATION = YES
101 -REFERENCES_RELATION = YES
102 -REFERENCES_LINK_SOURCE = YES
103 -USE_HTAGS = NO
104 -VERBATIM_HEADERS = YES
105 -#---------------------------------------------------------------------------
106 -# configuration options related to the alphabetical class index
107 -#---------------------------------------------------------------------------
108 -ALPHABETICAL_INDEX = NO
109 -COLS_IN_ALPHA_INDEX = 5
110 -IGNORE_PREFIX =
111 -#---------------------------------------------------------------------------
112 -# configuration options related to the HTML output
113 -#---------------------------------------------------------------------------
114 -GENERATE_HTML = YES
115 -HTML_OUTPUT = html
116 -HTML_FILE_EXTENSION = .html
117 -HTML_HEADER =
118 -HTML_FOOTER =
119 -HTML_STYLESHEET =
120 -HTML_ALIGN_MEMBERS = YES
121 -GENERATE_HTMLHELP = NO
122 -CHM_FILE =
123 -HHC_LOCATION =
124 -GENERATE_CHI = NO
125 -BINARY_TOC = NO
126 -TOC_EXPAND = NO
127 -DISABLE_INDEX = NO
128 -ENUM_VALUES_PER_LINE = 4
129 -GENERATE_TREEVIEW = YES
130 -TREEVIEW_WIDTH = 250
131 -#---------------------------------------------------------------------------
132 -# configuration options related to the LaTeX output
133 -#---------------------------------------------------------------------------
134 -GENERATE_LATEX = NO
135 -LATEX_OUTPUT = latex
136 -LATEX_CMD_NAME = latex
137 -MAKEINDEX_CMD_NAME = makeindex
138 -COMPACT_LATEX = NO
139 -PAPER_TYPE = a4wide
140 -EXTRA_PACKAGES =
141 -LATEX_HEADER =
142 -PDF_HYPERLINKS = NO
143 -USE_PDFLATEX = NO
144 -LATEX_BATCHMODE = NO
145 -LATEX_HIDE_INDICES = NO
146 -#---------------------------------------------------------------------------
147 -# configuration options related to the RTF output
148 -#---------------------------------------------------------------------------
149 -GENERATE_RTF = NO
150 -RTF_OUTPUT = rtf
151 -COMPACT_RTF = NO
152 -RTF_HYPERLINKS = NO
153 -RTF_STYLESHEET_FILE =
154 -RTF_EXTENSIONS_FILE =
155 -#---------------------------------------------------------------------------
156 -# configuration options related to the man page output
157 -#---------------------------------------------------------------------------
158 -GENERATE_MAN = NO
159 -MAN_OUTPUT = man
160 -MAN_EXTENSION = .3
161 -MAN_LINKS = NO
162 -#---------------------------------------------------------------------------
163 -# configuration options related to the XML output
164 -#---------------------------------------------------------------------------
165 -GENERATE_XML = NO
166 -XML_OUTPUT = xml
167 -XML_SCHEMA =
168 -XML_DTD =
169 -XML_PROGRAMLISTING = YES
170 -#---------------------------------------------------------------------------
171 -# configuration options for the AutoGen Definitions output
172 -#---------------------------------------------------------------------------
173 -GENERATE_AUTOGEN_DEF = NO
174 -#---------------------------------------------------------------------------
175 -# configuration options related to the Perl module output
176 -#---------------------------------------------------------------------------
177 -GENERATE_PERLMOD = NO
178 -PERLMOD_LATEX = NO
179 -PERLMOD_PRETTY = YES
180 -PERLMOD_MAKEVAR_PREFIX =
181 -#---------------------------------------------------------------------------
182 -# Configuration options related to the preprocessor
183 -#---------------------------------------------------------------------------
184 -ENABLE_PREPROCESSING = NO
185 -MACRO_EXPANSION = NO
186 -EXPAND_ONLY_PREDEF = NO
187 -SEARCH_INCLUDES = YES
188 -INCLUDE_PATH =
189 -INCLUDE_FILE_PATTERNS =
190 -PREDEFINED =
191 -EXPAND_AS_DEFINED =
192 -SKIP_FUNCTION_MACROS = YES
193 -#---------------------------------------------------------------------------
194 -# Configuration::additions related to external references
195 -#---------------------------------------------------------------------------
196 -TAGFILES =
197 -GENERATE_TAGFILE =
198 -ALLEXTERNALS = NO
199 -EXTERNAL_GROUPS = YES
200 -PERL_PATH = /usr/bin/perl
201 -#---------------------------------------------------------------------------
202 -# Configuration options related to the dot tool
203 -#---------------------------------------------------------------------------
204 -CLASS_DIAGRAMS = YES
205 -HIDE_UNDOC_RELATIONS = YES
206 -HAVE_DOT = YES
207 -CLASS_GRAPH = YES
208 -COLLABORATION_GRAPH = NO
209 -GROUP_GRAPHS = YES
210 -UML_LOOK = NO
211 -TEMPLATE_RELATIONS = NO
212 -INCLUDE_GRAPH = YES
213 -INCLUDED_BY_GRAPH = YES
214 -CALL_GRAPH = NO
215 -CALLER_GRAPH = NO
216 -GRAPHICAL_HIERARCHY = YES
217 -DIRECTORY_GRAPH = YES
218 -DOT_IMAGE_FORMAT = png
219 -DOT_PATH =
220 -DOTFILE_DIRS =
221 -MAX_DOT_GRAPH_WIDTH = 1024
222 -MAX_DOT_GRAPH_HEIGHT = 1024
223 -MAX_DOT_GRAPH_DEPTH = 0
224 -DOT_TRANSPARENT = NO
225 -DOT_MULTI_TARGETS = NO
226 -GENERATE_LEGEND = YES
227 -DOT_CLEANUP = YES
228 -#---------------------------------------------------------------------------
229 -# Configuration::additions related to the search engine
230 -#---------------------------------------------------------------------------
231 -SEARCHENGINE = YES
Index: trunk/phase3/maintenance/mwdocgen.php
@@ -46,6 +46,9 @@
4747 /** doxygen configuration template for mediawiki */
4848 $doxygenTemplate = $mwPath . 'maintenance/Doxyfile';
4949
 50+/** svnstat command, used to get the version of each file */
 51+$svnstat = $mwPath . 'bin/svnstat';
 52+
5053 /** where Phpdoc should output documentation */
5154 #$doxyOutput = '/var/www/mwdoc/';
5255 $doxyOutput = $mwPath . 'docs' . DIRECTORY_SEPARATOR ;
@@ -59,47 +62,87 @@
6063 /** Variable to get user input */
6164 $input = '';
6265
63 -/** shell command that will be run */
64 -$command = $doxygenBin;
65 -
6666 #
6767 # Functions
6868 #
6969
70 -function readaline( $prompt = '') {
 70+/**
 71+ * Read a line from the shell
 72+ * @param $prompt String
 73+ */
 74+function readaline( $prompt = '' ){
7175 print $prompt;
7276 $fp = fopen( "php://stdin", "r" );
7377 $resp = trim( fgets( $fp, 1024 ) );
7478 fclose( $fp );
7579 return $resp;
 80+}
 81+
 82+/**
 83+ * Copied from SpecialVersion::getSvnRevision()
 84+ * @param $dir String
 85+ * @return Mixed: string or false
 86+ */
 87+function getSvnRevision( $dir ) {
 88+ // http://svnbook.red-bean.com/nightly/en/svn.developer.insidewc.html
 89+ $entries = $dir . '/.svn/entries';
 90+
 91+ if( !file_exists( $entries ) ) {
 92+ return false;
7693 }
7794
 95+ $content = file( $entries );
 96+
 97+ // check if file is xml (subversion release <= 1.3) or not (subversion release = 1.4)
 98+ if( preg_match( '/^<\?xml/', $content[0] ) ) {
 99+ // subversion is release <= 1.3
 100+ if( !function_exists( 'simplexml_load_file' ) ) {
 101+ // We could fall back to expat... YUCK
 102+ return false;
 103+ }
 104+
 105+ $xml = simplexml_load_file( $entries );
 106+
 107+ if( $xml ) {
 108+ foreach( $xml->entry as $entry ) {
 109+ if( $xml->entry[0]['name'] == '' ) {
 110+ // The directory entry should always have a revision marker.
 111+ if( $entry['revision'] ) {
 112+ return intval( $entry['revision'] );
 113+ }
 114+ }
 115+ }
 116+ }
 117+ return false;
 118+ } else {
 119+ // subversion is release 1.4
 120+ return intval( $content[3] );
 121+ }
 122+}
 123+
78124 /**
79125 * Generate a configuration file given user parameters and return the temporary filename.
80126 * @param $doxygenTemplate String: full path for the template.
81127 * @param $outputDirectory String: directory where the stuff will be output.
82128 * @param $stripFromPath String: path that should be stripped out (usually mediawiki base path).
 129+ * @param $currentVersion String: Version number of the software
 130+ * @param $svnstat String: path to the svnstat file
83131 * @param $input String: Path to analyze.
84132 */
85 -function generateConfigFile($doxygenTemplate, $outputDirectory, $stripFromPath, $input) {
86 - global $tmpPath ;
 133+function generateConfigFile( $doxygenTemplate, $outputDirectory, $stripFromPath, $currentVersion, $svnstat, $input ){
 134+ global $tmpPath;
87135
88 - $template = file_get_contents($doxygenTemplate);
 136+ $template = file_get_contents( $doxygenTemplate );
89137
90138 // Replace template placeholders by correct values.
91 - $tmpCfg = str_replace(
92 - array(
93 - '{{OUTPUT_DIRECTORY}}',
94 - '{{STRIP_FROM_PATH}}',
95 - '{{INPUT}}',
96 - ),
97 - array(
98 - $outputDirectory,
99 - $stripFromPath,
100 - $input,
101 - ),
102 - $template
103 - );
 139+ $replacements = array(
 140+ '{{OUTPUT_DIRECTORY}}' => $outputDirectory,
 141+ '{{STRIP_FROM_PATH}}' => $stripFromPath,
 142+ '{{CURRENT_VERSION}}' => $currentVersion,
 143+ '{{SVNSTAT}}' => $svnstat,
 144+ '{{INPUT}}' => $input,
 145+ );
 146+ $tmpCfg = str_replace( array_keys( $replacements ), array_values( $replacements ), $template );
104147 $tmpFileName = $tmpPath . 'mwdocgen'. rand() .'.tmp';
105148 file_put_contents( $tmpFileName , $tmpCfg ) or die("Could not write doxygen configuration to file $tmpFileName\n");
106149
@@ -128,14 +171,18 @@
129172 }
130173 }
131174
 175+// TODO : generate a list of paths ))
 176+
132177 if( $input === '' ) {
133 -?>Several documentation possibilities:
 178+ echo <<<OPTIONS
 179+Several documentation possibilities:
134180 0 : whole documentation (1 + 2 + 3 + 4)
135181 1 : only includes
136182 2 : only languages
137183 3 : only maintenance
138184 4 : only skins
139 - 5 : only a given file<?php
 185+ 5 : only a given file
 186+OPTIONS;
140187 while ( !is_numeric($input) )
141188 {
142189 $input = readaline( "\nEnter your choice [0]:" );
@@ -144,62 +191,48 @@
145192 }
146193 }
147194 }
148 -/*
 195+
149196 switch ($input) {
150 -case 0:
151 - $command .= " -f $mwBaseFiles -d $mwPathI,$mwPathL,$mwPathM,$mwPathS";
152 - break;
153 -case 1:
154 - $command .= "-d $mwPathI";
155 - break;
156 -case 2:
157 - $command .= "-d $mwPathL";
158 - break;
159 -case 3:
160 - $command .= "-d $mwPathM";
161 - break;
162 -case 4:
163 - $command .= "-d $mwPathS";
164 - break;
 197+case 0: $input = $mwPath; break;
 198+case 1: $input = $mwPathI; break;
 199+case 2: $input = $mwPathL; break;
 200+case 3: $input = $mwPathM; break;
 201+case 4: $input = $mwPathS; break;
165202 case 5:
166203 if( !isset( $file ) ) {
167 - $file = readaline("Enter file name $mwPath");
 204+ $file = readaline( "Enter file name $mwPath" );
168205 }
169 - $command .= ' -f '.$mwPath.$file;
 206+ $input = $mwPath.$file;
170207 }
171208
172 -$command .= " -t $pdOutput ".$pdOthers;
 209+$versionNumber = getSvnRevision( $input );
 210+if( $versionNumber === false ){ #Not using subversion ?
 211+ $svnstat = ''; # Not really useful if subversion not available
 212+ $version = 'trunk'; # FIXME
 213+} else {
 214+ $version = "trunk (r$versionNumber)";
 215+}
173216
174 -*/
 217+$generatedConf = generateConfigFile( $doxygenTemplate, $doxyOutput, $mwPath, $version, $svnstat, $input );
 218+$command = $doxygenBin . ' ' . $generatedConf;
175219
176 -// TODO : generate a list of paths ))
177 -$input = $mwPath;
178 -
179 -$generatedConf = generateConfigFile($doxygenTemplate, $doxyOutput, $mwPath, $input );
180 -$command = $doxygenBin . ' ' . $generatedConf ;
181 -
182 -?>
 220+echo <<<TEXT
183221 ---------------------------------------------------
184222 Launching the command:
185223
186 -<?php echo $command ?>
 224+$command
187225
188226 ---------------------------------------------------
189 -<?php
190227
191 -passthru($command);
 228+TEXT;
192229
193 -?>
 230+passthru( $command );
 231+
 232+echo <<<TEXT
194233 ---------------------------------------------------
195234 Doxygen execution finished.
196235 Check above for possible errors.
197236
198 -You might want to deleted the temporary file <?php echo $generatedConf; ?>
 237+You might want to deleted the temporary file $generatedConf
199238
200 -<?php
201 -
202 -# phpdoc -d ./mediawiki/includes/ ./mediawiki/maintenance/ -f ./mediawiki/*php -t ./mwdoc/ -dn 'MediaWiki' --title 'MediaWiki generated documentation' -o 'HTML:frames:DOM/earthli'
203 -
204 -# phpdoc -f ./mediawiki/includes/GlobalFunctions.php -t ./mwdoc/ -dn 'MediaWiki' --title 'MediaWiki generated documentation' -o 'HTML:frames:DOM/earthli'
205 -
206 -?>
 239+TEXT;
Index: trunk/phase3/maintenance/Doxyfile
@@ -1,16 +1,18 @@
2 -# Doxyfile 1.4.6
 2+# Doxyfile 1.5.1
33
44 #
55 # Some placeholders have been added for MediaWiki usage:
66 # {{OUTPUT_DIRECTORY}}
 7+# {{CURRENT_VERSION}}
78 # {{STRIP_FROM_PATH}}
 9+# {{SVNSTAT}}
810 # {{INPUT}}
911
1012 #---------------------------------------------------------------------------
1113 # Project related configuration options
1214 #---------------------------------------------------------------------------
1315 PROJECT_NAME = MediaWiki
14 -PROJECT_NUMBER = trunk
 16+PROJECT_NUMBER = {{CURRENT_VERSION}}
1517 OUTPUT_DIRECTORY = {{OUTPUT_DIRECTORY}}
1618 CREATE_SUBDIRS = NO
1719 OUTPUT_LANGUAGE = English
@@ -39,7 +41,7 @@
4042 DETAILS_AT_TOP = NO
4143 INHERIT_DOCS = YES
4244 SEPARATE_MEMBER_PAGES = NO
43 -TAB_SIZE = 8
 45+TAB_SIZE = 4
4446 ALIASES =
4547 OPTIMIZE_OUTPUT_FOR_C = NO
4648 OPTIMIZE_OUTPUT_JAVA = NO
@@ -74,7 +76,7 @@
7577 MAX_INITIALIZER_LINES = 30
7678 SHOW_USED_FILES = YES
7779 SHOW_DIRECTORIES = NO
78 -FILE_VERSION_FILTER =
 80+FILE_VERSION_FILTER = {{SVNSTAT}}
7981 #---------------------------------------------------------------------------
8082 # configuration options related to warning and progress messages
8183 #---------------------------------------------------------------------------
@@ -132,7 +134,7 @@
133135 *.PY
134136 RECURSIVE = YES
135137 EXCLUDE =
136 -EXCLUDE_SYMLINKS = NO
 138+EXCLUDE_SYMLINKS = YES
137139 EXCLUDE_PATTERNS = LocalSettings.php AdminSettings.php
138140 EXAMPLE_PATH =
139141 EXAMPLE_PATTERNS = *
Index: trunk/phase3/maintenance/Makefile
@@ -1,17 +1,10 @@
2 -mediawiki_version := $(shell php -r "include('commandLine.inc'); print SpecialVersion::getVersion();")
3 -
42 help:
53 @echo "Run 'make test' to run the parser tests."
6 - @echo "Run 'make doc' to run the phpdoc generation."
7 - @echo "Run 'make doxydoc' (unsupported doxygen generation)."
 4+ @echo "Run 'make doc' to run the doxygen generation."
85
96 test:
107 php parserTests.php --quiet
118
129 doc:
1310 php mwdocgen.php --all
14 - echo 'Doc generation done. Look at ./docs/html/'
15 -
16 -doxydoc:
17 - cd .. && /bin/sed -e "s/MW_VERSION_PLACEHOLDER/$(mediawiki_version)/" maintenance/mwdoxygen.cfg | doxygen -
18 - echo 'Doc generation done. Look at ./docs/html/'
 11+ @echo 'Doc generation done. Look at ./docs/html/'
Index: trunk/phase3/bin/svnstat
@@ -1,2 +1,2 @@
22 #!/bin/sh
3 -svn stat -v $1 | sed -n 's/^[ A-Z?\*|!]\{1,15\}/r/;s/ \{1,15\}/\/r/;s/ .*//p'
 3+svn stat -v $1 | sed -n 's/^[ A-Z?\*|!]\{1,15\}[0-9]\{1,10\} \{1,15\}/r/;s/ .*//p'

Status & tagging log