Changeset 127475 in webkit


Ignore:
Timestamp:
Sep 4, 2012 11:33:10 AM (12 years ago)
Author:
commit-queue@webkit.org
Message:

[GTK] Print API missing documentation when generating gtkdoc
https://bugs.webkit.org/show_bug.cgi?id=95703

Patch by Martin Robinson <mrobinson@igalia.com> on 2012-09-04
Reviewed by Carlos Garcia Campos.

Print out API missing documentation when generating gtkdoc. This makes it
easier to fix documentation errors.

  • gtk/generate-gtkdoc:

(print_missing_api): Added.
(generate_doc): Inline the rebase step, since it now reports an error
when you try to rebase without generating documentation first.

  • gtk/gtkdoc.py:

(GTKDoc.rebase_installed_docs): Raise an error when rebasing without
generating documentation first to enable a small cleanup at the caller.
(GTKDoc.api_missing_documentation): Added.

Location:
trunk/Tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r127473 r127475  
     12012-09-04  Martin Robinson  <mrobinson@igalia.com>
     2
     3        [GTK] Print API missing documentation when generating gtkdoc
     4        https://bugs.webkit.org/show_bug.cgi?id=95703
     5
     6        Reviewed by Carlos Garcia Campos.
     7
     8        Print out API missing documentation when generating gtkdoc. This makes it
     9        easier to fix documentation errors.
     10
     11        * gtk/generate-gtkdoc:
     12        (print_missing_api): Added.
     13        (generate_doc): Inline the rebase step, since it now reports an error
     14        when you try to rebase without generating documentation first.
     15        * gtk/gtkdoc.py:
     16        (GTKDoc.rebase_installed_docs): Raise an error when rebasing without
     17        generating documentation first to enable a small cleanup at the caller.
     18        (GTKDoc.api_missing_documentation): Added.
     19
    1202012-09-04  Vincent Scheib  <scheib@chromium.org>
    221
  • trunk/Tools/gtk/generate-gtkdoc

    r124741 r127475  
    138138    return options
    139139
    140 def generate_doc(pkg_config_path, options):
    141     generator = gtkdoc.PkgConfigGTKDoc(pkg_config_path, options)
     140def print_missing_api(generator):
     141    missing_api = generator.api_missing_documentation()
     142    if not missing_api:
     143        return
     144    print "\nThe following API are missing documentation:"
     145    for api in missing_api:
     146        print "\t%s" % api
     147
     148def generate_doc(generator):
    142149    generator.generate(html='--skip-html' not in sys.argv)
     150    if generator.saw_warnings:
     151        print_missing_api(generator)
    143152    return generator.saw_warnings
    144 
    145 def rebase_installed_docs(pkg_config_path, options):
    146     if not os.path.isdir(options['output_dir']):
    147         print "Documentation was not generated"
    148         return
    149     generator = gtkdoc.PkgConfigGTKDoc(pkg_config_path, options)
    150     generator.rebase_installed_docs()
    151153
    152154configure_logging()
     
    166168if os.path.exists(pkg_config_path):
    167169    options = get_webkit1_options(common.gtk_version_of_pkg_config_file(pkg_config_path))
     170    generator = gtkdoc.PkgConfigGTKDoc(pkg_config_path, options)
    168171    if '--rebase' not in sys.argv:
    169172        print "Generating WebKit1 documentation..."
    170         saw_webkit1_warnings = generate_doc(pkg_config_path, options)
     173        saw_webkit1_warnings = generate_doc(generator)
    171174    else:
    172175        print "Rebasing WebKit1 documentation..."
    173         rebase_installed_docs(pkg_config_path, options)
     176        generator.rebase_installed_docs()
    174177
    175178# WebKit2 might not be enabled, so check for the pkg-config file before building documentation.
    176179pkg_config_path = common.build_path('Source', 'WebKit2', 'webkit2gtk-3.0.pc')
    177180if os.path.exists(pkg_config_path):
    178     options = get_webkit2_options()
     181    generator = gtkdoc.PkgConfigGTKDoc(pkg_config_path, get_webkit2_options())
    179182    if '--rebase' not in sys.argv:
    180183        print "\nGenerating WebKit2 documentation..."
    181         saw_webkit2_warnings = generate_doc(pkg_config_path, options)
     184        saw_webkit2_warnings = generate_doc(generator)
    182185    else:
    183186        print "\nRebasing WebKit2 documentation..."
    184         rebase_installed_docs(pkg_config_path, options)
     187        generator.rebase_installed_docs()
    185188
    186189sys.exit(saw_webkit1_warnings or saw_webkit2_warnings)
  • trunk/Tools/gtk/gtkdoc.py

    r107164 r127475  
    362362
    363363    def rebase_installed_docs(self):
     364        if not os.path.isdir(self.output_dir):
     365            raise Exception("Tried to rebase documentation before generating it.")
    364366        html_dir = os.path.join(self.virtual_root + self.prefix, 'share', 'gtk-doc', 'html', self.module_name)
    365367        if not os.path.isdir(html_dir):
     
    373375        self._run_command(args, cwd=self.output_dir)
    374376
     377    def api_missing_documentation(self):
     378        unused_doc_file = os.path.join(self.output_dir, self.module_name + "-unused.txt")
     379        if not os.path.exists(unused_doc_file) or not os.access(unused_doc_file, os.R_OK):
     380            return []
     381        return open(unused_doc_file).read().splitlines()
    375382
    376383class PkgConfigGTKDoc(GTKDoc):
Note: See TracChangeset for help on using the changeset viewer.