Skip to content

Commit

Permalink
Merge branch '96-transition-gnatcheck-worker-to-use-java-implementati…
Browse files Browse the repository at this point in the history
…on-by-default' into 'master'

Switch default GNATcheck worker implementation to native_jit.

Closes #96

See merge request eng/libadalang/langkit-query-language!75
  • Loading branch information
Roldak committed Jul 20, 2023
2 parents 754e72d + 5a9b214 commit 6053204
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 15 deletions.
16 changes: 11 additions & 5 deletions lkql_checker/lalcheck/gnatcheck-options.ads
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,20 @@ package Gnatcheck.Options is
-- The name of the environment variable used to define a custom worker
-- executable.

Use_Custom_Worker : constant Boolean :=
Ada.Environment_Variables.Exists (Custom_Worker_Var);
Default_Worker : constant String := "native_gnatcheck_worker";
-- The name of the worker executable to use.

Worker_Name : constant String :=
(if Ada.Environment_Variables.Exists (Custom_Worker_Var)
then Ada.Environment_Variables.Value (Custom_Worker_Var)
else Default_Worker);
-- The name of the worker to use.

Use_External_Worker : constant Boolean := Worker_Name /= "gnatcheck";
-- Whether a custom GNATcheck worker executable should be used

Worker_Command : constant String :=
(if Use_Custom_Worker
then Ada.Environment_Variables.Value (Custom_Worker_Var)
else Command_Name);
(if Use_External_Worker then Worker_Name else Command_Name);
-- The executable to use as GNATcheck worker

RTS_Path : GNAT.OS_Lib.String_Access := new String'("");
Expand Down
8 changes: 4 additions & 4 deletions lkql_checker/lalcheck/lalcheck.adb
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,10 @@ procedure Lalcheck is
-- by users to specify rules). Otherwise, they are transfered in a
-- more universal format that can be easily parsed by custom
-- worker implementations.
if Worker_Command = Ada.Command_Line.Command_Name then
All_Rules.Table (Rule).Print_Rule_To_File (File);
else
if Use_External_Worker then
All_Rules.Table (Rule).Print_Rule_To_Universal_File (File);
else
All_Rules.Table (Rule).Print_Rule_To_File (File);
end if;
New_Line (File);
end if;
Expand Down Expand Up @@ -439,7 +439,7 @@ begin
-- In the default (-j1, no custom worker) mode, process all sources in
-- the main process.

if Process_Num <= 1 and then not Use_Custom_Worker then
if Process_Num <= 1 and then not Use_External_Worker then

-- Spawn gprbuild in background to process the files in parallel

Expand Down
2 changes: 1 addition & 1 deletion testsuite/support/base_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def define_lkql_executables(self):
if self.env.options.mode == "ada":
self.lkql_exe = ["lkql_ada"]
self.lkql_checker_exe = ["lkql_checker"]
self.gnatcheck_worker_exe = []
self.gnatcheck_worker_exe = ["gnatcheck"]

# If the mode is JIT
elif self.env.options.mode == "jit":
Expand Down
8 changes: 3 additions & 5 deletions testsuite/support/gnatcheck_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,9 @@ def run(self):
# happens in production: the checkout used for testing is separate
# from that used for building).
gnatcheck_env["LKQL_RULES_PATH"] = ""

if self.gnatcheck_worker_exe:
gnatcheck_env["GNATCHECK_WORKER"] = " ".join(
self.gnatcheck_worker_exe
)
gnatcheck_env["GNATCHECK_WORKER"] = " ".join(
self.gnatcheck_worker_exe
)

globs, locs = {}, {}
global_python = self.test_env.get("global_python", None)
Expand Down

0 comments on commit 6053204

Please sign in to comment.