Skip to content

Commit 58c1598

Browse files
Log the ALS build date next to its version
This allows to distinguish which wavefront is used. For eng/ide/ada_language_server#1173
1 parent fffb7ea commit 58c1598

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ ROOTDIR=$(shell pwd)
33

44
# ALS version
55
VERSION ?=
6+
7+
# ALS build date
8+
BUILD_DATE ?=
9+
610
# Location of home dir for tests
711
export ALS_HOME=$(ROOTDIR)/testsuite
812

@@ -91,7 +95,7 @@ all: coverage-instrument
9195
$(GPRBUILD) -P gnat/tester.gpr -p $(BUILD_FLAGS)
9296
$(GPRBUILD) -d -ws -c -u -P gnat/lsp_server.gpr -p $(BUILD_FLAGS) s-memory.adb
9397
$(GPRBUILD) -P gnat/lsp_server.gpr -p $(COVERAGE_BUILD_FLAGS) \
94-
-XVERSION=$(VERSION)
98+
-XVERSION=$(VERSION) -XBUILD_DATE=$(BUILD_DATE)
9599
$(GPRBUILD) -P gnat/codec_test.gpr -p $(COVERAGE_BUILD_FLAGS)
96100
$(GPRBUILD) -P gnat/lsp_client.gpr -p $(COVERAGE_BUILD_FLAGS) \
97101
-XVERSION=$(VERSION)
@@ -111,7 +115,7 @@ ifneq ($(COVERAGE),)
111115
# Remove artifacts from previous instrumentations, so that stale units that
112116
# are not overriden by new ones don't get in our way.
113117
rm -rf .obj/*/gnatcov-instr
114-
$(COVERAGE_INSTR) -XVERSION=$(VERSION) \
118+
$(COVERAGE_INSTR) -XVERSION=$(VERSION) XBUILD_DATE=$(BUILD_DATE) \
115119
-Pgnat/lsp_server.gpr --projects lsp_server --projects lsp
116120
$(COVERAGE_INSTR) -Pgnat/tester.gpr --projects lsp
117121
$(COVERAGE_INSTR) -Pgnat/codec_test.gpr --projects lsp

gnat/lsp_server.gpr

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ project LSP_Server is
2929

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

32+
BUILD_DATE := external ("BUILD_DATE", "unknown");
33+
3234
type Library_Kind is ("static", "static-pic", "relocatable");
3335
Library_Type : Library_Kind := external("ALS_LIBRARY_TYPE",
3436
external("LIBRARY_TYPE", "relocatable"));
@@ -50,7 +52,8 @@ project LSP_Server is
5052
package Compiler is
5153
for Default_Switches ("Ada") use LSP.Compiler'Default_Switches ("Ada");
5254
for Switches ("lsp-ada_driver.adb") use
53-
LSP.Compiler'Default_Switches ("Ada") & ("-gnateDVERSION=""" & VERSION & """");
55+
LSP.Compiler'Default_Switches ("Ada") &
56+
("-gnateDVERSION=""" & VERSION & """", "-gnateDBUILD_DATE=""" & BUILD_DATE & """");
5457
for Switches ("s-memory.adb") use ("-g", "-O2", "-gnatpg");
5558
for Local_Configuration_Pragmas use "gnat.adc";
5659
end Compiler;

source/ada/lsp-ada_driver.adb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,8 @@ begin
243243
VSS.Command_Line.Process; -- Will exit if errors or help requested.
244244

245245
if VSS.Command_Line.Is_Specified (Version_Option) then
246-
Ada.Text_IO.Put_Line ("ALS version: " & $VERSION);
246+
Ada.Text_IO.Put_Line
247+
("ALS version: " & $VERSION & " (" & $BUILD_DATE & ")");
247248
GNAT.OS_Lib.OS_Exit (0);
248249
end if;
249250

@@ -316,7 +317,7 @@ begin
316317
end;
317318
end if;
318319

319-
Server_Trace.Trace ("ALS version: " & $VERSION);
320+
Server_Trace.Trace ("ALS version: " & $VERSION & " (" & $BUILD_DATE & ")");
320321

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

0 commit comments

Comments
 (0)