Changeset 238853 in webkit


Ignore:
Timestamp:
Dec 4, 2018 8:33:22 AM (5 years ago)
Author:
commit-queue@webkit.org
Message:

[WPE] Add gtk-doc
https://bugs.webkit.org/show_bug.cgi?id=178900

Patch by Carlos Eduardo Ramalho <cadubentzen@gmail.com> on 2018-12-04
Reviewed by Michael Catanzaro.

Add gtk-doc to WPE port. This patch tries to reuse as much code from
WebKitGTK+ as possible.

.:

  • Source/PlatformGTK.cmake: include GtkDoc.cmake instead of defining macro.
  • Source/PlatformWPE.cmake: Added documentation generation.
  • Source/cmake/GtkDoc.cmake: Added.
  • Source/cmake/OptionsWPE.cmake: Added ENABLE_GTKDOC build option and added pkg-config path variables.

Source/WebKit:

  • PlatformWPE.cmake: Write variables to gtkdoc-wpe.cfg and gtkdoc-webextensions that is used by python script later.
  • UIProcess/API/wpe/WebKitWebContext.h: Placed sandbox functions in the same location as in the WebKitGTK+ for consistency.
  • UIProcess/API/wpe/docs/wpe-0.1-sections.txt: Added.
  • UIProcess/API/wpe/docs/wpe-docs.sgml: Added.
  • WebProcess/InjectedBundle/API/wpe/WebKitWebPage.h: Placed webkit_web_page_get_dom_document

in the same position as in the WebKitGTK+ for consistency.

  • WebProcess/InjectedBundle/API/wpe/docs/wpe-webextensions-0.1-sections.txt: Added.
  • WebProcess/InjectedBundle/API/wpe/docs/wpe-webextensions-docs.sgml: Added.

Tools:

  • gtkdoc/generate-gtkdoc: Renamed from Tools/gtk/generate-gtkdoc.

(get_gtkdoc_module_paths): Add GDK and GTK only if building for GTK.
(prepare_environment_for_gtkdoc_generation):
(build_gtkdoc_for_wpe): Code to generate doc for WPE.
(build_gtkdoc_for_wkgtk): Code to generate doc for WebKitGTK+. Moved from main.

  • gtkdoc/gtkdoc.py: Renamed from Tools/gtk/gtkdoc.py.

(GTKDoc.init): Initialized required variables according to pylint.
(GTKDoc.api_missing_documentation):

  • wpe/install-dependencies: Add gtkdoc dependency.
Location:
trunk
Files:
8 added
10 edited
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r238809 r238853  
     12018-12-04  Carlos Eduardo Ramalho  <cadubentzen@gmail.com>
     2
     3        [WPE] Add gtk-doc
     4        https://bugs.webkit.org/show_bug.cgi?id=178900
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        Add gtk-doc to WPE port. This patch tries to reuse as much code from
     9        WebKitGTK+ as possible.
     10
     11        * Source/PlatformGTK.cmake: include GtkDoc.cmake instead of defining macro.
     12        * Source/PlatformWPE.cmake: Added documentation generation.
     13        * Source/cmake/GtkDoc.cmake: Added.
     14        * Source/cmake/OptionsWPE.cmake: Added ENABLE_GTKDOC build option and added pkg-config path variables.
     15
    1162018-12-03  Don Olmstead  <don.olmstead@sony.com>
    217
  • trunk/Source/PlatformGTK.cmake

    r231631 r238853  
     1include(GtkDoc)
    12include(WebKitDist)
    23
     
    2627endif ()
    2728
    28 macro(ADD_GTKDOC_GENERATOR _stamp_name _extra_args)
    29     add_custom_command(
    30         OUTPUT "${CMAKE_BINARY_DIR}/${_stamp_name}"
    31         DEPENDS ${DocumentationDependencies}
    32         COMMAND ${CMAKE_COMMAND} -E env "CC=${CMAKE_C_COMPILER}" "CFLAGS=${CMAKE_C_FLAGS} -Wno-unused-parameter" ${CMAKE_SOURCE_DIR}/Tools/gtk/generate-gtkdoc ${_extra_args}
    33         COMMAND touch ${_stamp_name}
    34         WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
    35         VERBATIM
    36     )
    37 endmacro()
    38 
    39 ADD_GTKDOC_GENERATOR("docs-build.stamp" "")
     29ADD_GTKDOC_GENERATOR("docs-build.stamp" "--gtk")
    4030if (ENABLE_GTKDOC)
    4131    add_custom_target(gtkdoc ALL DEPENDS "${CMAKE_BINARY_DIR}/docs-build.stamp")
     
    4737    # the course of development.
    4838    if (DEVELOPER_MODE)
    49         ADD_GTKDOC_GENERATOR("docs-build-no-html.stamp" "--skip-html")
     39        ADD_GTKDOC_GENERATOR("docs-build-no-html.stamp" "--gtk;--skip-html")
    5040        add_custom_target(gtkdoc-no-html ALL DEPENDS "${CMAKE_BINARY_DIR}/docs-build-no-html.stamp")
    5141    endif ()
  • trunk/Source/PlatformWPE.cmake

    r224410 r238853  
     1include(GtkDoc)
    12include(WebKitDist)
    23
     4list(APPEND DocumentationDependencies
     5    WebKit
     6    "${CMAKE_SOURCE_DIR}/Source/WebKit/UIProcess/API/wpe/docs/wpe-docs.sgml"
     7    "${CMAKE_SOURCE_DIR}/Source/WebKit/WebProcess/InjectedBundle/API/wpe/docs/wpe-webextensions-docs.sgml"
     8    "${CMAKE_SOURCE_DIR}/Source/WebKit/UIProcess/API/wpe/docs/wpe-${WPE_API_VERSION}-sections.txt"
     9    "${CMAKE_SOURCE_DIR}/Source/WebKit/WebProcess/InjectedBundle/API/wpe/docs/wpe-webextensions-${WPE_API_VERSION}-sections.txt"
     10)
     11
     12if (ENABLE_GTKDOC)
     13    install(DIRECTORY ${CMAKE_BINARY_DIR}/Documentation/wpe-${WPE_API_VERSION}/html/wpe-${WPE_API_VERSION}
     14            DESTINATION "${CMAKE_INSTALL_DATADIR}/gtk-doc/html"
     15    )
     16    install(DIRECTORY ${CMAKE_BINARY_DIR}/Documentation/wpe-webextensions-${WPE_API_VERSION}/html/wpe-webextensions-${WPE_API_VERSION}
     17        DESTINATION "${CMAKE_INSTALL_DATADIR}/gtk-doc/html"
     18    )
     19endif ()
     20
     21ADD_GTKDOC_GENERATOR("docs-build.stamp" "--wpe")
     22if (ENABLE_GTKDOC)
     23    add_custom_target(gtkdoc ALL DEPENDS "${CMAKE_BINARY_DIR}/docs-build.stamp")
     24elseif (NOT ENABLED_COMPILER_SANITIZERS AND NOT CMAKE_CROSSCOMPILING AND NOT APPLE)
     25    add_custom_target(gtkdoc DEPENDS "${CMAKE_BINARY_DIR}/docs-build.stamp")
     26
     27    # Add a default build step which check that documentation does not have any warnings
     28    # or errors. This is useful to prevent breaking documentation inadvertently during
     29    # the course of development.
     30    if (DEVELOPER_MODE)
     31        ADD_GTKDOC_GENERATOR("docs-build-no-html.stamp" "--wpe;--skip-html")
     32        add_custom_target(gtkdoc-no-html ALL DEPENDS "${CMAKE_BINARY_DIR}/docs-build-no-html.stamp")
     33    endif ()
     34endif ()
     35
    336if (DEVELOPER_MODE)
    4     # FIXME: This should depend on a gtkdoc target
    5     add_custom_target(Documentation)
     37    add_custom_target(Documentation DEPENDS gtkdoc)
    638    WEBKIT_DECLARE_DIST_TARGETS(WPE wpewebkit ${TOOLS_DIR}/wpe/manifest.txt.in)
    739endif ()
  • trunk/Source/WebKit/ChangeLog

    r238851 r238853  
     12018-12-04  Carlos Eduardo Ramalho  <cadubentzen@gmail.com>
     2
     3        [WPE] Add gtk-doc
     4        https://bugs.webkit.org/show_bug.cgi?id=178900
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        Add gtk-doc to WPE port. This patch tries to reuse as much code from
     9        WebKitGTK+ as possible.
     10
     11        * PlatformWPE.cmake: Write variables to gtkdoc-wpe.cfg and gtkdoc-webextensions that is used by python script later.
     12        * UIProcess/API/wpe/WebKitWebContext.h: Placed sandbox functions in the same location as in the WebKitGTK+ for consistency.
     13        * UIProcess/API/wpe/docs/wpe-0.1-sections.txt: Added.
     14        * UIProcess/API/wpe/docs/wpe-docs.sgml: Added.
     15        * WebProcess/InjectedBundle/API/wpe/WebKitWebPage.h: Placed webkit_web_page_get_dom_document
     16        in the same position as in the WebKitGTK+ for consistency.
     17        * WebProcess/InjectedBundle/API/wpe/docs/wpe-webextensions-0.1-sections.txt: Added.
     18        * WebProcess/InjectedBundle/API/wpe/docs/wpe-webextensions-docs.sgml: Added.
     19
    1202018-12-04  Carlos Garcia Campos  <cgarcia@igalia.com>
    221
  • trunk/Source/WebKit/PlatformWPE.cmake

    r238552 r238853  
    1111
    1212configure_file(UIProcess/API/wpe/WebKitVersion.h.in ${DERIVED_SOURCES_WPE_API_DIR}/WebKitVersion.h)
    13 configure_file(wpe/wpe-webkit.pc.in ${CMAKE_BINARY_DIR}/wpe-webkit-${WPE_API_VERSION}.pc @ONLY)
    14 configure_file(wpe/wpe-web-extension.pc.in ${CMAKE_BINARY_DIR}/wpe-web-extension-${WPE_API_VERSION}.pc @ONLY)
     13configure_file(wpe/wpe-webkit.pc.in ${WPE_PKGCONFIG_FILE} @ONLY)
     14configure_file(wpe/wpe-web-extension.pc.in ${WPEWebExtension_PKGCONFIG_FILE} @ONLY)
    1515
    1616add_definitions(-DWEBKIT2_COMPILATION)
     
    332332        COMPONENT "Development"
    333333)
     334
     335file(WRITE ${CMAKE_BINARY_DIR}/gtkdoc-wpe.cfg
     336    "[wpe-${WPE_API_VERSION}]\n"
     337    "pkgconfig_file=${WPE_PKGCONFIG_FILE}\n"
     338    "decorator=WEBKIT_API|WEBKIT_DEPRECATED|WEBKIT_DEPRECATED_FOR\\(.+\\)\n"
     339    "deprecation_guard=WEBKIT_DISABLE_DEPRECATED\n"
     340    "namespace=webkit\n"
     341    "cflags=-I${CMAKE_SOURCE_DIR}/Source\n"
     342    "       -I${WEBKIT_DIR}/Shared/API/glib\n"
     343    "       -I${WEBKIT_DIR}/UIProcess/API/glib\n"
     344    "       -I${WEBKIT_DIR}/UIProcess/API/wpe\n"
     345    "       -I${FORWARDING_HEADERS_WPE_DIR}\n"
     346    "doc_dir=${WEBKIT_DIR}/UIProcess/API/wpe/docs\n"
     347    "source_dirs=${WEBKIT_DIR}/Shared/API/glib\n"
     348    "            ${WEBKIT_DIR}/UIProcess/API/glib\n"
     349    "            ${WEBKIT_DIR}/UIProcess/API/wpe\n"
     350    "            ${DERIVED_SOURCES_WPE_API_DIR}\n"
     351    "headers=${WPE_ENUM_GENERATION_HEADERS}\n"
     352    "main_sgml_file=wpe-docs.sgml\n"
     353)
     354
     355file(WRITE ${CMAKE_BINARY_DIR}/gtkdoc-webextensions.cfg
     356    "[wpe-webextensions-${WPE_API_VERSION}]\n"
     357    "pkgconfig_file=${WPEWebExtension_PKGCONFIG_FILE}\n"
     358    "decorator=WEBKIT_API|WEBKIT_DEPRECATED|WEBKIT_DEPRECATED_FOR\\(.+\\)\n"
     359    "deprecation_guard=WEBKIT_DISABLE_DEPRECATED\n"
     360    "namespace=webkit_webextensions\n"
     361    "cflags=-I${CMAKE_SOURCE_DIR}/Source\n"
     362    "       -I${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe\n"
     363    "       -I${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/DOM\n"
     364    "       -I${FORWARDING_HEADERS_WPE_DIR}\n"
     365    "doc_dir=${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/docs\n"
     366    "source_dirs=${WEBKIT_DIR}/WebProcess/InjectedBundle/API/glib\n"
     367    "            ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/glib/DOM\n"
     368    "            ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe\n"
     369    "            ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/wpe/DOM\n"
     370    "headers=${WPE_WEB_EXTENSION_API_INSTALLED_HEADERS}\n"
     371    "main_sgml_file=wpe-webextensions-docs.sgml\n"
     372)
  • trunk/Source/WebKit/UIProcess/API/wpe/WebKitWebContext.h

    r237107 r238853  
    248248                                                     GDestroyNotify                 user_data_destroy_func);
    249249
     250WEBKIT_API void
     251webkit_web_context_set_sandbox_enabled              (WebKitWebContext               *context,
     252                                                     gboolean                       enabled);
     253
     254WEBKIT_API gboolean
     255webkit_web_context_get_sandbox_enabled              (WebKitWebContext              *context);
     256
    250257WEBKIT_API gboolean
    251258webkit_web_context_get_spell_checking_enabled       (WebKitWebContext              *context);
     
    298305
    299306WEBKIT_API void
    300 webkit_web_context_set_sandbox_enabled              (WebKitWebContext              *context,
    301                                                      gboolean                       enabled);
    302 
    303 WEBKIT_API gboolean
    304 webkit_web_context_get_sandbox_enabled              (WebKitWebContext              *context);
    305 
    306 WEBKIT_API void
    307307webkit_web_context_initialize_notification_permissions
    308308                                                    (WebKitWebContext              *context,
  • trunk/Source/WebKit/WebProcess/InjectedBundle/API/wpe/WebKitWebPage.h

    r229973 r238853  
    7575webkit_web_page_get_type         (void);
    7676
     77WEBKIT_API WebKitDOMDocument *
     78webkit_web_page_get_dom_document (WebKitWebPage *web_page);
     79
    7780WEBKIT_API guint64
    7881webkit_web_page_get_id           (WebKitWebPage *web_page);
     
    8790webkit_web_page_get_editor       (WebKitWebPage *web_page);
    8891
    89 WEBKIT_API WebKitDOMDocument *
    90 webkit_web_page_get_dom_document (WebKitWebPage *web_page);
    91 
    9292G_END_DECLS
    9393
  • trunk/Source/cmake/OptionsWPE.cmake

    r238754 r238853  
    4444# there is a strong reason we should support changing the value of the option,
    4545# and the option is not relevant to any other WebKit ports.
     46WEBKIT_OPTION_DEFINE(ENABLE_GTKDOC "Whether or not to use generate gtkdoc." PUBLIC OFF)
    4647WEBKIT_OPTION_DEFINE(USE_WOFF2 "Whether to enable support for WOFF2 Web Fonts." PUBLIC ON)
    4748
     
    135136SET_AND_EXPOSE_TO_BUILD(USE_NICOSIA TRUE)
    136137
     138# Override the cached variable, gtk-doc does not really work when cross-building or building on Mac.
     139if (CMAKE_CROSSCOMPILING OR APPLE)
     140    set(ENABLE_GTKDOC OFF)
     141endif ()
     142
    137143set(FORWARDING_HEADERS_DIR ${DERIVED_SOURCES_DIR}/ForwardingHeaders)
    138144set(FORWARDING_HEADERS_WPE_DIR ${FORWARDING_HEADERS_DIR}/wpe)
     
    143149set(DERIVED_SOURCES_WPE_API_DIR ${DERIVED_SOURCES_WEBKIT_DIR}/wpe)
    144150
     151set(WPE_PKGCONFIG_FILE ${CMAKE_BINARY_DIR}/wpe-webkit-${WPE_API_VERSION}.pc)
     152set(WPEWebExtension_PKGCONFIG_FILE ${CMAKE_BINARY_DIR}/wpe-web-extension-${WPE_API_VERSION}.pc)
     153
    145154include(GStreamerChecks)
  • trunk/Tools/ChangeLog

    r238851 r238853  
     12018-12-04  Carlos Eduardo Ramalho  <cadubentzen@gmail.com>
     2
     3        [WPE] Add gtk-doc
     4        https://bugs.webkit.org/show_bug.cgi?id=178900
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        Add gtk-doc to WPE port. This patch tries to reuse as much code from
     9        WebKitGTK+ as possible.
     10
     11        * gtkdoc/generate-gtkdoc: Renamed from Tools/gtk/generate-gtkdoc.
     12        (get_gtkdoc_module_paths): Add GDK and GTK only if building for GTK.
     13        (prepare_environment_for_gtkdoc_generation):
     14        (build_gtkdoc_for_wpe): Code to generate doc for WPE.
     15        (build_gtkdoc_for_wkgtk): Code to generate doc for WebKitGTK+. Moved from main.
     16        * gtkdoc/gtkdoc.py: Renamed from Tools/gtk/gtkdoc.py.
     17        (GTKDoc.__init__): Initialized required variables according to pylint.
     18        (GTKDoc.api_missing_documentation):
     19        * wpe/install-dependencies: Add gtkdoc dependency.
     20
    1212018-12-04  Carlos Garcia Campos  <cgarcia@igalia.com>
    222
  • trunk/Tools/gtkdoc/generate-gtkdoc

    r238851 r238853  
    4949    dependent_packages = {
    5050        'glib-2.0' : ['glib', 'gobject', 'gio'],
    51         'libsoup-2.4' : ['libsoup-2.4'],
    52         'gdk-pixbuf-2.0': ['gdk-pixbuf'],
    53         'gtk+-3.0' : ['gtk3', 'gdk3']
     51        'libsoup-2.4' : ['libsoup-2.4']
    5452    }
     53
     54    if arguments.gtk:
     55        dependent_packages['gdk-pixbuf-2.0'] = ['gdk-pixbuf']
     56        dependent_packages['gtk+-3.0'] = ['gtk3', 'gdk3']
    5557
    5658    paths = []
     
    178180    os.chdir(common.build_path())
    179181
     182def build_gtkdoc_for_wpe(arguments):
     183    webextensions_generator = get_generator_for_config(common.build_path('gtkdoc-webextensions.cfg'), arguments.virtual_root)
     184    if not webextensions_generator:
     185        print("gtkdoc-webextensions.cfg does not exist! Skipping that documentation")
     186        sys.exit(1)
     187    saw_warnings = generate_documentation(webextensions_generator)
     188    if saw_warnings:
     189        sys.exit(saw_warnings)
     190
     191    wpe_generator = get_generator_for_config(common.build_path('gtkdoc-wpe.cfg'), arguments.virtual_root)
     192    if not wpe_generator:
     193        print("gtkdoc-wpe.cfg does not exist! Skipping that documentation")
     194        sys.exit(1)
     195    saw_warnings = generate_documentation(wpe_generator)
     196    sys.exit(saw_warnings)
     197
     198def build_gtkdoc_for_wkgtk(arguments):
     199    jsc_generator = get_generator_for_config(common.build_path('gtkdoc-jsc-glib.cfg'), arguments.virtual_root)
     200    if not jsc_generator:
     201        print("gtkdoc-jsc-glib.cfg does not exist! Skipping that documentation")
     202        sys.exit(1)
     203    saw_warnings = generate_documentation(jsc_generator)
     204    if saw_warnings:
     205        sys.exit(saw_warnings)
     206
     207    webkitdom_generator = get_generator_for_config(common.build_path('gtkdoc-webkitdom.cfg'), arguments.virtual_root, [jsc_generator.module_name])
     208    if not webkitdom_generator:
     209        print("gtkdoc-webkitdom.cfg does not exist! Skipping that documentation")
     210        sys.exit(1)
     211    saw_warnings = generate_documentation(webkitdom_generator)
     212    if saw_warnings:
     213        sys.exit(saw_warnings)
     214
     215    webkit2_generator = get_generator_for_config(common.build_path('gtkdoc-webkit2gtk.cfg'), arguments.virtual_root, [webkitdom_generator.module_name, jsc_generator.module_name])
     216    if not webkit2_generator:
     217        print("gtkdoc-webkit2gtk.cfg does not exist! Skipping that documentation")
     218        sys.exit(1)
     219    saw_warnings = generate_documentation(webkit2_generator)
     220    sys.exit(saw_warnings)
     221
    180222if __name__ == "__main__":
    181223    parser = argparse.ArgumentParser(description='Generate gtkdoc for WebKit.')
     
    192234                             'make install as DESTDIR.')
    193235
     236    parser.add_argument('--gtk', action='store_true',
     237                        help='Build documentation for WebKitGTK+')
     238    parser.add_argument('--wpe', action='store_true',
     239                        help='Build documentation for WPE')
     240
    194241    arguments = parser.parse_args()
    195242    configure_logging(arguments.verbose)
     
    197244    prepare_environment_for_gtkdoc_generation()
    198245
    199     jsc_generator = get_generator_for_config(common.build_path('gtkdoc-jsc-glib.cfg'), arguments.virtual_root)
    200     if not jsc_generator:
    201         print("gtkdoc-jsc-glib.cfg does not exist! Skipping that documentation")
    202         sys.exit(1)
    203     saw_warnings = generate_documentation(jsc_generator)
    204     if saw_warnings:
    205         sys.exit(saw_warnings)
    206 
    207     webkitdom_generator = get_generator_for_config(common.build_path('gtkdoc-webkitdom.cfg'), arguments.virtual_root, [jsc_generator.module_name])
    208     if not webkitdom_generator:
    209         print("gtkdoc-webkitdom.cfg does not exist! Skipping that documentation")
    210         sys.exit(1)
    211     saw_warnings = generate_documentation(webkitdom_generator)
    212     if saw_warnings:
    213         sys.exit(saw_warnings)
    214 
    215     webkit2_generator = get_generator_for_config(common.build_path('gtkdoc-webkit2gtk.cfg'), arguments.virtual_root, [webkitdom_generator.module_name, jsc_generator.module_name])
    216     if not webkit2_generator:
    217         print("gtkdoc-webkit2gtk.cfg does not exist! Skipping that documentation")
    218         sys.exit(1)
    219     saw_warnings = generate_documentation(webkit2_generator)
    220 
    221     sys.exit(saw_warnings)
     246    if arguments.wpe:
     247        build_gtkdoc_for_wpe(arguments)
     248    elif arguments.gtk:
     249        build_gtkdoc_for_wkgtk(arguments)
     250    else:
     251        print('Please choose a WebKit port with --gtk or --wpe')
     252        sys.exit(1)
  • trunk/Tools/gtkdoc/gtkdoc.py

    r238851 r238853  
    8888
    8989    def __init__(self, args):
     90        self.version = ''
     91        self.virtual_root = ''
     92        self.prefix = ''
    9093
    9194        # Parameters specific to scanning.
     
    416419        return open(unused_doc_file).read().splitlines()
    417420
     421
    418422class PkgConfigGTKDoc(GTKDoc):
    419423
  • trunk/Tools/wpe/install-dependencies

    r236657 r238853  
    6666        gcc \
    6767        gperf \
     68        gtk-doc-tools \
    6869        intltool \
    6970        itstool \
     
    156157        gnutls \
    157158        gperf \
     159        gtk-doc \
    158160        grep \
    159161        groff \
     
    254256        gstreamer1-plugins-bad-free-devel \
    255257        gstreamer1-plugins-base-devel \
     258        gtk-doc \
    256259        intltool \
    257260        itstool \
Note: See TracChangeset for help on using the changeset viewer.