Skip to content

Commit 2bbccda

Browse files
committed
Add support for "default" runtime
As gnatls does not support --RTS=default add a filter to replace "default" with empty string which leads to the same expected result. Change-Id: I367f71f058a1473d935c8a2c615770138bdf1791 TN: T715-031
1 parent a3d2975 commit 2bbccda

File tree

4 files changed

+53
-8
lines changed

4 files changed

+53
-8
lines changed

src/gnatcoll-projects.adb

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8098,20 +8098,26 @@ package body GNATCOLL.Projects is
80988098
function Get_Value_Of_Runtime (Project : Project_Id) return String is
80998099
Elem : constant Array_Element_Id := Value_Of
81008100
(Get_String ("runtime"), Project.Decl.Arrays, Shared);
8101+
8102+
function Filter_Default (S : String) return String is
8103+
(if S = "default" then Unset else S);
8104+
-- Unlike gprconfig, gnatls cannot process --RTS=default, so we need
8105+
-- to replace it with empty value.
81018106
begin
81028107
if Elem = No_Array_Element then
81038108
if Project.Extends = GPR.No_Project then
8104-
return Value_Of (Nil_Variable_Value, Unset);
8109+
return Filter_Default (Value_Of (Nil_Variable_Value, Unset));
81058110
else
8106-
return Get_Value_Of_Runtime (Project.Extends);
8111+
return Filter_Default (Get_Value_Of_Runtime (Project.Extends));
81078112
end if;
81088113
else
8109-
return Value_Of
8110-
(Value_Of
8111-
(Index => Get_String ("ada"),
8112-
In_Array => Elem,
8113-
Shared => Shared),
8114-
Unset);
8114+
return Filter_Default
8115+
(Value_Of
8116+
(Value_Of
8117+
(Index => Get_String ("ada"),
8118+
In_Array => Elem,
8119+
Shared => Shared),
8120+
Unset));
81158121
end if;
81168122
end Get_Value_Of_Runtime;
81178123

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
abstract project simple is
2+
3+
for Runtime ("Ada") use "default";
4+
5+
end simple;
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
with GNATCOLL.Projects; use GNATCOLL.Projects;
2+
with GNATCOLL.VFS; use GNATCOLL.VFS;
3+
with GNATCOLL.Projects.Aux;
4+
5+
with Test_Assert;
6+
7+
function Test return Integer is
8+
PT : Project_Tree;
9+
Env : Project_Environment_Access;
10+
begin
11+
Initialize (Env);
12+
Env.Set_Automatic_Config_File;
13+
PT.Load (Create ("simple.gpr"), Env);
14+
15+
declare
16+
Predef_Sources : constant File_Array := Env.Predefined_Source_Files;
17+
begin
18+
Test_Assert.Assert
19+
(Predef_Sources'Length > 0,
20+
"check if runtime is found");
21+
end;
22+
23+
GNATCOLL.Projects.Aux.Delete_All_Temp_Files (PT.Root_Project);
24+
25+
PT.Unload;
26+
Free (Env);
27+
return Test_Assert.Report;
28+
29+
end Test;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
description: >
2+
Check that explicitly specified value "default"
3+
for Ada runtime is properly processed.
4+
data:
5+
- "simple.gpr"

0 commit comments

Comments
 (0)