Skip to content

Commit

Permalink
Merge branch 'topic/ada_language_server#1173' into 'master'
Browse files Browse the repository at this point in the history
Log the ALS build date next to its version

See merge request eng/ide/ada_language_server!1340
  • Loading branch information
AnthonyLeonardoGracio committed Sep 5, 2023
2 parents fffb7ea + 58c1598 commit 7b9e69e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ ROOTDIR=$(shell pwd)

# ALS version
VERSION ?=

# ALS build date
BUILD_DATE ?=

# Location of home dir for tests
export ALS_HOME=$(ROOTDIR)/testsuite

Expand Down Expand Up @@ -91,7 +95,7 @@ all: coverage-instrument
$(GPRBUILD) -P gnat/tester.gpr -p $(BUILD_FLAGS)
$(GPRBUILD) -d -ws -c -u -P gnat/lsp_server.gpr -p $(BUILD_FLAGS) s-memory.adb
$(GPRBUILD) -P gnat/lsp_server.gpr -p $(COVERAGE_BUILD_FLAGS) \
-XVERSION=$(VERSION)
-XVERSION=$(VERSION) -XBUILD_DATE=$(BUILD_DATE)
$(GPRBUILD) -P gnat/codec_test.gpr -p $(COVERAGE_BUILD_FLAGS)
$(GPRBUILD) -P gnat/lsp_client.gpr -p $(COVERAGE_BUILD_FLAGS) \
-XVERSION=$(VERSION)
Expand All @@ -111,7 +115,7 @@ ifneq ($(COVERAGE),)
# Remove artifacts from previous instrumentations, so that stale units that
# are not overriden by new ones don't get in our way.
rm -rf .obj/*/gnatcov-instr
$(COVERAGE_INSTR) -XVERSION=$(VERSION) \
$(COVERAGE_INSTR) -XVERSION=$(VERSION) XBUILD_DATE=$(BUILD_DATE) \
-Pgnat/lsp_server.gpr --projects lsp_server --projects lsp
$(COVERAGE_INSTR) -Pgnat/tester.gpr --projects lsp
$(COVERAGE_INSTR) -Pgnat/codec_test.gpr --projects lsp
Expand Down
5 changes: 4 additions & 1 deletion gnat/lsp_server.gpr
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ project LSP_Server is

VERSION := external ("VERSION", "latest");

BUILD_DATE := external ("BUILD_DATE", "unknown");

type Library_Kind is ("static", "static-pic", "relocatable");
Library_Type : Library_Kind := external("ALS_LIBRARY_TYPE",
external("LIBRARY_TYPE", "relocatable"));
Expand All @@ -50,7 +52,8 @@ project LSP_Server is
package Compiler is
for Default_Switches ("Ada") use LSP.Compiler'Default_Switches ("Ada");
for Switches ("lsp-ada_driver.adb") use
LSP.Compiler'Default_Switches ("Ada") & ("-gnateDVERSION=""" & VERSION & """");
LSP.Compiler'Default_Switches ("Ada") &
("-gnateDVERSION=""" & VERSION & """", "-gnateDBUILD_DATE=""" & BUILD_DATE & """");
for Switches ("s-memory.adb") use ("-g", "-O2", "-gnatpg");
for Local_Configuration_Pragmas use "gnat.adc";
end Compiler;
Expand Down
5 changes: 3 additions & 2 deletions source/ada/lsp-ada_driver.adb
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,8 @@ begin
VSS.Command_Line.Process; -- Will exit if errors or help requested.

if VSS.Command_Line.Is_Specified (Version_Option) then
Ada.Text_IO.Put_Line ("ALS version: " & $VERSION);
Ada.Text_IO.Put_Line
("ALS version: " & $VERSION & " (" & $BUILD_DATE & ")");
GNAT.OS_Lib.OS_Exit (0);
end if;

Expand Down Expand Up @@ -316,7 +317,7 @@ begin
end;
end if;

Server_Trace.Trace ("ALS version: " & $VERSION);
Server_Trace.Trace ("ALS version: " & $VERSION & " (" & $BUILD_DATE & ")");

Server_Trace.Trace ("Initializing server ...");

Expand Down

0 comments on commit 7b9e69e

Please sign in to comment.