diff --git a/Makefile b/Makefile index 34ee2b8..428d691 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,8 @@ SCENARIO_VARIABLES=-XGPR_UNIT_PROVIDER_LIBRARY_TYPE=static -XGPR_UNIT_PROVIDER_B all: build-gnatdoc +build-all: build-libgnatdoc build-gnatdoc build-tests + build-libgnatdoc: gprbuild -j0 -p -P gnat/libgnatdoc.gpr @@ -14,8 +16,6 @@ build-gnatdoc: clean: rm -rf .objs bin -build_tests: build-tests # for compatibility with ANOD specs - build-tests: gprbuild -j0 -p -P gnat/tests/test_drivers.gpr ${SCENARIO_VARIABLES} diff --git a/source/gnatdoc/gnatdoc-command_line.adb b/source/gnatdoc/gnatdoc-command_line.adb index e9d8c28..0d70c03 100644 --- a/source/gnatdoc/gnatdoc-command_line.adb +++ b/source/gnatdoc/gnatdoc-command_line.adb @@ -21,9 +21,13 @@ with VSS.Strings.Conversions; with GNATdoc.Comments.Options; with GNATdoc.Options; +with GNATdoc.Version; with GPR2.Options; with GPR2.Project.Registry.Exchange; +with VSS.Strings.Formatters; +with VSS.Strings.Formatters.Strings; +with VSS.Strings.Templates; package body GNATdoc.Command_Line is @@ -32,6 +36,11 @@ package body GNATdoc.Command_Line is Long_Name => "help", Description => "Display help information"); + Version_Option : constant VSS.Command_Line.Binary_Option := + (Short_Name => <>, + Long_Name => "version", + Description => "Display the program version"); + Backend_Option : constant VSS.Command_Line.Value_Option := (Short_Name => <>, Long_Name => "backend", @@ -121,6 +130,7 @@ package body GNATdoc.Command_Line is procedure Initialize is begin Parser.Add_Option (Help_Option); + Parser.Add_Option (Version_Option); Parser.Add_Option (Print_Gpr_Registry_Option); Parser.Add_Option (Style_Option); Parser.Add_Option (Backend_Option); @@ -173,6 +183,20 @@ package body GNATdoc.Command_Line is VSS.Command_Line.Report_Message (Parser.Help_Text); end if; + if Parser.Is_Specified (Version_Option) then + declare + Template : constant + VSS.Strings.Templates.Virtual_String_Template := + "GNATdoc {}"; + + begin + VSS.Command_Line.Report_Error + (Template.Format + (VSS.Strings.Formatters.Strings.Image + (GNATdoc.Version.Version_String))); + end; + end if; + -- Process `--print-gpr-registry` if specified if Parser.Is_Specified (Print_Gpr_Registry_Option) then diff --git a/source/gnatdoc/gnatdoc-version.ads b/source/gnatdoc/gnatdoc-version.ads new file mode 100644 index 0000000..193bb88 --- /dev/null +++ b/source/gnatdoc/gnatdoc-version.ads @@ -0,0 +1,23 @@ +------------------------------------------------------------------------------ +-- GNAT Documentation Generation Tool -- +-- -- +-- Copyright (C) 2024, AdaCore -- +-- -- +-- This is free software; you can redistribute it and/or modify it under -- +-- terms of the GNU General Public License as published by the Free Soft- -- +-- ware Foundation; either version 3, or (at your option) any later ver- -- +-- sion. This software is distributed in the hope that it will be useful, -- +-- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- -- +-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public -- +-- License for more details. You should have received a copy of the GNU -- +-- General Public License distributed with this software; see file -- +-- COPYING3. If not, go to http://www.gnu.org/licenses for a complete copy -- +-- of the license. -- +------------------------------------------------------------------------------ + +package GNATdoc.Version is + + Version_String : VSS.Strings.Virtual_String := + "%VERSION% (%DATE%)"; + +end GNATdoc.Version;