]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
valadoc: Specify that the "--driver" option is deprecated f7525b7ca1d9933e2da3681b63a2f60f329c6e54 43/head
authorCorentin Noël <corentin@elementary.io>
Fri, 18 Jan 2019 11:46:52 +0000 (12:46 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Fri, 18 Jan 2019 13:58:06 +0000 (14:58 +0100)
Fixes https://gitlab.gnome.org/GNOME/vala/issues/736

doc/valadoc.1
valadoc/valadoc.vala

index d0f13f101fe76ea9a87bf64c65682e1e56be31d8..7477708c2a8a8b98464fe9169986ce2ed62d4309 100644 (file)
@@ -48,7 +48,7 @@ Look for package bindings in DIRECTORY
 Include binding for PACKAGE
 .TP
 \fB\-\-driver\fR
-Name of an driver or path to a custom driver
+Name of an driver or path to a custom driver (DEPRECATED AND IGNORED)
 .TP
 \fB\-\-importdir\fR=\fI\,DIRECTORY\/\fR...
 Look for external documentation in DIRECTORY
index d05da55d6dcdd570427adf68824ce8ccae4a7a9c..1bb91ff0100adfa2d1b5a97bc19cd082c4e83708 100644 (file)
@@ -36,7 +36,6 @@ public class ValaDoc : Object {
        private static string gir_name = null;
        private static string gir_namespace = null;
        private static string gir_version = null;
-       private static string driverpath = null;
 
        private static bool add_inherited = false;
        private static bool _protected = true;
@@ -90,7 +89,7 @@ public class ValaDoc : Object {
                { "vapidir", 0, 0, OptionArg.FILENAME_ARRAY, ref vapi_directories, "Look for package bindings in DIRECTORY", "DIRECTORY..." },
                { "pkg", 0, 0, OptionArg.STRING_ARRAY, ref packages, "Include binding for PACKAGE", "PACKAGE..." },
 
-               { "driver", 0, 0, OptionArg.STRING, ref driverpath, "Name of an driver or path to a custom driver", null },
+               { "driver", 0, OptionFlags.OPTIONAL_ARG, OptionArg.CALLBACK, (void*) option_deprecated, "Name of an driver or path to a custom driver (DEPRECATED AND IGNORED)", null },
 
                { "importdir", 0, 0, OptionArg.FILENAME_ARRAY, ref import_directories, "Look for external documentation in DIRECTORY", "DIRECTORY..." },
                { "import", 0, 0, OptionArg.STRING_ARRAY, ref import_packages, "Include binding for PACKAGE", "PACKAGE..." },
@@ -124,6 +123,11 @@ public class ValaDoc : Object {
                { null }
        };
 
+       static bool option_deprecated (string option_name, string? val, void* data) throws OptionError {
+               stdout.printf ("Command-line option `%s` is deprecated and will be ignored\n", option_name);
+               return true;
+       }
+
        private static int quit (ErrorReporter reporter) {
                if (reporter.errors == 0 && (!fatal_warnings || reporter.warnings == 0)) {
                        stdout.printf ("Succeeded - %d warning(s)\n", reporter.warnings);
@@ -163,11 +167,10 @@ public class ValaDoc : Object {
                return ValaDoc.pkg_name;
        }
 
-       private ModuleLoader? create_module_loader (ErrorReporter reporter, out Doclet? doclet, out Driver? driver) {
+       private ModuleLoader? create_module_loader (ErrorReporter reporter, out Doclet? doclet) {
                ModuleLoader modules = ModuleLoader.get_instance ();
 
                doclet = null;
-               driver = null;
 
                // doclet:
                string? pluginpath = ModuleLoader.get_doclet_path (docletpath, reporter);
@@ -181,12 +184,6 @@ public class ValaDoc : Object {
                        return null;
                }
 
-
-               // driver:
-               driver = new Valadoc.Drivers.Driver ();
-
-               assert (driver != null && doclet != null);
-
                return modules;
        }
 
@@ -235,20 +232,18 @@ public class ValaDoc : Object {
                settings.alternative_resource_dirs = alternative_resource_dirs;
 
 
+               var driver = new Valadoc.Drivers.Driver ();
+
                // load plugins:
                Doclet? doclet = null;
-               Driver? driver = null;
-
-               ModuleLoader? modules = create_module_loader (reporter, out doclet, out driver);
+               ModuleLoader? modules = create_module_loader (reporter, out doclet);
                if (reporter.errors > 0 || modules == null) {
                        return quit (reporter);
                }
 
-
                // Create tree:
                Valadoc.Api.Tree doctree = driver.build (settings, reporter);
                if (reporter.errors > 0) {
-                       driver = null;
                        doclet = null;
                        return quit (reporter);
                }