From ea79a23e56cc5cd9515ac9c85ba2c412407171d5 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Sat, 14 Sep 2019 19:31:53 +0100 Subject: [PATCH] docs: Ignore extensions/ and skins/ in mwdocgen.php by default The default was previously to index all of core and extensions, which is likely not the intent of someone running this for the first time (which can then easily take over half an hour). Even in CI, we never do this, and we never have afaik. Generally, local use is to replicate CI (all of core), or a subset of core by passing e.g. '--file includes/libs' or some such. Indexing an extension is still possible, same way as before, by passing '--file extensions/FooBar'. And, if one really wants to index all of core and all extensions, the new '--extensions' option allows one to opt back in to the old behaviour. Also: * Exclude all of 'resources/'. There are no PHP or Markdown files here that need to be indexed. Bug: T232104 Change-Id: I55617776ac86f3fdcb6c1ba1eebe892edcb5fafb --- maintenance/mwdocgen.php | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/maintenance/mwdocgen.php b/maintenance/mwdocgen.php index 3713fdce31..6b22097d2e 100644 --- a/maintenance/mwdocgen.php +++ b/maintenance/mwdocgen.php @@ -83,8 +83,10 @@ class MWDocGen extends Maintenance { $this->addOption( 'output', 'Path to write doc to', false, true ); - $this->addOption( 'no-extensions', - 'Ignore extensions' ); + $this->addOption( 'extensions', + 'Process the extensions/ directory as well (ignored if --file is used)' ); + $this->addOption( 'skins', + 'Process the skins/ directory as well (ignored if --file is used)' ); } public function getDbType() { @@ -115,18 +117,23 @@ class MWDocGen extends Maintenance { $this->template = $IP . '/maintenance/Doxyfile'; $this->excludes = [ - 'vendor', - 'node_modules', - 'resources/lib', 'images', + 'node_modules', + 'resources', 'static', 'tests', - 'resources/src/mediawiki.ui/styleguide.md', + 'vendor', ]; $this->excludePatterns = []; - if ( $this->hasOption( 'no-extensions' ) ) { - $this->excludePatterns[] = 'extensions'; - $this->excludePatterns[] = 'skins'; + if ( $this->input === '' ) { + // If no explicit --file filter is set, we're indexing all of $IP, + // but any extension or skin submodules should be excluded by default. + if ( !$this->hasOption( 'extensions' ) ) { + $this->excludePatterns[] = 'extensions'; + } + if ( !$this->hasOption( 'skins' ) ) { + $this->excludePatterns[] = 'skins'; + } } $this->doDot = shell_exec( 'which dot' ); -- 2.20.1