[glib: 8/12] doc: Split API reference per platform



commit 255f64cad83f89104de244f6c50dc56ec3d83e35
Author: Xavier Claessens <xavier claessens collabora com>
Date:   Tue Jul 9 13:25:49 2019 -0400

    doc: Split API reference per platform
    
    We can only include win32 APIs when building for Windows because gtkdoc
    needs to compile the GObject classes for introspection.

 docs/reference/gio/concat-files-helper.py          |  31 ++++++
 docs/reference/gio/gio-docs-unix.xml               |   3 +
 docs/reference/gio/gio-docs-win32.xml              |   6 ++
 docs/reference/gio/gio-docs.xml                    |   8 +-
 .../{gio-sections.txt => gio-sections-common.txt}  | 113 ---------------------
 docs/reference/gio/gio-sections-win32.txt          | 112 ++++++++++++++++++++
 docs/reference/gio/meson.build                     |  24 ++++-
 7 files changed, 174 insertions(+), 123 deletions(-)
---
diff --git a/docs/reference/gio/concat-files-helper.py b/docs/reference/gio/concat-files-helper.py
new file mode 100644
index 000000000..94d64c345
--- /dev/null
+++ b/docs/reference/gio/concat-files-helper.py
@@ -0,0 +1,31 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+# Copyright (C) 2018 Collabora Inc.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General
+# Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+#
+# Author: Xavier Claessens <xavier claessens collabora com>
+
+import sys
+
+if len(sys.argv) < 3:
+  print('Usage: {} <output file> <input file 1> ...'.format(os.path.basename(sys.argv[0])))
+  sys.exit(1)
+
+with open(sys.argv[1], 'w') as outfile:
+    for fname in sys.argv[2:]:
+        with open(fname) as infile:
+            for line in infile:
+                outfile.write(line)
diff --git a/docs/reference/gio/gio-docs-unix.xml b/docs/reference/gio/gio-docs-unix.xml
new file mode 100644
index 000000000..b78eddaa8
--- /dev/null
+++ b/docs/reference/gio/gio-docs-unix.xml
@@ -0,0 +1,3 @@
+<chapter id='unix-support'>
+<!--FIXME: fill this with unix APIs that cannot build on Windows -->
+</chapter>
diff --git a/docs/reference/gio/gio-docs-win32.xml b/docs/reference/gio/gio-docs-win32.xml
new file mode 100644
index 000000000..f34a6e65e
--- /dev/null
+++ b/docs/reference/gio/gio-docs-win32.xml
@@ -0,0 +1,6 @@
+<chapter id='win32-support'>
+    <title>Win32 support</title>
+    <xi:include href="xml/gwin32registrykey.xml"/>
+    <xi:include href="xml/gwin32inputstream.xml"/>
+    <xi:include href="xml/gwin32outputstream.xml"/>
+</chapter>
diff --git a/docs/reference/gio/gio-docs.xml b/docs/reference/gio/gio-docs.xml
index 98889ef60..cb2ab0495 100644
--- a/docs/reference/gio/gio-docs.xml
+++ b/docs/reference/gio/gio-docs.xml
@@ -72,8 +72,6 @@
         <xi:include href="xml/gdataoutputstream.xml"/>
         <xi:include href="xml/gunixinputstream.xml"/>
         <xi:include href="xml/gunixoutputstream.xml"/>
-        <xi:include href="xml/gwin32inputstream.xml"/>
-        <xi:include href="xml/gwin32outputstream.xml"/>
         <xi:include href="xml/gconverterinputstream.xml"/>
         <xi:include href="xml/gconverteroutputstream.xml"/>
         <xi:include href="xml/gpollableinputstream.xml"/>
@@ -219,10 +217,7 @@
         <xi:include href="xml/glistmodel.xml"/>
         <xi:include href="xml/gliststore.xml"/>
     </chapter>
-    <chapter id='registry'>
-        <title>Win32 registry support</title>
-        <xi:include href="xml/gwin32registrykey.xml"/>
-    </chapter>
+
     <chapter id="application">
         <title>Application support</title>
         <xi:include href="xml/gapplication.xml"/>
@@ -264,6 +259,7 @@
         <title>GIO Testing</title>
         <xi:include href="xml/gtestdbus.xml"/>
     </chapter>
+    <xi:include href="gio-docs-platform.xml"/>
   </part>
 
   <part id="migrating">
diff --git a/docs/reference/gio/gio-sections.txt b/docs/reference/gio/gio-sections-common.txt
similarity index 97%
rename from docs/reference/gio/gio-sections.txt
rename to docs/reference/gio/gio-sections-common.txt
index 4da79254d..95433ce43 100644
--- a/docs/reference/gio/gio-sections.txt
+++ b/docs/reference/gio/gio-sections-common.txt
@@ -719,27 +719,6 @@ g_unix_input_stream_get_type
 GUnixInputStreamPrivate
 </SECTION>
 
-<SECTION>
-<FILE>gwin32inputstream</FILE>
-<TITLE>GWin32InputStream</TITLE>
-GWin32InputStream
-g_win32_input_stream_new
-g_win32_input_stream_set_close_handle
-g_win32_input_stream_get_close_handle
-g_win32_input_stream_get_handle
-<SUBSECTION Standard>
-GWin32InputStreamClass
-G_WIN32_INPUT_STREAM
-G_IS_WIN32_INPUT_STREAM
-G_TYPE_WIN32_INPUT_STREAM
-G_WIN32_INPUT_STREAM_CLASS
-G_IS_WIN32_INPUT_STREAM_CLASS
-G_WIN32_INPUT_STREAM_GET_CLASS
-<SUBSECTION Private>
-g_win32_input_stream_get_type
-GWin32InputStreamPrivate
-</SECTION>
-
 <SECTION>
 <FILE>gmemoryinputstream</FILE>
 <TITLE>GMemoryInputStream</TITLE>
@@ -1024,27 +1003,6 @@ g_unix_output_stream_get_type
 GUnixOutputStreamPrivate
 </SECTION>
 
-<SECTION>
-<FILE>gwin32outputstream</FILE>
-<TITLE>GWin32OutputStream</TITLE>
-GWin32OutputStream
-g_win32_output_stream_new
-g_win32_output_stream_set_close_handle
-g_win32_output_stream_get_close_handle
-g_win32_output_stream_get_handle
-<SUBSECTION Standard>
-GWin32OutputStreamClass
-G_WIN32_OUTPUT_STREAM
-G_IS_WIN32_OUTPUT_STREAM
-G_TYPE_WIN32_OUTPUT_STREAM
-G_WIN32_OUTPUT_STREAM_CLASS
-G_IS_WIN32_OUTPUT_STREAM_CLASS
-G_WIN32_OUTPUT_STREAM_GET_CLASS
-<SUBSECTION Private>
-g_win32_output_stream_get_type
-GWin32OutputStreamPrivate
-</SECTION>
-
 <SECTION>
 <FILE>giostream</FILE>
 <TITLE>GIOStream</TITLE>
@@ -4699,74 +4657,3 @@ G_TYPE_LIST_STORE
 <SUBSECTION Private>
 g_list_store_get_type
 </SECTION>
-
-<SECTION>
-<FILE>gwin32registrykey</FILE>
-
-<SUBSECTION>
-GWin32RegistrySubkeyIter
-g_win32_registry_subkey_iter_copy
-g_win32_registry_subkey_iter_free
-g_win32_registry_subkey_iter_assign
-
-<SUBSECTION>
-GWin32RegistryValueIter
-g_win32_registry_value_iter_copy
-g_win32_registry_value_iter_free
-g_win32_registry_value_iter_assign
-
-<SUBSECTION>
-GWin32RegistryKey
-g_win32_registry_key_new
-g_win32_registry_key_new_w
-g_win32_registry_key_get_child
-g_win32_registry_key_get_child_w
-
-<SUBSECTION>
-g_win32_registry_subkey_iter_init
-g_win32_registry_subkey_iter_clear
-g_win32_registry_subkey_iter_n_subkeys
-g_win32_registry_subkey_iter_next
-g_win32_registry_subkey_iter_get_name
-g_win32_registry_subkey_iter_get_name_w
-
-<SUBSECTION>
-g_win32_registry_value_iter_init
-g_win32_registry_value_iter_clear
-g_win32_registry_value_iter_n_values
-g_win32_registry_value_iter_next
-GWin32RegistryValueType
-g_win32_registry_value_iter_get_value_type
-g_win32_registry_value_iter_get_name
-g_win32_registry_value_iter_get_name_w
-g_win32_registry_value_iter_get_data
-g_win32_registry_value_iter_get_data_w
-
-<SUBSECTION>
-g_win32_registry_key_get_value
-g_win32_registry_key_get_value_w
-g_win32_registry_key_get_path
-g_win32_registry_key_get_path_w
-GWin32RegistryKeyWatchCallbackFunc
-GWin32RegistryKeyWatcherFlags
-g_win32_registry_key_watch
-g_win32_registry_key_has_changed
-g_win32_registry_key_erase_change_indicator
-
-<SUBSECTION Standard>
-GWin32RegistryKeyClass
-
-<SUBSECTION Private>
-GWin32RegistryKeyPrivate
-g_win32_registry_key_get_type
-g_win32_registry_subkey_iter_get_type
-g_win32_registry_value_iter_get_type
-G_TYPE_WIN32_REGISTRY_KEY
-G_WIN32_REGISTRY_KEY
-G_WIN32_REGISTRY_KEY_CLASS
-G_IS_WIN32_REGISTRY_KEY
-G_IS_WIN32_REGISTRY_KEY_CLASS
-G_WIN32_REGISTRY_KEY_GET_CLASS
-G_TYPE_WIN32_REGISTRY_SUBKEY_ITER
-G_TYPE_WIN32_REGISTRY_VALUE_ITER
-</SECTION>
diff --git a/docs/reference/gio/gio-sections-win32.txt b/docs/reference/gio/gio-sections-win32.txt
new file mode 100644
index 000000000..52d137e93
--- /dev/null
+++ b/docs/reference/gio/gio-sections-win32.txt
@@ -0,0 +1,112 @@
+<SECTION>
+<FILE>gwin32inputstream</FILE>
+<TITLE>GWin32InputStream</TITLE>
+GWin32InputStream
+g_win32_input_stream_new
+g_win32_input_stream_set_close_handle
+g_win32_input_stream_get_close_handle
+g_win32_input_stream_get_handle
+<SUBSECTION Standard>
+GWin32InputStreamClass
+G_WIN32_INPUT_STREAM
+G_IS_WIN32_INPUT_STREAM
+G_TYPE_WIN32_INPUT_STREAM
+G_WIN32_INPUT_STREAM_CLASS
+G_IS_WIN32_INPUT_STREAM_CLASS
+G_WIN32_INPUT_STREAM_GET_CLASS
+<SUBSECTION Private>
+g_win32_input_stream_get_type
+GWin32InputStreamPrivate
+</SECTION>
+
+<SECTION>
+<FILE>gwin32outputstream</FILE>
+<TITLE>GWin32OutputStream</TITLE>
+GWin32OutputStream
+g_win32_output_stream_new
+g_win32_output_stream_set_close_handle
+g_win32_output_stream_get_close_handle
+g_win32_output_stream_get_handle
+<SUBSECTION Standard>
+GWin32OutputStreamClass
+G_WIN32_OUTPUT_STREAM
+G_IS_WIN32_OUTPUT_STREAM
+G_TYPE_WIN32_OUTPUT_STREAM
+G_WIN32_OUTPUT_STREAM_CLASS
+G_IS_WIN32_OUTPUT_STREAM_CLASS
+G_WIN32_OUTPUT_STREAM_GET_CLASS
+<SUBSECTION Private>
+g_win32_output_stream_get_type
+GWin32OutputStreamPrivate
+</SECTION>
+
+<SECTION>
+<FILE>gwin32registrykey</FILE>
+
+<SUBSECTION>
+GWin32RegistrySubkeyIter
+g_win32_registry_subkey_iter_copy
+g_win32_registry_subkey_iter_free
+g_win32_registry_subkey_iter_assign
+
+<SUBSECTION>
+GWin32RegistryValueIter
+g_win32_registry_value_iter_copy
+g_win32_registry_value_iter_free
+g_win32_registry_value_iter_assign
+
+<SUBSECTION>
+GWin32RegistryKey
+g_win32_registry_key_new
+g_win32_registry_key_new_w
+g_win32_registry_key_get_child
+g_win32_registry_key_get_child_w
+
+<SUBSECTION>
+g_win32_registry_subkey_iter_init
+g_win32_registry_subkey_iter_clear
+g_win32_registry_subkey_iter_n_subkeys
+g_win32_registry_subkey_iter_next
+g_win32_registry_subkey_iter_get_name
+g_win32_registry_subkey_iter_get_name_w
+
+<SUBSECTION>
+g_win32_registry_value_iter_init
+g_win32_registry_value_iter_clear
+g_win32_registry_value_iter_n_values
+g_win32_registry_value_iter_next
+GWin32RegistryValueType
+g_win32_registry_value_iter_get_value_type
+g_win32_registry_value_iter_get_name
+g_win32_registry_value_iter_get_name_w
+g_win32_registry_value_iter_get_data
+g_win32_registry_value_iter_get_data_w
+
+<SUBSECTION>
+g_win32_registry_key_get_value
+g_win32_registry_key_get_value_w
+g_win32_registry_key_get_path
+g_win32_registry_key_get_path_w
+GWin32RegistryKeyWatchCallbackFunc
+GWin32RegistryKeyWatcherFlags
+g_win32_registry_key_watch
+g_win32_registry_key_has_changed
+g_win32_registry_key_erase_change_indicator
+
+<SUBSECTION Standard>
+GWin32RegistryKeyClass
+
+<SUBSECTION Private>
+GWin32RegistryKeyPrivate
+g_win32_registry_key_get_type
+g_win32_registry_subkey_iter_get_type
+g_win32_registry_value_iter_get_type
+G_TYPE_WIN32_REGISTRY_KEY
+G_WIN32_REGISTRY_KEY
+G_WIN32_REGISTRY_KEY_CLASS
+G_IS_WIN32_REGISTRY_KEY
+G_IS_WIN32_REGISTRY_KEY_CLASS
+G_WIN32_REGISTRY_KEY_GET_CLASS
+G_TYPE_WIN32_REGISTRY_SUBKEY_ITER
+G_TYPE_WIN32_REGISTRY_VALUE_ITER
+</SECTION>
diff --git a/docs/reference/gio/meson.build b/docs/reference/gio/meson.build
index 930a3b75c..860ab4d08 100644
--- a/docs/reference/gio/meson.build
+++ b/docs/reference/gio/meson.build
@@ -81,15 +81,17 @@ if get_option('gtk_doc')
     'gunixresolver.h',
     'gunixvolume.h',
     'gunixvolumemonitor.h',
+    'gwin32networkmonitor.h',
     'gwin32appinfo.h',
     'gwin32mount.h',
-    'gwin32registrykey.h',
     'gwin32resolver.h',
     'gwin32volumemonitor.h',
     'thumbnail-verify.h',
     'xdp-dbus.h',
   ]
 
+  sections_files = files('gio-sections-common.txt')
+
   if host_system == 'windows'
     ignore_headers += [
       'gfiledescriptorbased.h',
@@ -104,6 +106,8 @@ if get_option('gtk_doc')
       'gdesktopappinfo.h',
       'gosxappinfo.h',
     ]
+    sections_files += files('gio-sections-win32.txt')
+    platform_file = files('gio-docs-win32.xml')
   else
     if glib_have_cocoa
       ignore_headers += ['gdesktopappinfo.h']
@@ -112,10 +116,11 @@ if get_option('gtk_doc')
     endif
 
     ignore_headers += [
-      'gwin32networkmonitor.h',
       'gwin32inputstream.h',
       'gwin32outputstream.h',
+      'gwin32registrykey.h',
     ]
+    platform_file = files('gio-docs-unix.xml')
   endif
 
   ignore_sources = [
@@ -125,8 +130,6 @@ if get_option('gtk_doc')
     'xdp-dbus.c',
   ]
 
-  # FIXME: More win32 headers were added to fix building gio-scan
-
   # FIXME: ExampleAnimal docs aren't built
 
   docpath = join_paths(glib_datadir, 'gtk-doc', 'html')
@@ -138,6 +141,19 @@ if get_option('gtk_doc')
     configuration: version_conf
   )
 
+  concat_files_helper = find_program('concat-files-helper.py')
+  configure_file(
+    output : 'gio-sections.txt',
+    input : sections_files,
+    command : [concat_files_helper, '@OUTPUT@', '@INPUT@'],
+  )
+
+  configure_file(
+    output : 'gio-docs-platform.xml',
+    input : platform_file,
+    copy : true,
+  )
+
   gnome.gtkdoc('gio',
     main_xml : 'gio-docs.xml',
     namespace : 'g',


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]